Re: timing issue with ifconfig em(4) at rc.d start?

From: Freddie Cash <fjwcash_at_gmail.com>
Date: Wed, 22 Aug 2018 13:30:37 -0700
On Wed, Aug 22, 2018 at 1:25 PM Andreas Ott <andreas_at_naund.org> wrote:

> Yesterday I installed a server from scratch from image
> FreeBSD-12.0-ALPHA2-amd64-20180816-r337934-memstick.img,
> then I updated sources with svn and did make buildworld, buildkernel,
> installkernel, installworld, mergemaster. Upon reboot I can no longer
> talk to the server on IPv4 but it works on IPv6, ifconfig tells me
> there is no 'inet' address configured. No IPv4 inet routes are in
> place either.
>
> If I run '/etc/rc.d/netif restart' from root shell on KVM console, I can
> observe that the interface is taken down, the link light goes dark,
> and then comes back up. However the "UP" log notification appears in
> time *after* ifconfig attempts to apply settings to an interface
> that is still down as it prints out to screen (em1 is shown there
> as 'status: no carrier' at the time).
>
> em1: link state changed to DOWN
>
> <ifconfig prints to screen>
>
> Link state changed to up
> em1: link state changed to UP
>
> Is there a way to delay the 'ifconfig inet' until after the link light
> comes up? Or how do I force configuring an interface that's down in rc?
> Nothing changed on the configuration side or the network switch
> side since the original install. I also see in em(4) that the driver
> has been reworked for 12.0, so maybe this is due to a code change?
>
>
> This is running on hardware Dell R610 with a 4-port Intel PCIe NIC card
>
> em0_at_pci0:6:0:0: class=0x020000 card=0x10bc8086 chip=0x10bc8086 rev=0x06
> hdr=0x00
> em1_at_pci0:6:0:1: class=0x020000 card=0x10bc8086 chip=0x10bc8086 rev=0x06
> hdr=0x00
> em2_at_pci0:7:0:0: class=0x020000 card=0x10bc8086 chip=0x10bc8086 rev=0x06
> hdr=0x00
> em3_at_pci0:7:0:1: class=0x020000 card=0x10bc8086 chip=0x10bc8086 rev=0x06
> hdr=0x00
>     vendor     = 'Intel Corporation'
>     device     = '82571EB/82571GB Gigabit Ethernet Controller (Copper)'
>     class      = network
>     subclass   = ethernet
>
>
> $ freebsd-version -ku
> 12.0-ALPHA2
> 12.0-ALPHA2
>
> $uname -a
> FreeBSD f-current239.sjelab.net 12.0-ALPHA2 FreeBSD 12.0-ALPHA2 #0
> r338153: Tue Aug 21 21:02:41 UTC 2018     root_at_f-current239.sjelab.net:
> /usr/obj/usr/src/amd64.amd64/sys/GENERIC
>
> Relevant network config bits from /etc/rc.conf
>
> ifconfig_em1="inet 100.79.136.239 netmask 255.255.255.0 up"
> defaultrouter="100.79.136.1"
> ifconfig_em1="inet6 2600:c02:b020:136::239 prefixlen 64"
> ipv6_defaultrouter="2600:c02:b020:136::2"
>

There's nothing wrong with the timing. Your rc.conf is incorrect.

The second ifconfig_em1 line overrides the former.  These are variable
declarations, not commands.  The last setting for a variable is the only
one that takes place.

Either look through /etc/defaults/rc.conf for the ipv6-related entries, or
switch to using an alias entry for ipv6:

ifconfig_em1="inet 100.79.136.239 netmask 255.255.255.0 up"
ifconfig_em1_alias0="inet6 2600:c02:b020:136::239 prefixlen 64"

-- 
Freddie Cash
fjwcash_at_gmail.com
Received on Wed Aug 22 2018 - 18:30:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:17 UTC