summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridge.c7
-rw-r--r--system-linux.c6
-rw-r--r--system.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/bridge.c b/bridge.c
index 1d02f83..83c9d79 100644
--- a/bridge.c
+++ b/bridge.c
@@ -26,6 +26,7 @@ enum {
BRIDGE_ATTR_IFNAME,
BRIDGE_ATTR_STP,
BRIDGE_ATTR_FORWARD_DELAY,
+ BRIDGE_ATTR_PRIORITY,
BRIDGE_ATTR_IGMP_SNOOP,
BRIDGE_ATTR_AGEING_TIME,
BRIDGE_ATTR_HELLO_TIME,
@@ -37,6 +38,7 @@ static const struct blobmsg_policy bridge_attrs[__BRIDGE_ATTR_MAX] = {
[BRIDGE_ATTR_IFNAME] = { "ifname", 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 },
[BRIDGE_ATTR_AGEING_TIME] = { "ageing_time", BLOBMSG_TYPE_INT32 },
[BRIDGE_ATTR_HELLO_TIME] = { "hello_time", BLOBMSG_TYPE_INT32 },
[BRIDGE_ATTR_MAX_AGE] = { "max_age", BLOBMSG_TYPE_INT32 },
@@ -469,6 +471,11 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb)
if ((cur = tb[BRIDGE_ATTR_FORWARD_DELAY]))
cfg->forward_delay = blobmsg_get_u32(cur);
+ if ((cur = tb[BRIDGE_ATTR_PRIORITY])) {
+ cfg->priority = blobmsg_get_u32(cur);
+ cfg->flags |= BRIDGE_OPT_PRIORITY;
+ }
+
if ((cur = tb[BRIDGE_ATTR_IGMP_SNOOP]))
cfg->igmp_snoop = blobmsg_get_bool(cur);
diff --git a/system-linux.c b/system-linux.c
index d788a01..604c206 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -581,6 +581,12 @@ int system_bridge_addbr(struct device *bridge, struct bridge_config *cfg)
system_set_dev_sysctl("/sys/devices/virtual/net/%s/bridge/multicast_snooping",
bridge->ifname, cfg->igmp_snoop ? "1" : "0");
+ if (cfg->flags & BRIDGE_OPT_PRIORITY) {
+ args[0] = BRCTL_SET_BRIDGE_PRIORITY;
+ args[1] = cfg->priority;
+ system_bridge_if(bridge->ifname, NULL, SIOCDEVPRIVATE, &args);
+ }
+
if (cfg->flags & BRIDGE_OPT_AGEING_TIME) {
args[0] = BRCTL_SET_AGEING_TIME;
args[1] = sec_to_jiffies(cfg->ageing_time);
diff --git a/system.h b/system.h
index 9b555e8..1b16bb9 100644
--- a/system.h
+++ b/system.h
@@ -38,12 +38,14 @@ enum bridge_opt {
BRIDGE_OPT_AGEING_TIME = (1 << 0),
BRIDGE_OPT_HELLO_TIME = (1 << 1),
BRIDGE_OPT_MAX_AGE = (1 << 2),
+ BRIDGE_OPT_PRIORITY = (1 << 3),
};
struct bridge_config {
enum bridge_opt flags;
bool stp;
bool igmp_snoop;
+ unsigned short priority;
int forward_delay;
int ageing_time;