network: disable IPv4LL for ipvlan with L3 or L3S mode

As L3 or L3S mode do not support ARP.
This commit is contained in:
Yu Watanabe 2019-05-20 13:15:02 +09:00
parent 40921f0886
commit f410d46358
3 changed files with 27 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "conf-parser.h"
#include "netdev/ipvlan.h"
#include "networkd-link.h"
#include "string-table.h"
static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
@ -85,3 +86,18 @@ const NetDevVTable ipvtap_vtable = {
.fill_message_create = netdev_ipvlan_fill_message_create,
.create_type = NETDEV_CREATE_STACKED,
};
IPVlanMode link_get_ipvlan_mode(Link *link) {
NetDev *netdev;
if (!streq_ptr(link->kind, "ipvlan"))
return _NETDEV_IPVLAN_MODE_INVALID;
if (netdev_get(link->manager, link->ifname, &netdev) < 0)
return _NETDEV_IPVLAN_MODE_INVALID;
if (netdev->kind != NETDEV_KIND_IPVLAN)
return _NETDEV_IPVLAN_MODE_INVALID;
return IPVLAN(netdev)->mode;
}

View File

@ -42,3 +42,5 @@ IPVlanFlags ipvlan_flags_from_string(const char *d) _pure_;
CONFIG_PARSER_PROTOTYPE(config_parse_ipvlan_mode);
CONFIG_PARSER_PROTOTYPE(config_parse_ipvlan_flags);
IPVlanMode link_get_ipvlan_mode(Link *link);

View File

@ -14,6 +14,7 @@
#include "missing_network.h"
#include "netdev/bond.h"
#include "netdev/bridge.h"
#include "netdev/ipvlan.h"
#include "netdev/vrf.h"
#include "netlink-util.h"
#include "network-internal.h"
@ -124,6 +125,10 @@ bool link_ipv4ll_enabled(Link *link) {
if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "ip6gre", "ip6tnl", "sit", "vti", "vti6"))
return false;
/* L3 or L3S mode do not support ARP. */
if (IN_SET(link_get_ipvlan_mode(link), NETDEV_IPVLAN_MODE_L3, NETDEV_IPVLAN_MODE_L3S))
return false;
if (link->network->bond)
return false;
@ -142,6 +147,10 @@ bool link_ipv4ll_fallback_enabled(Link *link) {
if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "ip6gre", "ip6tnl", "sit", "vti", "vti6"))
return false;
/* L3 or L3S mode do not support ARP. */
if (IN_SET(link_get_ipvlan_mode(link), NETDEV_IPVLAN_MODE_L3, NETDEV_IPVLAN_MODE_L3S))
return false;
if (link->network->bond)
return false;