Page MenuHomeFreeBSD

bridge: check allow_llz_overlap before member_ifaddrs
ClosedPublic

Authored by ivy on Thu, May 22, 9:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 6, 4:09 AM
Unknown Object (File)
Thu, Jun 5, 12:05 AM
Unknown Object (File)
Sat, May 31, 4:40 PM
Unknown Object (File)
Sat, May 24, 3:40 PM
Unknown Object (File)
Sat, May 24, 1:00 PM
Unknown Object (File)
Sat, May 24, 11:12 AM
Unknown Object (File)
Sat, May 24, 8:36 AM
Unknown Object (File)
Sat, May 24, 12:56 AM

Details

Summary

When adding a new interface to a bridge and allow_llz_overlap=0, which
is the default value, if_bridge checks if the interface has IPv6 link
local addresses assigned, and if it does, it calls in6_ifdetach() to
remove all IPv6 addresses from the interface.

This means it was possible to do this:

% ifconfig bridge1 create inet6 -ifdisabled auto_linklocal up
% ifconfig epair20 create inet6 -ifdisabled auto_linklocal up
% ifconfig bridge1 addm epair20a

... with the result that the link-local address on epair20a would be
removed, then the interface would be added to the bridge.

If member_ifaddrs=0, which is also the default value, this no longer
works:

% ifconfig bridge1 addm epair20a
ifconfig: BRDGADD epair20a: Invalid argument

This is because the member_ifaddrs check runs before allow_llz_overlap
does its thing, and returns EINVAL since the new interface has IP
addresses on it.

To restore the previous behaviour, reverse the order of these two
checks, so the IPv6 addresses are removed before we check whether
the interface has IPv6 addresses.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable