network: move MulticastRouter to netdev/bridge.[ch]

This commit is contained in:
Yu Watanabe
2019-05-11 06:24:04 +09:00
parent 86e2be7bc3
commit 8e2cb51ce0
4 changed files with 32 additions and 28 deletions
+12
View 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;
+19 -1
View 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);
-11
View 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");
+1 -16
View 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_;