Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Jun 2016 20:40:39 +0000
From:      Eric Joyner <ricera10@gmail.com>
To:        Arnaud YSMAL <arnaud.ysmal@stormshield.eu>, freebsd-net@freebsd.org
Subject:   Re: [Patch] Changing mac address does not always work
Message-ID:  <CA%2Bb0zg9sSP2k1h_mHb7_VcKAi%2B1ZfE_Kh8t=YKtDRCYNyhF37w@mail.gmail.com>
In-Reply-To: <494678734.3111275.1465379076220.JavaMail.zimbra@stormshield.eu>
References:  <494678734.3111275.1465379076220.JavaMail.zimbra@stormshield.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
I think a better fix here is to have the driver not call init_locked() when
the driver is not running when setting the MTU.

It looks like all the other Intel network drivers do the same thing as this
for the MTU.

On Wed, Jun 8, 2016 at 2:47 AM Arnaud YSMAL <arnaud.ysmal@stormshield.eu>
wrote:

> Hi,
>
> Configuring the network card with the following commands (in this specific
> order) does not work.
> # ifconfig em0 down
> # ifconfig em0 mtu 1500
> # ifconfig em0 ether 12:34:56:12:34:56
> # ifconfig em0 192.168.1.1/24
> # ifconfig em0 up
>
> I was able to reproduce this issue on 10.3-RELEASE and HEAD with ix and em
> drivers.
>
> From what I understand:
> - When setting the mtu, the driver calls the init of the interface which
> sets the IFF_DRV_RUNNING flag
> - When setting the mac address, if_setlladdr (from if.c) copy the mac
> address but does nothing else (the interface is not up)
> - When setting the ip address, the driver does not call the init as the
> IFF_DRV_RUNNING is already set.
> - When setting the up flag, same as above, the IFF_DRV_RUNNING is already
> set.
>
> In this case the network card does not work as the mac address filter is
> not up to date.
>
> The enclosed path fixes this issue,
> It changes if_setlladdr in if.c to call the ifp->if_ioctl function with
> the IFF_UP flag clear even when the interface is not up.
> The driver will then call its stop function which clear the
> IFF_DRV_RUNNING.
> The init will be called when setting the ip address or the up flag.
>
> Do you have any advice regarding this patch?
>
> Arnaud_______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2Bb0zg9sSP2k1h_mHb7_VcKAi%2B1ZfE_Kh8t=YKtDRCYNyhF37w>