implement a dump status call for bridge devices
authorFelix Fietkau <nbd@openwrt.org>
Sun, 27 Mar 2011 17:12:27 +0000 (19:12 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 27 Mar 2011 17:12:27 +0000 (19:12 +0200)
bridge.c

index 2aa0e68512280e6044419485995d49a52c7df552..6b6562ccf0b67a2635872e0baf6b3d4c382dfb45 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -292,12 +292,29 @@ bridge_free(struct device *dev)
        free(bst);
 }
 
+static void
+bridge_dump_status(struct device *dev, struct blob_buf *b)
+{
+       struct bridge_state *bst;
+       struct bridge_member *bm;
+       void *list;
+
+       bst = container_of(dev, struct bridge_state, dev);
+
+       list = blobmsg_open_array(b, "bridge-members");
+       list_for_each_entry(bm, &bst->members, list) {
+               blobmsg_add_string(b, NULL, bm->dev.dev->ifname);
+       }
+       blobmsg_close_array(b, list);
+}
+
 struct device *
 bridge_create(const char *name, struct uci_section *s)
 {
        static const struct device_type bridge_type = {
                .name = "Bridge",
                .free = bridge_free,
+               .dump_status = bridge_dump_status,
        };
        struct bridge_state *bst;
        struct device *dev;