summaryrefslogtreecommitdiff
path: root/bridge.c
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-05-14 15:20:28 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-05-18 12:33:00 +0200
commit7277764bf8173d6961acbacfe31757c9195329e1 (patch)
treed5bb670d37b92553a17443643f73e633e789ef29 /bridge.c
parent87e469be0c08db92b0fb0f4817cc177c158cdf42 (diff)
downloadnetifd-7277764bf8173d6961acbacfe31757c9195329e1.tar.gz
bridge: rename "ifname" attribute to "ports"
Bridge aggregates multiple ports so use a more accurate name ("ports"). For backward compatibility add a temporary config translation. Config example: config interface 'lan' option type 'bridge' list ports 'lan1' list ports 'lan2' Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'bridge.c')
-rw-r--r--bridge.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/bridge.c b/bridge.c
index 397ac97..4db6e15 100644
--- a/bridge.c
+++ b/bridge.c
@@ -23,7 +23,7 @@
#include "system.h"
enum {
- BRIDGE_ATTR_IFNAME,
+ BRIDGE_ATTR_PORTS,
BRIDGE_ATTR_STP,
BRIDGE_ATTR_FORWARD_DELAY,
BRIDGE_ATTR_PRIORITY,
@@ -44,7 +44,7 @@ enum {
};
static const struct blobmsg_policy bridge_attrs[__BRIDGE_ATTR_MAX] = {
- [BRIDGE_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_ARRAY },
+ [BRIDGE_ATTR_PORTS] = { "ports", BLOBMSG_TYPE_ARRAY },
[BRIDGE_ATTR_STP] = { "stp", BLOBMSG_TYPE_BOOL },
[BRIDGE_ATTR_FORWARD_DELAY] = { "forward_delay", BLOBMSG_TYPE_INT32 },
[BRIDGE_ATTR_PRIORITY] = { "priority", BLOBMSG_TYPE_INT32 },
@@ -64,7 +64,7 @@ static const struct blobmsg_policy bridge_attrs[__BRIDGE_ATTR_MAX] = {
};
static const struct uci_blob_param_info bridge_attr_info[__BRIDGE_ATTR_MAX] = {
- [BRIDGE_ATTR_IFNAME] = { .type = BLOBMSG_TYPE_STRING },
+ [BRIDGE_ATTR_PORTS] = { .type = BLOBMSG_TYPE_STRING },
};
static const struct uci_blob_param_list bridge_attr_list = {
@@ -104,7 +104,7 @@ struct bridge_state {
struct blob_attr *config_data;
struct bridge_config config;
- struct blob_attr *ifnames;
+ struct blob_attr *ports;
bool active;
bool force_active;
bool has_vlans;
@@ -877,8 +877,8 @@ bridge_config_init(struct device *dev)
bst->n_failed = 0;
vlist_update(&bst->members);
- if (bst->ifnames) {
- blobmsg_for_each_attr(cur, bst->ifnames, rem) {
+ if (bst->ports) {
+ blobmsg_for_each_attr(cur, bst->ports, rem) {
bridge_add_member(bst, blobmsg_data(cur));
}
}
@@ -994,7 +994,7 @@ bridge_reload(struct device *dev, struct blob_attr *attr)
if (tb_dev[DEV_ATTR_MACADDR])
bst->primary_port = NULL;
- bst->ifnames = tb_br[BRIDGE_ATTR_IFNAME];
+ bst->ports = tb_br[BRIDGE_ATTR_PORTS];
device_init_settings(dev, tb_dev);
bridge_apply_settings(bst, tb_br);
@@ -1015,7 +1015,7 @@ bridge_reload(struct device *dev, struct blob_attr *attr)
diff = 0;
uci_blob_diff(tb_br, otb_br, &bridge_attr_list, &diff);
- if (diff & ~(1 << BRIDGE_ATTR_IFNAME))
+ if (diff & ~(1 << BRIDGE_ATTR_PORTS))
ret = DEV_CONFIG_RESTART;
bridge_config_init(dev);