Wifi tethering: Cannot enable NAT -2/No such file or directory or -97/Address family not supported by protocol
Thomas Bartosik <[email protected]> Thu, 23 Oct 2025 22:59:50 +0000
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <VI1PR09MB4462DB922DCF5D30C77BB49DF2F0A@VI1PR09MB4462.eurprd09.prod.outlook.com> |
Hello list!=0A=
=0A=
I am trying to make connman wifi tethering work.=0A=
I read the README in the git repo (but I think it is outdated for current k=
ernels; i use 6.12; e.g. CONFIG_NF_CONNTRACK_IPV4 also is now CONFIG_NF_CON=
NTRACK if I am not mistaken).=0A=
I therefore enabled:=0A=
=0A=
CONFIG_BRIDGE=3Dm=0A=
=0A=
and, as my kernel config help says:=0A=
CONFIG_IP_NF_TARGET_MASQUERADE:=0A=
This is a backwards-compat option for the user's convenience=0A=
(e.g. when running oldconfig). It selects NETFILTER_XT_TARGET_MASQUERADE.=
=0A=
=0A=
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=3Dm=0A=
=0A=
lsmod tells me:=0A=
=0A=
# lsmod | egrep "(ip|xt|nat|bridge|nf)"=0A=
xt_nat 12288 0=0A=
xt_MASQUERADE 12288 0=0A=
iptable_nat 12288 0=0A=
nf_nat 40960 3 xt_nat,iptable_nat,xt_MASQUERADE=0A=
nf_conntrack 110592 3 nf_nat,xt_nat,xt_MASQUERADE=0A=
nf_defrag_ipv4 12288 1 nf_conntrack=0A=
iptable_filter 12288 0=0A=
ip_tables 20480 2 iptable_filter,iptable_nat=0A=
x_tables 40960 5 iptable_filter,xt_nat,ip_tables,iptable_nat=
,xt_MASQUERADE=0A=
bridge 233472 0=0A=
stp 12288 1 bridge=0A=
llc 12288 2 bridge,stp=0A=
nf_tables 331776 0=0A=
libcrc32c 12288 3 nf_conntrack,nf_nat,nf_tables=0A=
nfnetlink 16384 1 nf_tables=0A=
=0A=
so I guess the kernel config should be fine.=0A=
=0A=
I do not have nor do I want IPv6 support (and I think I should not need it,=
right?). I also want to use nftables, I do not have iptables.=0A=
=0A=
This is Gentoo, connman is installed with=0A=
=0A=
Installed versions: 1.45(14:47:49 2025-08-11)(bluetooth ethernet nftables =
openvpn policykit tools wifi -debug -doc -examples -iptables -iwd -l2tp -ne=
tworkmanager -ofono -openconnect -pptp -vpnc -wireguard -wispr)=0A=
=0A=
which translates to=0A=
./configure --prefix=3D/usr --build=3Dx86_64-pc-linux-gnu --host=3Dx86_64-p=
c-linux-gnu --mandir=3D/usr/share/man --infodir=3D/usr/share/info --datadir=
=3D/usr/share --sysconfdir=3D/etc --localstatedir=3D/var/lib --datarootdir=
=3D/usr/share --disable-dependency-tracking --disable-silent-rules --disabl=
e-static --docdir=3D/usr/share/doc/connman-1.45 --htmldir=3D/usr/share/doc/=
connman-1.45/html --with-sysroot=3D/ --libdir=3D/usr/lib64 --localstatedir=
=3D/var --runstatedir=3D/run --with-systemdunitdir=3D/usr/lib/systemd/syste=
m --with-tmpfilesdir=3D/usr/lib/tmpfiles.d --enable-client --enable-datafil=
es --enable-loopback=3Dbuiltin --enable-bluetooth=3Dbuiltin --disable-debug=
--enable-ethernet=3Dbuiltin --disable-test --disable-l2tp --disable-nmcomp=
at --disable-ofono --disable-openconnect --enable-openvpn=3Dbuiltin --enabl=
e-polkit=3Dbuiltin --disable-pptp --enable-tools --disable-vpnc --disable-w=
ireguard --disable-wispr --with-firewall=3Dnftables --disable-iospm --disab=
le-hh2serial-gps --disable-iwd --enable-wifi=3Dbuiltin=0A=
=0A=
I enable tethering with=0A=
connmanctl> tether wifi on myap password1234=0A=
Wifi SSID set=0A=
Wifi passphrase set=0A=
Error enabling wifi tethering: Not supported=0A=
=0A=
The syslog says:=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {create} index 10 type 1 <ETHER=
>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {update} flags 4098 <DOWN>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 address 26:2=
4:7F:6D:05:20 mtu 1500=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 operstate 2 =
<DOWN>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {update} flags 102467 <UP,RUNNI=
NG,LOWER_UP>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 address 26:2=
4:7F:6D:05:20 mtu 1500=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 operstate 0 =
<UNKNOWN>=0A=
Oct 23 23:06:56 connmand[2414]: No IPv6 support=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {update} flags 36931 <UP,RUNNIN=
G>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 address 1A:1=
5:DC:E6:69:E2 mtu 1500=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 operstate 0 =
<UNKNOWN>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {update} flags 36867 <UP>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 address 1A:1=
5:DC:E6:69:E2 mtu 1500=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 operstate 2 =
<DOWN>=0A=
Oct 23 23:06:56 connmand[2414]: No IPv6 support=0A=
Oct 23 23:06:56 connmand[2414]: DHCP server: option_code 1 option_value 25=
5.255.255.0=0A=
Oct 23 23:06:56 connmand[2414]: DHCP server: option_code 3 option_value 19=
2.168.0.1=0A=
Oct 23 23:06:56 connmand[2414]: DHCP server: option_code 6 option_value 19=
2.168.0.1=0A=
Oct 23 23:06:56 connmand[2414]: Cannot enable NAT -2/No such file or direc=
tory=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {update} flags 36866 <DOWN>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 address 1A:1=
5:DC:E6:69:E2 mtu 1500=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {newlink} index 10 operstate 2 =
<DOWN>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {dellink} index 10 operstate 2 =
<DOWN>=0A=
Oct 23 23:06:56 connman-vpnd[2498]: tether {remove} index 10=0A=
Oct 23 23:06:56 connmand[2414]: failed to read /proc/sys/net/ipv6/conf/all=
/disable_ipv6=0A=
Oct 23 23:06:56 connmand[2414]: (null) {create} index 10 type 1 <ETHER>=0A=
Oct 23 23:06:56 connmand[2414]: (null) {update} flags 4098 <DOWN>=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 address 26:24:7F=
:6D:05:20 mtu 1500=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 operstate 2 <DOW=
N>=0A=
Oct 23 23:06:56 connmand[2414]: (null) {add} address 192.168.0.1/24 label =
tether family 2=0A=
Oct 23 23:06:56 connmand[2414]: (null) {update} flags 102467 <UP,RUNNING,L=
OWER_UP>=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 address 26:24:7F=
:6D:05:20 mtu 1500=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 operstate 0 <UNK=
NOWN>=0A=
Oct 23 23:06:56 connmand[2414]: (null) {update} flags 36931 <UP,RUNNING>=
=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 address 1A:15:DC=
:E6:69:E2 mtu 1500=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 operstate 0 <UNK=
NOWN>=0A=
Oct 23 23:06:56 connmand[2414]: (null) {update} flags 36867 <UP>=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 address 1A:15:DC=
:E6:69:E2 mtu 1500=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 operstate 2 <DOW=
N>=0A=
Oct 23 23:06:56 connmand[2414]: (null) {del} address 192.168.0.1/24 label =
tether=0A=
Oct 23 23:06:56 connmand[2414]: (null) {update} flags 36866 <DOWN>=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 address 1A:15:DC=
:E6:69:E2 mtu 1500=0A=
Oct 23 23:06:56 connmand[2414]: tether {newlink} index 10 operstate 2 <DOW=
N>=0A=
Oct 23 23:06:56 connmand[2414]: tether {dellink} index 10 operstate 2 <DOW=
N>=0A=
Oct 23 23:06:56 connmand[2414]: (null) {remove} index 10=0A=
=0A=
So "connmand[2414]: Cannot enable NAT -2/No such file or directory".=0A=
=0A=
I therefore strace'd connmand and got:=0A=
connmand[5866]: No IPv6 support=0A=
connmand[5866]: No IPv6 support=0A=
connmand[5866]: DHCP server: option_code 1 option_value 255.255.255.0=0A=
connmand[5866]: DHCP server: option_code 3 option_value 192.168.0.1=0A=
connmand[5866]: DHCP server: option_code 6 option_value 192.168.0.1=0A=
openat(AT_FDCWD, "/proc/sys/net/ipv4/ip_forward", O_RDWR|O_CLOEXEC) =3D 27=
=0A=
connmand[5866]: Cannot enable NAT -2/No such file or directory=0A=
openat(AT_FDCWD, "/proc/sys/net/ipv6/conf/all/disable_ipv6", O_RDONLY) =3D =
-1 ENOENT (No such file or directory)=0A=
connmand[5866]: failed to read /proc/sys/net/ipv6/conf/all/disable_ipv6=0A=
connmand[5866]: (null) {create} index 6 type 1 <ETHER>=0A=
=0A=
This somehow seems like ipv6 is strictly necessary/the check is hard coded,=
or is my interpretation wrong? Do I need to add some kind of config variab=
le/parameter to disable v6?=0A=
It would seem to me connman correctly detects "No IPv6 support".=0A=
=0A=
Running in debug mode gives me=0A=
connmand[25248]: src/firewall-nftables.c:__connman_firewall_create()=0A=
connmand[25248]: src/firewall-nftables.c:__connman_firewall_enable_nat() ad=
dress 192.168.0.2/24 interface wlan0=0A=
connmand[25248]: Cannot enable NAT -2/No such file or directory=0A=
so it seems nftables gets used.=0A=
=0A=
I tried to add some debug statements, but if I do so, the error message cha=
nges (?) and sometimes I even get "Enabled tethering for wifi"!=0A=
=0A=
connmand[29044]: src/firewall-nftables.c:rule_cmd() in rule_cmd=0A=
connmand[29044]: src/firewall-nftables.c:send_and_dispatch() in send_and_di=
spatch=0A=
connmand[29044]: src/firewall-nftables.c:send_and_dispatch() after debug mn=
l dump rule=0A=
connmand[29044]: src/firewall-nftables.c:send_and_dispatch() after mnl_sock=
et_sendto=0A=
connmand[29044]: src/firewall-nftables.c:rule_cmd() after send_and_dispatch=
, err: -97=0A=
connmand[29044]: src/firewall-nftables.c:__connman_firewall_enable_nat() af=
ter rule_cmd=0A=
connmand[29044]: Cannot enable NAT -97/Address family not supported by prot=
ocol=0A=
=0A=
this is what I added to firewall-nftables.c:=0A=
281 DBG("in send_and_dispatch");=0A=
282 debug_mnl_dump_rule(req, req_size);=0A=
283 DBG("after debug mnl dump rule");=0A=
284=0A=
285 err =3D mnl_socket_sendto(nl, req, req_size);=0A=
286 DBG("after mnl_socket_sendto");=0A=
287 if (err < 0)=0A=
288 DBG("mnl_socket_sendto err");=0A=
289 return -errno;=0A=
290=0A=
291=0A=
292 DBG("send_and_dispatch: err1: %d",err);=0A=
293 portid =3D mnl_socket_get_portid(nl);=0A=
294 DBG("send_and_dispatch: err2: %d",err);=0A=
295 cb.type =3D callback_type;=0A=
=0A=
I don't understand why I never hit line 292.=0A=
Sorry if this is of no real help, my dev skills are pretty limited..=0A=
=0A=
One last question: Can I tether wifi to wifi if it works, i.e. use my noteb=
ook as a quick range extender for a microcontroller with bad antenna design=
?=0A=
preferrably bridged, not NATed?=0A=
I have one Intel Corporation Wireless 8265 / 8275 in this notebook.=0A=
AP mode basically works with hostapd.=0A=
=0A=
Thanks for you patience!=0A=
=0A=
Best,=0A=
Thomas=