Merge pull request #12066 from yuwata/fix-network-tunnel-12041

network: fix netdev_tunnel_verify()
This commit is contained in:
Yu Watanabe 2019-03-22 05:57:38 +09:00 committed by GitHub
commit 3f4c9bc04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 355 additions and 29 deletions

View File

@ -98,9 +98,7 @@
<entry>A Level 2 GRE tunnel over IPv4.</entry></row>
<row><entry><varname>erspan</varname></entry>
<entry>ERSPAN mirrors traffic on one or more source ports and delivers the mirrored traffic to one or more destination ports on another switch.
The traffic is encapsulated in generic routing encapsulation (GRE) and is therefore routable across a layer 3 network between the source switch
and the destination switch.</entry></row>
<entry>ERSPAN mirrors traffic on one or more source ports and delivers the mirrored traffic to one or more destination ports on another switch. The traffic is encapsulated in generic routing encapsulation (GRE) and is therefore routable across a layer 3 network between the source switch and the destination switch.</entry></row>
<row><entry><varname>ip6gre</varname></entry>
<entry>A Level 3 GRE tunnel over IPv6.</entry></row>
@ -874,14 +872,15 @@
<varlistentry>
<term><varname>Local=</varname></term>
<listitem>
<para>A static local address for tunneled packets. It must
be an address on another interface of this host.</para>
<para>A static local address for tunneled packets. It must be an address on another interface of
this host, or the special value <literal>any</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Remote=</varname></term>
<listitem>
<para>The remote endpoint of the tunnel.</para>
<para>The remote endpoint of the tunnel. Takes an IP address or the special value
<literal>any</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -437,15 +437,25 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
assert(t);
if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE, NETDEV_KIND_GRETAP, NETDEV_KIND_ERSPAN) &&
(t->family != AF_INET || in_addr_is_null(t->family, &t->local)))
if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE, NETDEV_KIND_GRETAP) &&
t->family != AF_INET)
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"vti/ipip/sit/gre/gretap/erspan tunnel without a local IPv4 address configured in %s. Ignoring", filename);
"vti/ipip/sit/gre tunnel without a local/remote IPv4 address configured in %s. Ignoring", filename);
if (IN_SET(netdev->kind, NETDEV_KIND_GRETAP, NETDEV_KIND_ERSPAN) &&
(t->family != AF_INET || in_addr_is_null(t->family, &t->remote)))
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"gretap/erspan tunnel without a remote IPv4 address configured in %s. Ignoring", filename);
if (IN_SET(netdev->kind, NETDEV_KIND_VTI6, NETDEV_KIND_IP6TNL, NETDEV_KIND_IP6GRE, NETDEV_KIND_IP6GRETAP) &&
(t->family != AF_INET6 || in_addr_is_null(t->family, &t->local)))
t->family != AF_INET6)
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"vti6/ip6tnl/ip6gre/ip6gretap tunnel without a local IPv6 address configured in %s. Ignoring", filename);
"vti6/ip6tnl/ip6gre tunnel without a local/remote IPv6 address configured in %s. Ignoring", filename);
if (netdev->kind == NETDEV_KIND_IP6GRETAP &&
(t->family != AF_INET6 || in_addr_is_null(t->family, &t->remote)))
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"ip6gretap tunnel without a remote IPv6 address configured in %s. Ignoring", filename);
if (netdev->kind == NETDEV_KIND_IP6TNL &&
t->ip6tnl_mode == _NETDEV_IP6_TNL_MODE_INVALID)

View File

@ -0,0 +1,11 @@
[NetDev]
Name=erspan98
Kind=erspan
[Tunnel]
Independent=true
ERSPANIndex=124
Local = any
Remote = 172.16.1.100
Key=102
SerializeTunneledPackets=true

View File

@ -1,5 +1,5 @@
[NetDev]
Name=erspan-test
Name=erspan99
Kind=erspan
[Tunnel]

View File

@ -0,0 +1,7 @@
[NetDev]
Name=gretun98
Kind=gre
[Tunnel]
Local=any
Remote=10.65.223.239

View File

@ -0,0 +1,7 @@
[NetDev]
Name=gretun97
Kind=gre
[Tunnel]
Local=10.65.223.238
Remote=any

View File

@ -0,0 +1,7 @@
[NetDev]
Name=gretap98
Kind=gretap
[Tunnel]
Local=any
Remote=10.65.223.239

View File

