networkd: Static neighbor support

When using networkd we currently have no way of ensuring that static
neighbor entries are set when our link comes up. This change adds a new
section to the network definition that allows multiple static neighbors
to be set on a link.
This commit is contained in:
William A. Kennington III
2018-12-09 16:56:37 -08:00
parent 289e6774d0
commit e4a71bf36f
13 changed files with 381 additions and 0 deletions
@@ -0,0 +1,6 @@
[Match]
Name=dummy98
[Neighbor]
Address=2004:da8:1:0::
MACAddress=00:00:5e:00:02:00
@@ -165,6 +165,9 @@ EmitDNS=
EmitDomains=
Managed=
OtherInformation=
[Neighbor]
Address=
MacAddress=
[IPv6AddressLabel]
Label=
Prefix=
@@ -0,0 +1,10 @@
[Match]
Name=dummy98
[Neighbor]
Address=192.168.10.1
MACAddress=00:00:5e:00:02:65
[Neighbor]
Address=2004:da8:1:0::1
MACAddress=00:00:5e:00:02:66
@@ -525,6 +525,7 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
'25-fibrule-invert.network',
'25-fibrule-port-range.network',
'25-ipv6-address-label-section.network',
'25-neighbor-section.network',
'25-link-section-unmanaged.network',
'25-route-gateway.network',
'25-route-gateway-on-link.network',
@@ -775,6 +776,17 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, '2004:da8:1::/64')
def test_ipv6_neighbor(self):
self.copy_unit_to_networkd_unit_path('25-neighbor-section.network', '12-dummy.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
output = subprocess.check_output(['ip', 'neigh', 'list']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, '192.168.10.1.*00:00:5e:00:02:65.*PERMANENT')
self.assertRegex(output, '2004:da8:1:0::1.*00:00:5e:00:02:66.*PERMANENT')
def test_sysctl(self):
self.copy_unit_to_networkd_unit_path('25-sysctl.network', '12-dummy.netdev')
self.start_networkd()