]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
ip: print "temporary" for IPv6 temp addresses
authorBrian Haley <brian.haley@hp.com>
Mon, 14 Sep 2009 21:01:43 +0000 (17:01 -0400)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Tue, 9 Feb 2010 19:05:49 +0000 (11:05 -0800)
IPv6 addresses that have IFA_F_SECONDARY set are actually temporary addresses,
hence the IFA_F_TEMPORARY equivalent.  Change the output in this case and
allow filtering on the word "temporary".

Signed-off-by: Brian Haley <brian.haley@hp.com>
ip/ipaddress.c
man/man8/ip.8

index 91c7b1ba15883c63ed7fed9c503473ec20b5a614..e9256d91d271bd4efdd74c1269c874c7edb3d204 100644 (file)
@@ -72,7 +72,7 @@ static void usage(void)
        fprintf(stderr, "SCOPE-ID := [ host | link | global | NUMBER ]\n");
        fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
        fprintf(stderr, "FLAG  := [ permanent | dynamic | secondary | primary |\n");
-       fprintf(stderr, "           tentative | deprecated | dadfailed |\n");
+       fprintf(stderr, "           tentative | deprecated | dadfailed | temporary |\n");
        fprintf(stderr, "           CONFFLAG-LIST ]\n");
        fprintf(stderr, "CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG\n");
        fprintf(stderr, "CONFFLAG  := [ home | nodad ]\n");
@@ -484,7 +484,10 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
        fprintf(fp, "scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope, b1, sizeof(b1)));
        if (ifa->ifa_flags&IFA_F_SECONDARY) {
                ifa->ifa_flags &= ~IFA_F_SECONDARY;
-               fprintf(fp, "secondary ");
+               if (ifa->ifa_family == AF_INET6)
+                       fprintf(fp, "temporary ");
+               else
+                       fprintf(fp, "secondary ");
        }
        if (ifa->ifa_flags&IFA_F_TENTATIVE) {
                ifa->ifa_flags &= ~IFA_F_TENTATIVE;
@@ -661,7 +664,8 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush)
                } else if (strcmp(*argv, "permanent") == 0) {
                        filter.flags |= IFA_F_PERMANENT;
                        filter.flagmask |= IFA_F_PERMANENT;
-               } else if (strcmp(*argv, "secondary") == 0) {
+               } else if (strcmp(*argv, "secondary") == 0 ||
+                          strcmp(*argv, "temporary") == 0) {
                        filter.flags |= IFA_F_SECONDARY;
                        filter.flagmask |= IFA_F_SECONDARY;
                } else if (strcmp(*argv, "primary") == 0) {
index 0abd7851fb4c1bf2afd04b1af45589755f9869de..ccc800fecc7dafe85495efc6238c9a6db80e5ef1 100644 (file)
@@ -97,7 +97,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
 .ti -8
 .IR FLAG " := "
 .RB "[ " permanent " | " dynamic " | " secondary " | " primary " | "\
-tentative " | " deprecated " | " dadfailed " ]"
+tentative " | " deprecated " | " dadfailed " | " temporary " ]"
 
 .ti -8
 .BR "ip addrlabel" " { " add " | " del " } " prefix
@@ -1040,6 +1040,10 @@ address detection.
 (IPv6 only) only list addresses which have failed duplicate
 address detection.
 
+.TP
+.B temporary
+(IPv6 only) only list temporary addresses.
+
 .TP
 .BR primary " and " secondary
 only list primary (or secondary) addresses.