]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: disable IPv4LL for ipvlan with L3 or L3S mode
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 May 2019 04:15:02 +0000 (13:15 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 May 2019 08:58:46 +0000 (17:58 +0900)
As L3 or L3S mode do not support ARP.

src/network/netdev/ipvlan.c
src/network/netdev/ipvlan.h
src/network/networkd-link.c

index 7b2517676729ff4bf4b6b30bcda51689e0ba86fa..f48cb0231ad05f9dafc261e0838e90dd6007b6af 100644 (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;
+}
index 140cacf4fcbdfda2bedadac1fc4a2921b60caa86..3bad56d500cf518f8043db8b663b20354a49b4dd 100644 (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);
index ac123ddc1ebe9fc34499e6bc51fc7fc1b33460c1..bf8afc84cdbd7d0e2bb7d66f0cff21a664c93599 100644 (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;