-
Notifications
You must be signed in to change notification settings - Fork 3k
bridge: allow IP addresses on members to be disabled #1641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -703,6 +703,82 @@ | |
vnet_cleanup | ||
} | ||
|
||
atf_test_case "member_ifaddrs_enabled" "cleanup" | ||
member_ifaddrs_enabled_head() | ||
{ | ||
atf_set descr 'bridge with member_ifaddrs=1' | ||
atf_set require.user root | ||
} | ||
|
||
member_ifaddrs_enabled_body() | ||
{ | ||
vnet_init | ||
vnet_init_bridge | ||
|
||
ep=$(vnet_mkepair) | ||
ifconfig ${ep}a inet 192.0.2.1/24 up | ||
|
||
vnet_mkjail one ${ep}b | ||
jexec one sysctl net.link.bridge.member_ifaddrs=1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I approve of setting the sysctl explicitly, despise '1' being default, because now the test will pass even when we change the default. |
||
jexec one ifconfig ${ep}b inet 192.0.2.2/24 up | ||
jexec one ifconfig bridge0 create addm ${ep}b | ||
|
||
atf_check -s exit:0 -o ignore ping -c3 -t1 192.0.2.2 | ||
} | ||
|
||
member_ifaddrs_enabled_cleanup() | ||
{ | ||
vnet_cleanup | ||
} | ||
|
||
atf_test_case "member_ifaddrs_disabled" "cleanup" | ||
member_ifaddrs_disabled_head() | ||
{ | ||
atf_set descr 'bridge with member_ifaddrs=0' | ||
atf_set require.user root | ||
} | ||
|
||
member_ifaddrs_disabled_body() | ||
{ | ||
vnet_init | ||
vnet_init_bridge | ||
|
||
vnet_mkjail one | ||
jexec one sysctl net.link.bridge.member_ifaddrs=0 | ||
|
||
bridge=$(jexec one ifconfig bridge create) | ||
|
||
# adding an interface with an IPv4 address | ||
ep=$(jexec one ifconfig epair create) | ||
jexec one ifconfig ${ep} 192.0.2.1/32 | ||
atf_check -s exit:1 -e ignore jexec one ifconfig ${bridge} addm ${ep} | ||
|
||
# adding an interface with an IPv6 address | ||
ep=$(jexec one ifconfig epair create) | ||
jexec one ifconfig ${ep} inet6 2001:db8::1/128 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens with an interface that only has a link-local IPv6 address? I'd assume that also fails to be added, but it might be worth extending the test case to cover that scenario too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it fails to be added. this causes a bit of a negative UX experience in one case where you create an interface, add an IPv6 GUA, remove the GUA, and the LLA is still there so you can't put it in a bridge. i wonder if it's worth having ifconfig check for this to print a better warning. i didn't want to have bridge(4) itself remove the addresses automatically because i think this will silently break existing setups. either way i'll add a test for this though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed with not doing so automatically. Getting ifconfig to print a useful warning (e.g. "Cannot add interfaces that have an IP(v6) address") would be nice too, but doesn't have to be done with this commit. |
||
atf_check -s exit:1 -e ignore jexec one ifconfig ${bridge} addm ${ep} | ||
|
||
# adding an interface with an IPv6 link-local address | ||
ep=$(jexec one ifconfig epair create) | ||
jexec one ifconfig ${ep} inet6 -ifdisabled auto_linklocal up | ||
atf_check -s exit:1 -e ignore jexec one ifconfig ${bridge} addm ${ep} | ||
|
||
# adding an IPv4 address to a member | ||
ep=$(jexec one ifconfig epair create) | ||
jexec one ifconfig ${bridge} addm ${ep} | ||
atf_check -s exit:1 -e ignore jexec one ifconfig ${ep} inet 192.0.2.2/32 | ||
|
||
# adding an IPv6 address to a member | ||
ep=$(jexec one ifconfig epair create) | ||
jexec one ifconfig ${bridge} addm ${ep} | ||
atf_check -s exit:1 -e ignore jexec one ifconfig ${ep} inet6 2001:db8::1/128 | ||
} | ||
|
||
member_ifaddrs_disabled_cleanup() | ||
{ | ||
vnet_cleanup | ||
} | ||
|
||
atf_init_test_cases() | ||
{ | ||
atf_add_test_case "bridge_transmit_ipv4_unicast" | ||
|
@@ -718,4 +794,6 @@ | |
atf_add_test_case "mtu" | ||
atf_add_test_case "vlan" | ||
atf_add_test_case "many_bridge_members" | ||
atf_add_test_case "member_ifaddrs_enabled" | ||
atf_add_test_case "member_ifaddrs_disabled" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tempted to say we should immediately announce this will be default in 16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my preference is to make this the default in 15 and remove it in 16. since i posted this, i met another user on IRC who was running into a strange problem caused by assigning an IP address to a member. it just doesn't work properly and we should remove it rather than fixing it.
this might be a bit too aggressive though, so i'm okay with making it the default in 16 and removing it in 17.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not opposed to that plan either. Let's get this landed and start a thread on freebsd-net@ to discuss it.