Skip to content
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

netdog: Add BindCarrier to bond network files #3426

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sources/api/netdog/src/networkd/config/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ struct NetworkSection {
vlan: Vec<InterfaceName>,
#[systemd(entry = "KeepConfiguration")]
keep_configuration: Option<KeepConfiguration>,
#[systemd(entry = "BindCarrier")]
bind_carrier: Vec<InterfaceName>,
}

#[derive(Debug, Default, SystemdUnitSection)]
Expand Down Expand Up @@ -377,6 +379,11 @@ impl NetworkBuilder<Bond> {
spooky: PhantomData,
}
}

/// Bind workers to bond for carrier detection
pub(crate) fn with_bind_carrier(&mut self, interfaces: Vec<InterfaceName>) {
self.network.network_mut().bind_carrier = interfaces;
}
}

impl NetworkBuilder<BondWorker> {
Expand Down Expand Up @@ -697,6 +704,7 @@ mod tests {
if let Some(r) = bond.routes {
network.with_routes(r)
}
network.with_bind_carrier(bond.interfaces);
network.build()
}

Expand Down
2 changes: 2 additions & 0 deletions sources/api/netdog/src/networkd/devices/bond.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ impl NetworkFileCreator for NetworkDBond {
maybe_add_some!(network, with_static_config, static6);
maybe_add_some!(network, with_routes, routes);

network.with_bind_carrier(interfaces.clone());

// Attach VLANs to this interface, if any
if let Some(vlans) = vlans.get(name) {
network.with_vlans(vlans.to_vec())
Expand Down
3 changes: 3 additions & 0 deletions sources/api/netdog/test_data/networkd/network/bond0.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ RequiredForOnline=true
[Network]
ConfigureWithoutCarrier=true
DHCP=ipv4
KeepConfiguration=dhcp
BindCarrier=eno51
BindCarrier=eno52
[DHCPv4]
UseMTU=true
3 changes: 3 additions & 0 deletions sources/api/netdog/test_data/networkd/network/bond1.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ RequiredForOnline=true
[Network]
ConfigureWithoutCarrier=true
DHCP=ipv4
KeepConfiguration=dhcp
BindCarrier=eno53
BindCarrier=eno54
[DHCPv4]
UseMTU=true
4 changes: 4 additions & 0 deletions sources/api/netdog/test_data/networkd/network/bond2.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ RequiredForOnline=true
[Network]
ConfigureWithoutCarrier=true
DHCP=ipv6
KeepConfiguration=dhcp
BindCarrier=eno55
BindCarrier=eno56
BindCarrier=eno57
[IPv6AcceptRA]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=true
[Network]
DHCP=ipv4
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[DHCPv6]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno1.network
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ Name=eno1
RequiredForOnline=true
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=false
[Network]
DHCP=ipv6
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv6]
WithoutRA=solicit
[IPv6AcceptRA]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ Name=eno10
RequiredForOnline=false
[Network]
DHCP=ipv6
KeepConfiguration=dhcp
[IPv6AcceptRA]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ RequiredForOnline=true
[Network]
DHCP=ipv4
VLAN=vlancfgdev
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ RequiredForOnline=true
Address=10.0.0.10/24
Address=11.0.0.11/24
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ RequiredForOnline=true
Address=3001:f00f:f00f::2/64
Address=3001:f00f:f00f::3/64
DHCP=ipv6
KeepConfiguration=dhcp
[IPv6AcceptRA]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=true
[Network]
DHCP=ipv6
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv6]
WithoutRA=solicit
[IPv6AcceptRA]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno2.network
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ Name=eno2
RequiredForOnline=true
[Network]
DHCP=ipv6
KeepConfiguration=dhcp
[IPv6AcceptRA]
UseMTU=true
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno3.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ RequiredForOnline=true
RequiredFamilyForOnline=ipv4
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno4.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ RequiredForOnline=true
RequiredFamilyForOnline=ipv6
[Network]
DHCP=ipv6
KeepConfiguration=dhcp
[IPv6AcceptRA]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RequiredFamilyForOnline=both
[Network]
DHCP=yes
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[DHCPv6]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno5.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=true
RequiredFamilyForOnline=both
[Network]
DHCP=yes
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[IPv6AcceptRA]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno6.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=true
RequiredFamilyForOnline=ipv4
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
RouteMetric=100
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RequiredFamilyForOnline=ipv4
[Network]
DHCP=yes
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[DHCPv6]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno7.network
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=true
RequiredFamilyForOnline=ipv4
[Network]
DHCP=yes
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[IPv6AcceptRA]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=false
[Network]
DHCP=yes
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[DHCPv6]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno8.network
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Name=eno8
RequiredForOnline=false
[Network]
DHCP=yes
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[IPv6AcceptRA]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RequiredForOnline=false
[Network]
DHCP=ipv4
IPv6AcceptRA=true
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
[DHCPv6]
Expand Down
1 change: 1 addition & 0 deletions sources/api/netdog/test_data/networkd/network/eno9.network
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ Name=eno9
RequiredForOnline=false
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ PermanentMACAddress=f8:74:a4:d5:32:64
RequiredForOnline=true
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ PermanentMACAddress=f8:74:a4:d5:32:65
RequiredForOnline=true
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ PermanentMACAddress=f8:74:a4:d5:32:66
RequiredForOnline=true
[Network]
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ RequiredForOnline=true
[Network]
ConfigureWithoutCarrier=true
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ RequiredForOnline=true
[Network]
ConfigureWithoutCarrier=true
DHCP=ipv4
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true