@ -0,0 +1,7 @@
[NetDev]
Name=ip6gretun98
Kind=ip6gre
[Tunnel]
Local=any
Remote=2001:473:fece:cafe::5179

View File

@ -0,0 +1,7 @@
[NetDev]
Name=ip6gretun97
Kind=ip6gre
[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=any

View File

@ -1,6 +1,6 @@
[NetDev]
Name=ip6gretap99
Kind=ip6gretap
Name=ip6gretun99
Kind=ip6gre
[Tunnel]
Local=2a00:ffde:4567:edde::4987

View File

@ -0,0 +1,7 @@
[NetDev]
Name=ip6gretap98
Kind=ip6gretap
[Tunnel]
Local=any
Remote=2001:473:fece:cafe::5179

View File

@ -0,0 +1,7 @@
[NetDev]
Name=ip6gretap99
Kind=ip6gretap
[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=2001:473:fece:cafe::5179

View File

@ -0,0 +1,8 @@
[NetDev]
Name=ip6tnl98
Kind=ip6tnl
[Tunnel]
Mode=ip6ip6
Local=any
Remote=2001:473:fece:cafe::5179

View File

@ -0,0 +1,8 @@
[NetDev]
Name=ip6tnl97
Kind=ip6tnl
[Tunnel]
Mode=ip6ip6
Local=2a00:ffde:4567:edde::4987
Remote=any

View File

@ -0,0 +1,8 @@
[NetDev]
Name=ipiptun98
Kind=ipip
MTUBytes=1480
[Tunnel]
Local=any
Remote=192.169.224.239

View File

@ -0,0 +1,8 @@
[NetDev]
Name=ipiptun97
Kind=ipip
MTUBytes=1480
[Tunnel]
Local=192.168.223.238
Remote=any

View File

@ -0,0 +1,7 @@
[NetDev]
Name=sittun98
Kind=sit
[Tunnel]
Local=any
Remote=10.65.223.239

View File

@ -0,0 +1,7 @@
[NetDev]
Name=sittun97
Kind=sit
[Tunnel]
Local=10.65.223.238
Remote=any

View File

@ -0,0 +1,7 @@
[NetDev]
Name=vtitun98
Kind=vti
[Tunnel]
Local=remote
Remote=10.65.223.239

View File

@ -0,0 +1,7 @@
[NetDev]
Name=vtitun97
Kind=vti
[Tunnel]
Local=10.65.223.238
Remote=any

View File

@ -0,0 +1,7 @@
[NetDev]
Name=vti6tun98
Kind=vti6
[Tunnel]
Local=any
Remote=2001:473:fece:cafe::5179

View File

@ -0,0 +1,7 @@
[NetDev]
Name=vti6tun97
Kind=vti6
[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=any

View File

@ -3,3 +3,4 @@ Name=dummy98
[Network]
Tunnel=gretap99
Tunnel=gretap98

View File

@ -3,3 +3,5 @@ Name=dummy98
[Network]
Tunnel=gretun99
Tunnel=gretun98
Tunnel=gretun97

View File

@ -3,3 +3,4 @@ Name=dummy98
[Network]
Tunnel=ip6gretap99
Tunnel=ip6gretap98

View File

@ -0,0 +1,7 @@
[Match]
Name=dummy98
[Network]
Tunnel=ip6gretun99
Tunnel=ip6gretun98
Tunnel=ip6gretun97

View File

@ -3,3 +3,5 @@ Name=dummy98
[Network]
Tunnel=ip6tnl99
Tunnel=ip6tnl98
Tunnel=ip6tnl97

View File

@ -3,3 +3,5 @@ Name=dummy98
[Network]
Tunnel=ipiptun99
Tunnel=ipiptun98
Tunnel=ipiptun97

View File

@ -3,3 +3,5 @@ Name=dummy98
[Network]
Tunnel=sittun99
Tunnel=sittun98
Tunnel=sittun97

View File

@ -3,3 +3,5 @@ Name=dummy98
[Network]
Tunnel=vtitun99
Tunnel=vtitun98
Tunnel=vtitun97

View File

@ -3,3 +3,5 @@ Name=dummy98
[Network]
Tunnel=vti6tun99
Tunnel=vti6tun98
Tunnel=vti6tun97

View File

@ -191,17 +191,31 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'bridge99',
'dropin-test',
'dummy98',
'erspan-test',
'erspan98',
'erspan99',
'geneve99',
'gretap98',
'gretap99',
'gretun97',
'gretun98',
'gretun99',
'ip6gretap98',
'ip6gretap99',
'ip6gretun97',
'ip6gretun98',
'ip6gretun99',
'ip6tnl97',
'ip6tnl98',
'ip6tnl99',
'ipiptun97',
'ipiptun98',
'ipiptun99',
'ipvlan99',
'isataptun99',
'macvlan99',
'macvtap99',
'sittun97',
'sittun98',
'sittun99',
'tap99',
'test1',
@ -210,7 +224,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'veth99',
'vlan99',
'vrf99',
'vti6tun97',
'vti6tun98',
'vti6tun99',
'vtitun97',
'vtitun98',
'vtitun99',
'vxlan99',
'wg98',
@ -229,23 +247,41 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'25-bond.netdev',
'25-bond-balanced-tlb.netdev',
'25-bridge.netdev',
'25-erspan-tunnel-local-any.netdev',
'25-erspan-tunnel.netdev',
'25-geneve.netdev',
'25-gretap-tunnel-local-any.netdev',
'25-gretap-tunnel.netdev',
'25-gre-tunnel-local-any.netdev',
'25-gre-tunnel-remote-any.netdev',
'25-gre-tunnel.netdev',
'25-ip6gretap-tunnel-local-any.netdev',
'25-ip6gretap-tunnel.netdev',
'25-ip6gre-tunnel-local-any.netdev',
'25-ip6gre-tunnel-remote-any.netdev',
'25-ip6gre-tunnel.netdev',
'25-ip6tnl-tunnel-remote-any.netdev',
'25-ip6tnl-tunnel-local-any.netdev',
'25-ip6tnl-tunnel.netdev',
'25-ipip-tunnel-independent.netdev',
'25-ipip-tunnel-local-any.netdev',
'25-ipip-tunnel-remote-any.netdev',
'25-ipip-tunnel.netdev',
'25-ipvlan.netdev',
'25-isatap-tunnel.netdev',
'25-sit-tunnel-local-any.netdev',
'25-sit-tunnel-remote-any.netdev',
'25-sit-tunnel.netdev',
'25-tap.netdev',
'25-tun.netdev',
'25-vcan.netdev',
'25-veth.netdev',
'25-vrf.netdev',
'25-vti6-tunnel-local-any.netdev',
'25-vti6-tunnel-remote-any.netdev',
'25-vti6-tunnel.netdev',
'25-vti-tunnel-local-any.netdev',
'25-vti-tunnel-remote-any.netdev',
'25-vti-tunnel.netdev',
'25-vxlan.netdev',
'25-wireguard-23-peers.netdev',
@ -257,6 +293,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'gretap.network',
'gretun.network',
'ip6gretap.network',
'ip6gretun.network',
'ip6tnl.network',
'ipip.network',
'ipvlan.network',
@ -495,60 +532,177 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertTrue(output, 'udp6zerocsumrx')
def test_ipip_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ipip-tunnel.netdev', 'ipip.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ipip-tunnel.netdev', 'ipip.network',
'25-ipip-tunnel-local-any.netdev', '25-ipip-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('ipiptun99'))
self.assertTrue(self.link_exits('ipiptun98'))
self.assertTrue(self.link_exits('ipiptun97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ipiptun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ipip (?:ipip |)remote 192.169.224.239 local 192.168.223.238 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ipiptun98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ipip (?:ipip |)remote 192.169.224.239 local any dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ipiptun97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ipip (?:ipip |)remote any local 192.168.223.238 dev dummy98')
def test_gre_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gre-tunnel.netdev', 'gretun.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gre-tunnel.netdev', 'gretun.network',
'25-gre-tunnel-local-any.netdev', '25-gre-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('gretun99'))
self.assertTrue(self.link_exits('gretun98'))
self.assertTrue(self.link_exits('gretun97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'gre remote 10.65.223.239 local 10.65.223.238 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretun98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'gre remote 10.65.223.239 local any dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretun97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'gre remote any local 10.65.223.238 dev dummy98')
def test_ip6gre_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gre-tunnel.netdev', 'ip6gretun.network',
'25-ip6gre-tunnel-local-any.netdev', '25-ip6gre-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('ip6gretun99'))
self.assertTrue(self.link_exits('ip6gretun98'))
self.assertTrue(self.link_exits('ip6gretun97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6gre remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretun98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6gre remote 2001:473:fece:cafe::5179 local any dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretun97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6gre remote any local 2a00:ffde:4567:edde::4987 dev dummy98')
def test_gretap_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gretap-tunnel.netdev', 'gretap.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gretap-tunnel.netdev', 'gretap.network',
'25-gretap-tunnel-local-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('gretap99'))
self.assertTrue(self.link_exits('gretap98'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretap99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'gretap remote 10.65.223.239 local 10.65.223.238 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretap98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'gretap remote 10.65.223.239 local any dev dummy98')
def test_ip6gretap_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gre-tunnel.netdev', 'ip6gretap.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gretap-tunnel.netdev', 'ip6gretap.network',
'25-ip6gretap-tunnel-local-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('ip6gretap99'))
self.assertTrue(self.link_exits('ip6gretap98'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretap99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6gretap remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretap98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6gretap remote 2001:473:fece:cafe::5179 local any dev dummy98')
def test_vti_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti-tunnel.netdev', 'vti.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti-tunnel.netdev', 'vti.network',
'25-vti-tunnel-local-any.netdev', '25-vti-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('vtitun99'))
self.assertTrue(self.link_exits('vtitun98'))
self.assertTrue(self.link_exits('vtitun97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vtitun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'vti remote 10.65.223.239 local 10.65.223.238 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vtitun98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'vti remote 10.65.223.239 local any dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vtitun97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'vti remote any local 10.65.223.238 dev dummy98')
def test_vti6_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti6-tunnel.netdev', 'vti6.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti6-tunnel.netdev', 'vti6.network',
'25-vti6-tunnel-local-any.netdev', '25-vti6-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('vti6tun99'))
self.assertTrue(self.link_exits('vti6tun98'))
self.assertTrue(self.link_exits('vti6tun97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vti6tun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'vti6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vti6tun98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'vti6 remote 2001:473:fece:cafe::5179 local (?:any|::) dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vti6tun97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'vti6 remote (?:any|::) local 2a00:ffde:4567:edde::4987 dev dummy98')
def test_ip6tnl_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6tnl-tunnel.netdev', 'ip6tnl.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6tnl-tunnel.netdev', 'ip6tnl.network',
'25-ip6tnl-tunnel-local-any.netdev', '25-ip6tnl-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('ip6tnl99'))
self.assertTrue(self.link_exits('ip6tnl98'))
self.assertTrue(self.link_exits('ip6tnl97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6tnl99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6tnl98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local (?:any|::) dev dummy98')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6tnl97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'ip6tnl ip6ip6 remote (?:any|::) local 2a00:ffde:4567:edde::4987 dev dummy98')
def test_sit_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-sit-tunnel.netdev', 'sit.network')
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-sit-tunnel.netdev', 'sit.network',
'25-sit-tunnel-local-any.netdev',
'25-sit-tunnel-remote-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('sittun99'))
self.assertTrue(self.link_exits('sittun98'))
self.assertTrue(self.link_exits('sittun97'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, "sit (?:ip6ip |)remote 10.65.223.239 local 10.65.223.238 dev dummy98")
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, "sit (?:ip6ip |)remote 10.65.223.239 local any dev dummy98")
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun97']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, "sit (?:ip6ip |)remote any local 10.65.223.238 dev dummy98")
def test_isatap_tunnel(self):
self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-isatap-tunnel.netdev', 'isatap.network')
@ -568,18 +722,26 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('sittun99'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, '6rd-prefix 2602::/24')
@expectedFailureIfERSPANModuleIsNotAvailable()
def test_erspan_tunnel(self):
self.copy_unit_to_networkd_unit_path('25-erspan-tunnel.netdev')
self.copy_unit_to_networkd_unit_path('25-erspan-tunnel.netdev', '25-erspan-tunnel-local-any.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('erspan-test'))
self.assertTrue(self.link_exits('erspan99'))
self.assertTrue(self.link_exits('erspan98'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'erspan-test']).rstrip().decode('utf-8')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'erspan99']).rstrip().decode('utf-8')
print(output)
self.assertTrue(output, '172.16.1.200')
self.assertTrue(output, '172.16.1.100')
self.assertTrue(output, '101')
self.assertRegex(output, 'erspan remote 172.16.1.100 local 172.16.1.200')
self.assertRegex(output, '101')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'erspan98']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'erspan remote 172.16.1.100 local any')
self.assertRegex(output, '102')
def test_tunnel_independent(self):
self.copy_unit_to_networkd_unit_path('25-ipip-tunnel-independent.netdev')