}
static void
-brigde_set_local_vlan(struct bridge_state *bst, struct bridge_vlan *vlan, bool add)
+bridge_set_local_vlan(struct bridge_state *bst, struct bridge_vlan *vlan, bool add)
{
if (!vlan->local && add)
return;
struct bridge_vlan *vlan;
vlist_for_each_element(&bst->dev.vlans, vlan, node)
- brigde_set_local_vlan(bst, vlan, add);
+ bridge_set_local_vlan(bst, vlan, add);
}
static struct bridge_vlan *
struct bridge_member *bm;
struct bridge_vlan *vlan2;
- brigde_set_local_vlan(bst, vlan, add);
+ bridge_set_local_vlan(bst, vlan, add);
vlist_for_each_element(&bst->members, bm, node) {
struct bridge_vlan_port *port;
free(bst);
}
+static void
+bridge_dump_port(struct blob_buf *b, struct bridge_vlan_port *port)
+{
+ bool tagged = !(port->flags & BRVLAN_F_UNTAGGED);
+ bool pvid = (port->flags & BRVLAN_F_PVID);
+
+ blobmsg_printf(b, "%s%s%s%s\n", port->ifname,
+ tagged || pvid ? ":" : "",
+ tagged ? "t" : "",
+ pvid ? "*" : "");
+}
+
+static void
+bridge_dump_vlan(struct blob_buf *b, struct bridge_vlan *vlan)
+{
+ struct bridge_vlan_hotplug_port *port;
+ void *c, *p;
+ int i;
+
+ c = blobmsg_open_table(b, NULL);
+
+ blobmsg_add_u32(b, "id", vlan->vid);
+ blobmsg_add_u8(b, "local", vlan->local);
+
+ p = blobmsg_open_array(b, "ports");
+
+ for (i = 0; i < vlan->n_ports; i++)
+ bridge_dump_port(b, &vlan->ports[i]);
+
+ list_for_each_entry(port, &vlan->hotplug_ports, list)
+ bridge_dump_port(b, &port->port);
+
+ blobmsg_close_array(b, p);
+
+ blobmsg_close_table(b, c);
+}
+
static void
bridge_dump_info(struct device *dev, struct blob_buf *b)
{
struct bridge_state *bst;
struct bridge_member *bm;
+ struct bridge_vlan *vlan;
void *list;
bst = container_of(dev, struct bridge_state, dev);
}
blobmsg_close_array(b, list);
+
+ if (avl_is_empty(&dev->vlans.avl))
+ return;
+
+ list = blobmsg_open_array(b, "bridge-vlans");
+
+ vlist_for_each_element(&bst->dev.vlans, vlan, node)
+ bridge_dump_vlan(b, vlan);
+
+ blobmsg_close_array(b, list);
}
static void