Created attachment 225988 [details] Screen recording: wlan0 properly down, then brought up; gif0 unexpectedly up, then taken down man 5 rc.conf > … > If the ifconfig_⟨interface⟩ contains the keyword “NOAUTO” > then the interface will not be configured at boot or by > /etc/pccard_ether when network_interfaces is set to “AUTO”. > … With ifconfig_gif0_ipv6 set to include NOAUTO before a restart of the operating system, the interface was unexpectedly up following a restart. Relevant lines from the attached screen recording: % grep ifconfig_wlan0 /etc/rc.conf ifconfig_wlan0="WPA SYNCDHCP NOAUTO" % grep ifconfig_gif /etc/rc.conf | grep -v \# | cut -c 1-26,66-100 ifconfig_gif0_ipv6="inet6 prefixlen 128 NOAUTO" % Showing the ups and downs: gkrellm <https://www.freshports.org/sysutils/gkrellm2>
(In reply to Graham Perrin from comment #0) Can you provide a minimal rc.conf configuration and minimal steps to reproduce?
(In reply to Kubilay Kocak from comment #1) Adapted from <https://forums.FreeBSD.org/threads/80878/post-517622> (without disclosing full addresses): cloned_interfaces="gif0" create_args_gif0="tunnel 192.168.1.10 address.from.tunnel.provider mtu 1480" ifconfig_gif0_ipv6="inet6 ⋯:⋯:⋯:⋯::2 ⋯:⋯:⋯:⋯::1 prefixlen 128" ipv6_defaultrouter="⋯:⋯:⋯:⋯::1" IPv6 via Hurricane Electric's Free IPv6 Tunnel Broker Service <https://subatomicsolutions.org/8-freebsd/10-ipv6-via-hurricane-electric-s-free-ipv6-tunnel-broker-service> HTH, if not please let me know. Thanks.
(In reply to Graham Perrin from comment #2) > Adapted I forgot to adapt (to include the NOAUTO). Sorry. Here: cloned_interfaces="gif0" create_args_gif0="tunnel 192.168.1.10 address.from.tunnel.provider mtu 1480" ifconfig_gif0_ipv6="inet6 ⋯:⋯:⋯:⋯::2 ⋯:⋯:⋯:⋯::1 prefixlen 128 NOAUTO" ipv6_defaultrouter="⋯:⋯:⋯:⋯::1"
I see a very similar issue. rc.conf: ifconfig_em0="NOAUTO DHCP" wlans_iwn0="wlan0" ifconfig_wlan0="NOAUTO WPA DHCP" When I log into an X session, one of the things that happens is barrierc launches as a user process, and it sits in a window looping over failures because there is (correctly) no network. But then I notice it connecting, with ifconfig showing me a configured em0. Racing the system for a test, I logged in and quickly said 'ifconfig' in a terminal, and saw no configured interfaces, but I then quickly said 'ps ax | grep dhc' and saw: 84491 - R 0:00.01 /bin/sh /etc/rc.d/dhclient quietstart em0 (env) ...and shortly thereafter em0 was connected. And then, a bit later: $ ps ax | grep dhc 13818 - ICs 0:00.00 dhclient: em0 (dhclient) 89207 - Is 0:00.00 dhclient: system.syslog (dhclient) 91789 - Is 0:00.00 dhclient: em0 [priv] (dhclient) 58103 11 S+ 0:00.00 grep dhc I have yet to dig into what's launching the dhclient.
Random additional note: NOAUTO worked as expected under 12.
I have more detail. My X environment fires up barriec inside a new screen session. I can sit there and watch it try to connect for ages. If I say 'ifconfig' to look at what's configured, that seems to trigger something. It'll come back showing the interface down, but a dhclient fires up and configured em0. I assume this means devd is taking action somehow, and will try to track this further. (IP/MAC obscured) $ date Wed Aug 25 18:06:44 EDT 2021 $ ps ax | grep dhclient 82286 11 S+ 0:00.00 grep dhclient $ ifconfig em0: flags=8822<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=481249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,NOMAP> ether 00:11:22:33:44:55 media: Ethernet autoselect (1000baseT <full-duplex>) status: active nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> $ ps ax | grep dhclient 29602 - SCs 0:00.00 dhclient: em0 (dhclient) 95364 - Ss 0:00.00 dhclient: system.syslog (dhclient) 98418 - Ss 0:00.00 dhclient: em0 [priv] (dhclient) 36147 11 S+ 0:00.00 grep dhclient $ ifconfig em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=481249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,NOMAP> ether 00:11:22:33:44:55 inet 192.168.0.5 netmask 0xffffff00 broadcast 192.168.0.255 media: Ethernet autoselect (1000baseT <full-duplex>) status: active nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
This: nc -U /var/run/devd.pipe shows nothing until I type 'ifconfig', at which I see: # nc -U /var/run/devd.pipe !system=IFNET subsystem=em0 type=LINK_UP !system=IFNET subsystem=em0 type=LINK_DOWN !system=IFNET subsystem=em0 type=LINK_UP ...and this kicks off dhclient. Digging into the rules next to see why.
From /etc/devd.conf: # # Try to start dhclient on Ethernet-like interfaces when the link comes # up. Only devices that are configured to support DHCP will actually # run it. No link down rule exists because dhclient automatically exits # when the link goes down. # notify 0 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "ethernet"; action "service dhclient quietstart $subsystem"; }; # # Like Ethernet devices, but separate because 802.11 require spawning # wlan(4) interface. # attach 0 { device-name "$wifi-driver-regex"; action "/etc/pccard_ether $device-name startchildren"; }; detach 0 { device-name "$wifi-driver-regex"; action "/etc/pccard_ether $device-name stopchildren"; }; notify 0 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "802.11"; action "service dhclient quietstart $subsystem"; };
Next: Need to figure out a clean way to honor NOAUTO. There might be additional implications to Graham's variant where he sees open networks connected. Graham: Do you allow for open networks in your wpa_supplicant.conf?
Ugly and too many characters, but I'm thinking of something like: action "sysrc -e ifconfig_$subsystem | grep -qv NOAUTO && service dhclient quietstart $subsystem";
(In reply to Mason Loring Bliss from comment #9) > Do you allow for open networks in your wpa_supplicant.conf? No. Please see bug 256957
Created attachment 227436 [details] This patch appears to preserve NOAUTO behaviour. This patch appears to preserve NOAUTO behaviour. I want to verify that the code that parses devd.conf is happy with the line continuation, although we see that style earlier in the file. In network.subr the check is as follows: autoif() { local _tmpargs _arg _tmpargs=`_ifconfig_getargs $1` for _arg in $_tmpargs; do case $_arg in [Nn][Oo][Aa][Uu][Tt][Oo]) return 1 ;; esac done return 0 } As yet untested: What does sysrc do if an entry is simply missing?
I'm wondering if netif is depending on devd now, as if I specify "NOAUTO" I can't start my NIC with 'service netif start em0' any more. I can say 'dhclient em0' but netif just won't do it, and the only thing I've changed is this devd.conf handling. I'm a little baffled.
Just tried this in 15-CURRENT with iwlwifi. Upon boot ifconfig shows the interface without up or down in it's flags. `service netif start wlan0` works to connect to the network specified in wpa_supplicant, but it did spazz out with iwlwifi errors for about a minute first. Alternatively, issuing `ifconfig wlan0 up` makes it connect to the unsecured honeypot in this cafe.
Created attachment 258067 [details] This patch appears to preserve NOAUTO behaviour. ^Triage: rebase patch.
Cc'ing adrian and bz, I just had to -s boot and disable wifi because of a DHCPNAK loop on boot. This functionality is super critical for laptops. I'll recompile with the patch and see if that helps things.
(In reply to Alexander Ziaee from comment #16) This is nothing specific to wireless; this is an rc issue for all networking. If I were the people I'd go through the changes since 12 if it worked there and see when it broke... Also network_interfaces in rc.conf is ambiguous to NOAUTO vs DHCP etc.
> If I were the people I'd go through the changes since 12 if it worked there and see when it broke... That sounds wise, thank you. > Also network_interfaces in rc.conf is ambiguous to NOAUTO vs DHCP etc. What do you mean?