network: ignore requested ipv6 fdb entry when ipv6 is disabled by sysctl
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 11 Jun 2019 14:33:22 +0000 (23:33 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 12 Jun 2019 02:04:06 +0000 (11:04 +0900)
src/network/networkd-fdb.c

index 4ae511f..4cacc44 100644 (file)
@@ -124,6 +124,11 @@ int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
         assert(link->manager);
         assert(fdb_entry);
 
+        if (fdb_entry->family == AF_INET6 && manager_sysctl_ipv6_enabled(link->manager) == 0) {
+                log_link_warning(link, "An IPv6 fdb entry is requested, but IPv6 is disabled by sysctl, ignoring.");
+                return 0;
+        }
+
         /* create new RTM message */
         r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_NEWNEIGH, link->ifindex, PF_BRIDGE);
         if (r < 0)
@@ -169,7 +174,7 @@ int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
 
         link_ref(link);
 
-        return 0;
+        return 1;
 }
 
 /* remove and FDB entry. */