]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: introduce network_adjust_ipv6_proxy_ndp()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 May 2021 04:59:49 +0000 (13:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Jun 2021 21:33:27 +0000 (06:33 +0900)
src/network/networkd-ipv6-proxy-ndp.c
src/network/networkd-ipv6-proxy-ndp.h
src/network/networkd-network.c

index 57b3fb0118c72918667a81a8cf0d941b03a49ffb..897447a20cdb4f08a930c174a3f1612b358e5dfc 100644 (file)
 #include "string-util.h"
 #include "sysctl-util.h"
 
+void network_adjust_ipv6_proxy_ndp(Network *network) {
+        assert(network);
+
+        if (set_isempty(network->ipv6_proxy_ndp_addresses))
+                return;
+
+        if (!socket_ipv6_is_supported()) {
+                log_once(LOG_WARNING,
+                         "%s: IPv6 proxy NDP addresses are set, but IPv6 is not supported by kernel, "
+                         "Ignoring IPv6 proxy NDP addresses.", network->filename);
+                network->ipv6_proxy_ndp_addresses = set_free_free(network->ipv6_proxy_ndp_addresses);
+        }
+}
+
 static int set_ipv6_proxy_ndp_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
         int r;
 
index 27313efa0c8d48a80c4850f2ab26d75da877d334..546137fdacadad7935b6ee34fa9221ef75c9af99 100644 (file)
@@ -4,6 +4,9 @@
 #include "conf-parser.h"
 
 typedef struct Link Link;
+typedef struct Network Network;
+
+void network_adjust_ipv6_proxy_ndp(Network *network);
 
 int link_set_ipv6_proxy_ndp_addresses(Link *link);
 
index 4edccee014108200d063e0f04fb53b294b4adb8b..9cb6551d8ae97111ab07c227b2f81c7a898f2932 100644 (file)
@@ -20,6 +20,7 @@
 #include "networkd-dhcp-common.h"
 #include "networkd-dhcp-server-static-lease.h"
 #include "networkd-dhcp-server.h"
+#include "networkd-ipv6-proxy-ndp.h"
 #include "networkd-manager.h"
 #include "networkd-ndisc.h"
 #include "networkd-neighbor.h"
@@ -177,6 +178,7 @@ int network_verify(Network *network) {
         /* IPMasquerade implies IPForward */
         network->ip_forward |= network->ip_masquerade;
 
+        network_adjust_ipv6_proxy_ndp(network);
         network_adjust_ipv6_accept_ra(network);
         network_adjust_dhcp(network);
         network_adjust_radv(network);