]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - bridge/fdb.c
bridge: fdb: Use 'struct ndmsg' for FDB dumping
[mirror_iproute2.git] / bridge / fdb.c
index f82938f838ae2173524553e17312d5fae3f0b08d..a7a0d80523075d04ba36e8b021463b541735103d 100644 (file)
@@ -181,13 +181,10 @@ int print_fdb(struct nlmsghdr *n, void *arg)
                                   "mac", "%s ", lladdr);
        }
 
-       if (!filter_index && r->ndm_ifindex) {
-               if (!is_json_context())
-                       fprintf(fp, "dev ");
+       if (!filter_index && r->ndm_ifindex)
                print_color_string(PRINT_ANY, COLOR_IFNAME,
                                   "ifname", "dev %s ",
                                   ll_index_to_name(r->ndm_ifindex));
-       }
 
        if (tb[NDA_DST]) {
                int family = AF_INET;
@@ -263,16 +260,16 @@ static int fdb_show(int argc, char **argv)
 {
        struct {
                struct nlmsghdr n;
-               struct ifinfomsg        ifm;
+               struct ndmsg            ndm;
                char                    buf[256];
        } req = {
-               .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
-               .ifm.ifi_family = PF_BRIDGE,
+               .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
+               .ndm.ndm_family = PF_BRIDGE,
        };
 
        char *filter_dev = NULL;
        char *br = NULL;
-       int msg_size = sizeof(struct ifinfomsg);
+       int msg_size = sizeof(struct ndmsg);
 
        while (argc > 0) {
                if ((strcmp(*argv, "brport") == 0) || strcmp(*argv, "dev") == 0) {
@@ -316,10 +313,10 @@ static int fdb_show(int argc, char **argv)
                filter_index = ll_name_to_index(filter_dev);
                if (!filter_index)
                        return nodev(filter_dev);
-               req.ifm.ifi_index = filter_index;
+               req.ndm.ndm_ifindex = filter_index;
        }
 
-       if (rtnl_dump_request(&rth, RTM_GETNEIGH, &req.ifm, msg_size) < 0) {
+       if (rtnl_dump_request(&rth, RTM_GETNEIGH, &req.ndm, msg_size) < 0) {
                perror("Cannot send dump request");
                exit(1);
        }