]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: Support filter links/neighs with no master
authorLahav Schlesinger <lschlesinger@drivenets.com>
Thu, 9 Sep 2021 07:20:19 +0000 (10:20 +0300)
committerDavid Ahern <dsahern@gmail.com>
Sun, 12 Sep 2021 17:17:18 +0000 (11:17 -0600)
Commit d3432bf10f17 ("net: Support filtering interfaces on no master")
in the kernel added support for filtering interfaces/neighbours that
have no master interface.

This patch completes it and adds this support to iproute2:
1. ip link show nomaster
2. ip address show nomaster
3. ip neighbour {show | flush} nomaster

Signed-off-by: Lahav Schlesinger <lschlesinger@drivenets.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
ip/ipaddress.c
ip/iplink.c
ip/ipneigh.c
man/man8/ip-address.8.in
man/man8/ip-link.8.in
man/man8/ip-neighbour.8

index 85534aaf59898f637f2762252bb4a6cec7f5496d..4109d8bd2c43640bee40656c124ea6393d95a345 100644 (file)
@@ -60,6 +60,7 @@ static void usage(void)
                "       ip address {save|flush} [ dev IFNAME ] [ scope SCOPE-ID ]\n"
                "                            [ to PREFIX ] [ FLAG-LIST ] [ label LABEL ] [up]\n"
                "       ip address [ show [ dev IFNAME ] [ scope SCOPE-ID ] [ master DEVICE ]\n"
+               "                         [ nomaster ]\n"
                "                         [ type TYPE ] [ to PREFIX ] [ FLAG-LIST ]\n"
                "                         [ label LABEL ] [up] [ vrf NAME ] ]\n"
                "       ip address {showdump|restore}\n"
@@ -2123,6 +2124,8 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
                        if (!name_is_vrf(*argv))
                                invarg("Not a valid VRF name\n", *argv);
                        filter.master = ifindex;
+               } else if (strcmp(*argv, "nomaster") == 0) {
+                       filter.master = -1;
                } else if (strcmp(*argv, "type") == 0) {
                        int soff;
 
index 18b2ea25b7c2bb85aa15fe197d21b7b6a97ec8d2..2fc0443ca587e241b0e3c6a3a2b298a10e91d5dd 100644 (file)
@@ -120,6 +120,7 @@ void iplink_usage(void)
                "               [ gso_max_size BYTES ] | [ gso_max_segs PACKETS ]\n"
                "\n"
                "       ip link show [ DEVICE | group GROUP ] [up] [master DEV] [vrf NAME] [type TYPE]\n"
+               "               [nomaster]\n"
                "\n"
                "       ip link xstats type TYPE [ ARGS ]\n"
                "\n"
index b778de00b242e29bc473956a966c89b215592da8..c29325e147bd31b9ecb91a2b6c5128b00dbf1ebc 100644 (file)
@@ -54,7 +54,7 @@ static void usage(void)
                "               [ dev DEV ] [ router ] [ extern_learn ] [ protocol PROTO ]\n"
                "\n"
                "       ip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud STATE ]\n"
-               "                                 [ vrf NAME ]\n"
+               "                                 [ vrf NAME ] [ nomaster ]\n"
                "       ip neigh get { ADDR | proxy ADDR } dev DEV\n"
                "\n"
                "STATE := { delay | failed | incomplete | noarp | none |\n"
@@ -535,6 +535,8 @@ static int do_show_or_flush(int argc, char **argv, int flush)
                        if (!name_is_vrf(*argv))
                                invarg("Not a valid VRF name\n", *argv);
                        filter.master = ifindex;
+               } else if (strcmp(*argv, "nomaster") == 0) {
+                       filter.master = -1;
                } else if (strcmp(*argv, "unused") == 0) {
                        filter.unused_only = 1;
                } else if (strcmp(*argv, "nud") == 0) {
index fe773c91592fb767d2c1c233798f9dc823ad7c88..65f67e06a287fa9b294c43e76d6dd5bb085c8163 100644 (file)
@@ -49,7 +49,8 @@ ip-address \- protocol address management
 .IR TYPE " ] [ "
 .B vrf
 .IR NAME " ] [ "
-.BR up " ] ]"
+.BR up " ] ["
+.BR nomaster " ] ]"
 
 .ti -8
 .BR "ip address" " { " showdump " | " restore " }"
@@ -340,6 +341,10 @@ output.
 .B up
 only list running interfaces.
 
+.TP
+.B nomaster
+only list interfaces with no master.
+
 .TP
 .BR dynamic " and " permanent
 (IPv6 only) only list addresses installed due to stateless
index 41efc6d4eceea275a930f27077361dcf9838e419..c0cbb5e851857b047a2c79c5b67339795d983490 100644 (file)
@@ -179,7 +179,8 @@ ip-link \- network device configuration
 .B type
 .IR ETYPE " ] ["
 .B vrf
-.IR NAME " ]"
+.IR NAME " ] ["
+.BR nomaster " ]"
 
 .ti -8
 .B ip link xstats
@@ -2536,6 +2537,10 @@ interface list by comparing it with the relevant attribute in case the kernel
 didn't filter already. Therefore any string is accepted, but may lead to empty
 output.
 
+.TP
+.B nomaster
+only show devices with no master
+
 .SS  ip link xstats - display extended statistics
 
 .TP
index a27f9ef847d220f719dfa2761c23d081aee5c387..028629641694587eef32eb16b2bdbdab0853c911 100644 (file)
@@ -35,7 +35,8 @@ ip-neighbour \- neighbour/arp tables management.
 .B  nud
 .IR STATE " ] [ "
 .B  vrf
-.IR NAME " ] "
+.IR NAME " ] ["
+.BR nomaster " ]"
 
 .ti -8
 .B ip neigh get
@@ -191,6 +192,10 @@ only list the neighbours attached to this device.
 .BI vrf " NAME"
 only list the neighbours for given VRF.
 
+.TP
+.BI nomaster
+only list neighbours attached to an interface with no master.
+
 .TP
 .BI proxy
 list neighbour proxies.