1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

Merge pull request #18380 from yuwata/test-network-ipv6-proxy-ndp

test-network: add tests for IPv6ProxyNDPAddress=
This commit is contained in:
Yu Watanabe 2021-01-27 10:47:36 +09:00 committed by GitHub
commit 37baf8db56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 2 deletions

View File

@ -18,7 +18,7 @@ static int set_ipv6_proxy_ndp_address_handler(sd_netlink *rtnl, sd_netlink_messa
assert(link); assert(link);
r = sd_netlink_message_get_errno(m); r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) if (r < 0)
log_link_message_warning_errno(link, m, r, "Could not add IPv6 proxy ndp address entry, ignoring"); log_link_message_warning_errno(link, m, r, "Could not add IPv6 proxy ndp address entry, ignoring");
return 1; return 1;
@ -38,7 +38,7 @@ static int ipv6_proxy_ndp_address_configure(Link *link, const struct in6_addr *a
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not create RTM_NEWNEIGH message: %m"); return log_link_error_errno(link, r, "Could not create RTM_NEWNEIGH message: %m");
r = sd_rtnl_message_neigh_set_flags(req, NLM_F_REQUEST | NTF_PROXY); r = sd_rtnl_message_neigh_set_flags(req, NTF_PROXY);
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Could not set neighbor flags: %m"); return log_link_error_errno(link, r, "Could not set neighbor flags: %m");

View File

@ -0,0 +1,24 @@
[Match]
Name=dummy98
[Network]
IPv6ProxyNDPAddress=2607:5300:203:5215:5::1
IPv6ProxyNDPAddress=2607:5300:203:5215:4::1
IPv6ProxyNDPAddress=2607:5300:203:5215:3::1
IPv6ProxyNDPAddress=2607:5300:203:5215:2::1
IPv6ProxyNDPAddress=2607:5300:203:5215:1::1
IPv6AcceptRA=no
IPForward=yes
Address=66.70.129.136/32
Address=66.70.129.142/32
Address=66.70.129.143/32
[Address]
Address=2607:5300:203:5215::1/64
[Route]
Destination=2607:5300:203:52ff:ff:ff:ff:ff
[Route]
Gateway=2607:5300:203:52ff:ff:ff:ff:ff
Destination=::/0

View File

@ -1764,6 +1764,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-gre-tunnel-remote-any.netdev', '25-gre-tunnel-remote-any.netdev',
'25-ip6gre-tunnel-remote-any.netdev', '25-ip6gre-tunnel-remote-any.netdev',
'25-ipv6-address-label-section.network', '25-ipv6-address-label-section.network',
'25-ipv6-proxy-ndp.network',
'25-link-local-addressing-no.network', '25-link-local-addressing-no.network',
'25-link-local-addressing-yes.network', '25-link-local-addressing-yes.network',
'25-link-section-unmanaged.network', '25-link-section-unmanaged.network',
@ -2489,6 +2490,17 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output) print(output)
self.assertRegex(output, '2004:da8:1::/64') self.assertRegex(output, '2004:da8:1::/64')
def test_ipv6_proxy_ndp(self):
copy_unit_to_networkd_unit_path('25-ipv6-proxy-ndp.network', '12-dummy.netdev')
start_networkd()
self.wait_online(['dummy98:routable'])
output = check_output('ip neighbor show proxy dev dummy98')
print(output)
for i in range(1,5):
self.assertRegex(output, f'2607:5300:203:5215:{i}::1 *proxy')
def test_neighbor_section(self): def test_neighbor_section(self):
copy_unit_to_networkd_unit_path('25-neighbor-section.network', '12-dummy.netdev') copy_unit_to_networkd_unit_path('25-neighbor-section.network', '12-dummy.netdev')
start_networkd() start_networkd()