On 2020/09/13 14:47, Klemens Nanni wrote:
> So there's a dance around UP interfaces already;  CVS log dates this
> code back to 2010 when deraadt rearanged code into ifnewlladdr(), the
> previous if.c revision also head this dance around UP.
> 
> The if_down() line I removed from trunk(4) dates back to if_trunk.c r1.1
> from 2005.
> 
> 
> Here's some practical tests further indicating that my diff does not
> break anything and whatever sthen encountered at whatever time in the
> past is no longer an issue:

This was in 2015 btw.

> With my commit in -CURRENT, the MAC address *is* being restored on my
> physical interfaces:
> 
>       $ { ifconfig em0 ; ifconfig athn0 ; } | grep -e flags= -e lladdr
>       em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 3c:97:0e:6e:e9:1b
>       athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 04:f0:21:30:37:de
> 
>       $ doas ifconfig trunk0 trunkport em0 trunkport athn0
> 
>       $ { ifconfig em0 ; ifconfig athn0 ; } | grep -e flags= -e lladdr
>       em0: 
> flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 3c:97:0e:6e:e9:1b
>       athn0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 
> 1500
>               lladdr 3c:97:0e:6e:e9:1b
> 
>       $ doas ifconfig trunk0 destroy
> 
>       $ { ifconfig em0 ; ifconfig athn0 ; } | grep -e flags= -e lladdr
>       em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 3c:97:0e:6e:e9:1b
>       athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 04:f0:21:30:37:de
> 
> Observe how UP is set on the physical interfaces, i.e. my diff is in.
> MAC addresses of physical interfaces are properly restored.
> 
> They are also restored when I create the same trunk0 interface but
> generate a random MAC for it as well, i.e. overwriting MACs for all
> ports while in the trunk:
> 
> 
>       $ { ifconfig em0 ; ifconfig athn0 ; } | grep -e flags= -e lladdr
>       em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 3c:97:0e:6e:e9:1b
>       athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 04:f0:21:30:37:de
> 
>       $ doas ifconfig trunk0 trunkport em0 trunkport athn0 lladdr random
> 
>       $ { ifconfig em0 ; ifconfig athn0 ; } | grep -e flags= -e lladdr
>       em0: 
> flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 88:c2:6a:b2:21:41
>       athn0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 
> 1500
>               lladdr 88:c2:6a:b2:21:41
> 
>       $ doas ifconfig trunk0 destroy
> 
>       $ { ifconfig em0 ; ifconfig athn0 ; } | grep -e flags= -e lladdr
>       em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 3c:97:0e:6e:e9:1b
>       athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>               lladdr 04:f0:21:30:37:de
> 
> 
> I also tested this with vether(4) ports under trunk just to check if
> there's anything different for pseudo interfaces, but they behave the
> same as em(4) and athn(4) for me regardless of `lladdr random' on trunk.
> 
> Am I missing anything?

I can't test at the moment, but the other case is removing a port from
the trunk without destroying the trunk interface itself. That's almost
certainly what I was testing at the time.

The other thing to be aware of is that you may then end up with two
separate interfaces with the same MAC. This may cause some problems for
incoming traffic now we don't use weak host model on non-router systems.
Not sure there is much we can do about that though.

Reply via email to