|
|
049c96 |
From beadd143d5adde6e482bb088255f9bba7a8d850a Mon Sep 17 00:00:00 2001
|
|
|
049c96 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Thu, 18 Feb 2016 13:21:45 +0100
|
|
|
049c96 |
Subject: [PATCH] ip: allow ip address show to list addresses with certain
|
|
|
049c96 |
flags not being set
|
|
|
049c96 |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1231898
|
|
|
049c96 |
Upstream Status: iproute2.git commit b5f39b2588a6b
|
|
|
049c96 |
|
|
|
049c96 |
commit b5f39b2588a6b0312f11ac6d0fab9391b105b83c
|
|
|
049c96 |
Author: Heiner Kallweit <hkallweit1@gmail.com>
|
|
|
049c96 |
Date: Mon Dec 22 20:18:43 2014 +0100
|
|
|
049c96 |
|
|
|
049c96 |
ip: allow ip address show to list addresses with certain flags not being set
|
|
|
049c96 |
|
|
|
049c96 |
Sometimes it's needed to have "ip address show" list only addresses
|
|
|
049c96 |
with certain flags not being set, e.g. in network scripts.
|
|
|
049c96 |
As an example one might want to exclude addresses in "tentative"
|
|
|
049c96 |
or "deprecated" state.
|
|
|
049c96 |
|
|
|
049c96 |
Support listing addresses with flags tentative, deprecated, dadfailed
|
|
|
049c96 |
not being set by prefixing the respective flag with a minus.
|
|
|
049c96 |
|
|
|
049c96 |
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
|
|
|
049c96 |
---
|
|
|
049c96 |
ip/ipaddress.c | 11 ++++++++++-
|
|
|
049c96 |
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
049c96 |
|
|
|
049c96 |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
049c96 |
index 197f5ae..1e0728c 100644
|
|
|
049c96 |
--- a/ip/ipaddress.c
|
|
|
049c96 |
+++ b/ip/ipaddress.c
|
|
|
049c96 |
@@ -80,7 +80,7 @@ static void usage(void)
|
|
|
049c96 |
fprintf(stderr, "SCOPE-ID := [ host | link | global | NUMBER ]\n");
|
|
|
049c96 |
fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
|
|
|
049c96 |
fprintf(stderr, "FLAG := [ permanent | dynamic | secondary | primary |\n");
|
|
|
049c96 |
- fprintf(stderr, " tentative | deprecated | dadfailed | temporary |\n");
|
|
|
049c96 |
+ fprintf(stderr, " [-]tentative | [-]deprecated | [-]dadfailed | temporary |\n");
|
|
|
049c96 |
fprintf(stderr, " CONFFLAG-LIST ]\n");
|
|
|
049c96 |
fprintf(stderr, "CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG\n");
|
|
|
049c96 |
fprintf(stderr, "CONFFLAG := [ home | nodad | mngtmpaddr | noprefixroute ]\n");
|
|
|
049c96 |
@@ -1233,9 +1233,15 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
|
|
|
049c96 |
} else if (strcmp(*argv, "tentative") == 0) {
|
|
|
049c96 |
filter.flags |= IFA_F_TENTATIVE;
|
|
|
049c96 |
filter.flagmask |= IFA_F_TENTATIVE;
|
|
|
049c96 |
+ } else if (strcmp(*argv, "-tentative") == 0) {
|
|
|
049c96 |
+ filter.flags &= ~IFA_F_TENTATIVE;
|
|
|
049c96 |
+ filter.flagmask |= IFA_F_TENTATIVE;
|
|
|
049c96 |
} else if (strcmp(*argv, "deprecated") == 0) {
|
|
|
049c96 |
filter.flags |= IFA_F_DEPRECATED;
|
|
|
049c96 |
filter.flagmask |= IFA_F_DEPRECATED;
|
|
|
049c96 |
+ } else if (strcmp(*argv, "-deprecated") == 0) {
|
|
|
049c96 |
+ filter.flags &= ~IFA_F_DEPRECATED;
|
|
|
049c96 |
+ filter.flagmask |= IFA_F_DEPRECATED;
|
|
|
049c96 |
} else if (strcmp(*argv, "home") == 0) {
|
|
|
049c96 |
filter.flags |= IFA_F_HOMEADDRESS;
|
|
|
049c96 |
filter.flagmask |= IFA_F_HOMEADDRESS;
|
|
|
049c96 |
@@ -1251,6 +1257,9 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
|
|
|
049c96 |
} else if (strcmp(*argv, "dadfailed") == 0) {
|
|
|
049c96 |
filter.flags |= IFA_F_DADFAILED;
|
|
|
049c96 |
filter.flagmask |= IFA_F_DADFAILED;
|
|
|
049c96 |
+ } else if (strcmp(*argv, "-dadfailed") == 0) {
|
|
|
049c96 |
+ filter.flags &= ~IFA_F_DADFAILED;
|
|
|
049c96 |
+ filter.flagmask |= IFA_F_DADFAILED;
|
|
|
049c96 |
} else if (strcmp(*argv, "label") == 0) {
|
|
|
049c96 |
NEXT_ARG();
|
|
|
049c96 |
filter.label = *argv;
|
|
|
049c96 |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
049c96 |
|