[DEV_ATTR_MULTICAST_TO_UNICAST] = { .name = "multicast_to_unicast", .type = BLOBMSG_TYPE_BOOL },
[DEV_ATTR_MULTICAST_ROUTER] = { .name = "multicast_router", .type = BLOBMSG_TYPE_INT32 },
[DEV_ATTR_MULTICAST] = { .name ="multicast", .type = BLOBMSG_TYPE_BOOL },
+ [DEV_ATTR_LEARNING] = { .name ="learning", .type = BLOBMSG_TYPE_BOOL },
+ [DEV_ATTR_UNICAST_FLOOD] = { .name ="unicast_flood", .type = BLOBMSG_TYPE_BOOL },
};
const struct uci_blob_param_list device_attr_list = {
s->multicast : os->multicast;
n->multicast_to_unicast = s->multicast_to_unicast;
n->multicast_router = s->multicast_router;
+ n->learning = s->learning;
+ n->unicast_flood = s->unicast_flood;
n->flags = s->flags | os->flags | os->valid_flags;
}
s->flags |= DEV_OPT_MULTICAST;
}
+ if ((cur = tb[DEV_ATTR_LEARNING])) {
+ s->learning = blobmsg_get_bool(cur);
+ s->flags |= DEV_OPT_LEARNING;
+ }
+
+ if ((cur = tb[DEV_ATTR_UNICAST_FLOOD])) {
+ s->unicast_flood = blobmsg_get_bool(cur);
+ s->flags |= DEV_OPT_UNICAST_FLOOD;
+ }
+
device_set_disabled(dev, disabled);
}
blobmsg_add_u32(b, "multicast_router", st.multicast_router);
if (st.flags & DEV_OPT_MULTICAST)
blobmsg_add_u8(b, "multicast", st.multicast);
+ if (st.flags & DEV_OPT_LEARNING)
+ blobmsg_add_u8(b, "learning", st.learning);
+ if (st.flags & DEV_OPT_UNICAST_FLOOD)
+ blobmsg_add_u8(b, "unicast_flood", st.unicast_flood);
}
s = blobmsg_open_table(b, "statistics");
DEV_ATTR_MULTICAST_TO_UNICAST,
DEV_ATTR_MULTICAST_ROUTER,
DEV_ATTR_MULTICAST,
+ DEV_ATTR_LEARNING,
+ DEV_ATTR_UNICAST_FLOOD,
__DEV_ATTR_MAX,
};
DEV_OPT_MULTICAST_TO_UNICAST = (1 << 14),
DEV_OPT_MULTICAST_ROUTER = (1 << 15),
DEV_OPT_MULTICAST = (1 << 16),
+ DEV_OPT_LEARNING = (1 << 17),
+ DEV_OPT_UNICAST_FLOOD = (1 << 18),
};
/* events broadcasted to all users of a device */
bool multicast_to_unicast;
unsigned int multicast_router;
bool multicast;
+ bool learning;
+ bool unicast_flood;
};
/*
dev->ifname, val);
}
+static void system_bridge_set_learning(struct device *dev, const char *val)
+{
+ system_set_dev_sysctl("/sys/class/net/%s/brport/learning", dev->ifname, val);
+}
+
+static void system_bridge_set_unicast_flood(struct device *dev, const char *val)
+{
+ system_set_dev_sysctl("/sys/class/net/%s/brport/unicast_flood", dev->ifname, val);
+}
+
static int system_get_sysctl(const char *path, char *buf, const size_t buf_sz)
{
int fd = -1, ret = -1;
system_bridge_set_multicast_router(dev, buf, false);
}
+ if (dev->settings.flags & DEV_OPT_LEARNING &&
+ !dev->settings.learning)
+ system_bridge_set_learning(dev, "0");
+
+ if (dev->settings.flags & DEV_OPT_UNICAST_FLOOD &&
+ !dev->settings.unicast_flood)
+ system_bridge_set_unicast_flood(dev, "0");
+
return ret;
}