]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: move MulticastRouter to netdev/bridge.[ch] 12516/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2019 15:02:58 +0000 (00:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2019 21:24:04 +0000 (06:24 +0900)
src/network/netdev/bridge.c
src/network/netdev/bridge.h
src/network/networkd-network.c
src/network/networkd-network.h

index 54390cad0e25c194ff32b571a9160c8570152f1b..f20130d26441f813496561e611d0ad52ed4703c5 100644 (file)
@@ -7,8 +7,20 @@
 #include "netdev/bridge.h"
 #include "network-internal.h"
 #include "networkd-manager.h"
+#include "string-table.h"
 #include "vlan-util.h"
 
+static const char* const multicast_router_table[_MULTICAST_ROUTER_MAX] = {
+        [MULTICAST_ROUTER_NONE] = "no",
+        [MULTICAST_ROUTER_TEMPORARY_QUERY] = "query",
+        [MULTICAST_ROUTER_PERMANENT] = "permanent",
+        [MULTICAST_ROUTER_TEMPORARY] = "temporary",
+};
+
+DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(multicast_router, MulticastRouter, _MULTICAST_ROUTER_INVALID);
+DEFINE_CONFIG_PARSE_ENUM(config_parse_multicast_router, multicast_router, MulticastRouter,
+                         "Failed to parse bridge multicast router setting");
+
 /* callback for bridge netdev's parameter set */
 static int netdev_bridge_set_handler(sd_netlink *rtnl, sd_netlink_message *m, NetDev *netdev) {
         int r;
index b03084790ad0268c4a2ee269dc3e8201a9db7c65..2954155c373928a382fb9c3c6b4d685cc33d9993 100644 (file)
@@ -1,7 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
-#include "netdev/netdev.h"
+#include <netinet/in.h>
+#include <linux/if_bridge.h>
+
+#include "conf-parser.h"
+#include "netdev.h"
 
 typedef struct Bridge {
         NetDev meta;
@@ -20,7 +24,21 @@ typedef struct Bridge {
         usec_t ageing_time;
 } Bridge;
 
+typedef enum MulticastRouter {
+        MULTICAST_ROUTER_NONE            = MDB_RTR_TYPE_DISABLED,
+        MULTICAST_ROUTER_TEMPORARY_QUERY = MDB_RTR_TYPE_TEMP_QUERY,
+        MULTICAST_ROUTER_PERMANENT       = MDB_RTR_TYPE_PERM,
+        MULTICAST_ROUTER_TEMPORARY       = MDB_RTR_TYPE_TEMP,
+        _MULTICAST_ROUTER_MAX,
+        _MULTICAST_ROUTER_INVALID = -1,
+} MulticastRouter;
+
 DEFINE_NETDEV_CAST(BRIDGE, Bridge);
 extern const NetDevVTable bridge_vtable;
 
 int link_set_bridge(Link *link);
+
+const char* multicast_router_to_string(MulticastRouter i) _const_;
+MulticastRouter multicast_router_from_string(const char *s) _pure_;
+
+CONFIG_PARSER_PROTOTYPE(config_parse_multicast_router);
index 7bce68d7a934c48ebcdfc6228fa6d68ce08a8e93..56a45379c164936a4c8c6c6e205c0e1c256b9476 100644 (file)
@@ -1779,14 +1779,3 @@ int config_parse_required_for_online(
 
         return 0;
 }
-
-static const char* const multicast_router_table[_MULTICAST_ROUTER_MAX] = {
-        [MULTICAST_ROUTER_NONE] = "no",
-        [MULTICAST_ROUTER_TEMPORARY_QUERY] = "query",
-        [MULTICAST_ROUTER_PERMANENT] = "permanent",
-        [MULTICAST_ROUTER_TEMPORARY] = "temporary",
-};
-
-DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(multicast_router, MulticastRouter, _MULTICAST_ROUTER_INVALID);
-DEFINE_CONFIG_PARSE_ENUM(config_parse_multicast_router, multicast_router, MulticastRouter,
-                         "Failed to parse bridge multicast router setting");
index 8b6887a755cc8c91b83824a70e6aad9c89afea35..9217e838d2a124cc732fdd8203cb2610a99f452a 100644 (file)
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
-#include <netinet/in.h>
-#include <linux/if_bridge.h>
-
 #include "sd-bus.h"
 #include "sd-device.h"
 
@@ -11,6 +8,7 @@
 #include "conf-parser.h"
 #include "dhcp-identifier.h"
 #include "hashmap.h"
+#include "netdev/bridge.h"
 #include "netdev/netdev.h"
 #include "networkd-address-label.h"
 #include "networkd-address.h"
@@ -80,15 +78,6 @@ typedef enum RADVPrefixDelegation {
         _RADV_PREFIX_DELEGATION_INVALID = -1,
 } RADVPrefixDelegation;
 
-typedef enum MulticastRouter {
-        MULTICAST_ROUTER_NONE            = MDB_RTR_TYPE_DISABLED,
-        MULTICAST_ROUTER_TEMPORARY_QUERY = MDB_RTR_TYPE_TEMP_QUERY,
-        MULTICAST_ROUTER_PERMANENT       = MDB_RTR_TYPE_PERM,
-        MULTICAST_ROUTER_TEMPORARY       = MDB_RTR_TYPE_TEMP,
-        _MULTICAST_ROUTER_MAX,
-        _MULTICAST_ROUTER_INVALID = -1,
-} MulticastRouter;
-
 typedef struct Manager Manager;
 
 struct Network {
@@ -326,7 +315,6 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ntp);
 CONFIG_PARSER_PROTOTYPE(config_parse_iaid);
 CONFIG_PARSER_PROTOTYPE(config_parse_required_for_online);
 CONFIG_PARSER_PROTOTYPE(config_parse_dhcp_max_attempts);
-CONFIG_PARSER_PROTOTYPE(config_parse_multicast_router);
 /* Legacy IPv4LL support */
 CONFIG_PARSER_PROTOTYPE(config_parse_ipv4ll);
 
@@ -345,6 +333,3 @@ DHCPUseDomains dhcp_use_domains_from_string(const char *s) _pure_;
 
 const char* radv_prefix_delegation_to_string(RADVPrefixDelegation i) _const_;
 RADVPrefixDelegation radv_prefix_delegation_from_string(const char *s) _pure_;
-
-const char* multicast_router_to_string(MulticastRouter i) _const_;
-MulticastRouter multicast_router_from_string(const char *s) _pure_;