network: default LinkLocalAddresssing= to no for link stacked with a passthru mode MACVLAN/MACVTAP
For similar reason to the case of a bridge slave: we don't want any IP configuration for it.
This commit is contained in:
@@ -427,7 +427,8 @@
|
||||
has been unsuccessful for some time. (IPv4 link-local address autoconfiguration will usually
|
||||
happen in parallel with repeated attempts to acquire a DHCPv4 lease).</para>
|
||||
|
||||
<para>Defaults to <option>no</option> when <varname>Bridge=yes</varname> is set, and
|
||||
<para>Defaults to <option>no</option> when <varname>Bridge=</varname> is set or when the specified
|
||||
<varname>MACVLAN=</varname>/<varname>MACVTAP=</varname> has <varname>Mode=passthru</varname>, or
|
||||
<option>ipv6</option> otherwise.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "hostname-util.h"
|
||||
#include "in-addr-util.h"
|
||||
#include "net-condition.h"
|
||||
#include "netdev/macvlan.h"
|
||||
#include "networkd-address-label.h"
|
||||
#include "networkd-address.h"
|
||||
#include "networkd-bridge-fdb.h"
|
||||
@@ -170,8 +171,33 @@ int network_verify(Network *network) {
|
||||
network->routes_by_section = hashmap_free_with_destructor(network->routes_by_section, route_free);
|
||||
}
|
||||
|
||||
if (network->link_local < 0)
|
||||
network->link_local = network->bridge ? ADDRESS_FAMILY_NO : ADDRESS_FAMILY_IPV6;
|
||||
if (network->link_local < 0) {
|
||||
network->link_local = ADDRESS_FAMILY_IPV6;
|
||||
|
||||
if (network->bridge)
|
||||
network->link_local = ADDRESS_FAMILY_NO;
|
||||
else {
|
||||
NetDev *netdev;
|
||||
|
||||
HASHMAP_FOREACH(netdev, network->stacked_netdevs) {
|
||||
MacVlan *m;
|
||||
|
||||
if (netdev->kind == NETDEV_KIND_MACVLAN)
|
||||
m = MACVLAN(netdev);
|
||||
else if (netdev->kind == NETDEV_KIND_MACVTAP)
|
||||
m = MACVTAP(netdev);
|
||||
else
|
||||
continue;
|
||||
|
||||
if (m->mode == NETDEV_MACVLAN_MODE_PASSTHRU)
|
||||
network->link_local = ADDRESS_FAMILY_NO;
|
||||
|
||||
/* There won't be a passthru MACVLAN/MACVTAP if there's already one in another mode */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (network->ipv6ll_address_gen_mode == IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_NONE)
|
||||
SET_FLAG(network->link_local, ADDRESS_FAMILY_IPV6, false);
|
||||
|
||||
|
||||
@@ -1155,7 +1155,8 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
f.write('[MACVTAP]\nMode=' + mode)
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['macvtap99:degraded', 'test1:degraded'])
|
||||
self.wait_online(['macvtap99:degraded',
|
||||
'test1:carrier' if mode == 'passthru' else 'test1:degraded'])
|
||||
|
||||
output = check_output('ip -d link show macvtap99')
|
||||
print(output)
|
||||
@@ -1172,7 +1173,8 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
f.write('[MACVLAN]\nMode=' + mode)
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['macvlan99:degraded', 'test1:degraded'])
|
||||
self.wait_online(['macvlan99:degraded',
|
||||
'test1:carrier' if mode == 'passthru' else 'test1:degraded'])
|
||||
|
||||
output = check_output('ip -d link show test1')
|
||||
print(output)
|
||||
@@ -1191,7 +1193,8 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertEqual(rc, 0)
|
||||
time.sleep(1)
|
||||
|
||||
self.wait_online(['macvlan99:degraded', 'test1:degraded'])
|
||||
self.wait_online(['macvlan99:degraded',
|
||||
'test1:carrier' if mode == 'passthru' else 'test1:degraded'])
|
||||
|
||||
output = check_output('ip -d link show test1')
|
||||
print(output)
|
||||
|
||||
Reference in New Issue
Block a user