[Patch] Changing mac address does not always work

Arnaud YSMAL arnaud.ysmal at stormshield.eu
Fri Jun 10 11:46:56 UTC 2016


Thank you, you can find enclosed a patch following your suggestion.

----- Le 8 Juin 16, à 22:40, Eric Joyner ricera10 at gmail.com a écrit :

> 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 at 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 at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> > To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_init_on_set_mtu.patch
Type: text/x-patch
Size: 3858 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20160610/52fb3b32/attachment.bin>


More information about the freebsd-net mailing list