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);