netifd: Export ip4table/ip6table via UBUS
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 19 Nov 2013 11:17:03 +0000 (12:17 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 8 Dec 2013 17:43:51 +0000 (18:43 +0100)
Export ip4table/ip6table parameters via UBUS to facilitate
route inspection and usage by other applications

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
ubus.c

diff --git a/ubus.c b/ubus.c
index e563e1f..794444e 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -659,6 +659,10 @@ netifd_dump_status(struct interface *iface)
                blobmsg_add_string(&b, "device", dev->ifname);
 
        if (iface->state == IFS_UP) {
                blobmsg_add_string(&b, "device", dev->ifname);
 
        if (iface->state == IFS_UP) {
+               if (iface->ip4table)
+                       blobmsg_add_u32(&b, "ip4table", iface->ip4table);
+               if (iface->ip6table)
+                       blobmsg_add_u32(&b, "ip6table", iface->ip6table);                 
                blobmsg_add_u32(&b, "metric", iface->metric);
                blobmsg_add_u8(&b, "delegation", !iface->proto_ip.no_delegation);
                a = blobmsg_open_array(&b, "ipv4-address");
                blobmsg_add_u32(&b, "metric", iface->metric);
                blobmsg_add_u8(&b, "delegation", !iface->proto_ip.no_delegation);
                a = blobmsg_open_array(&b, "ipv4-address");