Skip to contentSkip to conversation

ip: print "temporary" for IPv6 temp addresses

PATCH In review Brian Haley 2 participants 7 messages Sep 14, 2009 – Feb 9, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip: print "temporary" for IPv6 temp addresses

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".

---

ip/ipaddress.c +7 -3
index 32c9008..8492fa8 100644
@@ -74,7 +74,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");
@@ -486,7 +486,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;
@@ -642,7 +645,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) {
man/man8/ip.8 +5 -1
index 1145b28..24a3812 100644
@@ -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
@@ -1043,6 +1043,10 @@ address detection.
 address detection.
 
 .TP
+.B temporary
+(IPv6 only) only list temporary addresses.
+
+.TP
 .BR primary " and " secondary
 only list primary (or secondary) addresses.
 
#1 lore raw

Hi Stephen,

Quoted 3 lines · Brian Haley

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".

I didn't see this in your current git tree, just pinging you about it. This would apply on top of my dad_failed patch.

Thanks,

-Brian

Quoted 67 lines

---

ip/ipaddress.c +7 -3
index 32c9008..8492fa8 100644
@@ -74,7 +74,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");
@@ -486,7 +486,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;
@@ -642,7 +645,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) {
man/man8/ip.8 +5 -2
index 1145b28..24a3812 100644
@@ -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
@@ -1043,6 +1043,10 @@ address detection.
 address detection.
 
 .TP
+.B temporary
+(IPv6 only) only list temporary addresses.
+
+.TP
 .BR primary " and " secondary
 only list primary (or secondary) addresses.
 
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 10 lines · On Thu, 03 Dec 2009 14:41:02 -0500 Brian Haley <[email protected]> wrote:

Hi Stephen,

Quoted 3 lines · Brian Haley

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".

I didn't see this in your current git tree, just pinging you about it. This would apply on top of my dad_failed patch.

I'll put it as well, why did patchwork not see it?

#3 lore raw
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Thu, 03 Dec 2009 14:41:02 -0500 Brian Haley <[email protected]> wrote:

Hi Stephen,

Brian Haley wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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".

I didn't see this in your current git tree, just pinging you about it. This would apply on top of my dad_failed patch.

I'll put it as well, why did patchwork not see it?

I can only assume it was my subject line?

Let me know if I need to re-send as it was based on the other one.

-Brian

#4 lore raw
Quoted 14 lines · On Thu, 03 Dec 2009 15:31:57 -0500 Brian Haley <[email protected]> wrote:
Quoted 13 lines · Stephen Hemminger
Quoted 9 lines · On Thu, 03 Dec 2009 14:41:02 -0500 Brian Haley <[email protected]> wrote:

Hi Stephen,

Quoted 3 lines · Brian Haley

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".

I didn't see this in your current git tree, just pinging you about it. This would apply on top of my dad_failed patch.

Quoted 7 lines
Quoted 1 line

I'll put it as well, why did patchwork not see it?

I can only assume it was my subject line?

Let me know if I need to re-send as it was based on the other one.

-Brian

This in for 2.6.33 (next version)

#5 lore raw
Quoted 7 lines · Stephen Hemminger
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines · Brian Haley

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".

I didn't see this in your current git tree, just pinging you about it. This would apply on top of my dad_failed patch.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I'll put it as well, why did patchwork not see it?

I can only assume it was my subject line?

Let me know if I need to re-send as it was based on the other one.

-Brian

This in for 2.6.33 (next version)

Hi Stephen,

Sorry to bug you again, but I still don't see this patch in your iproute2 git tree, although I see things done after it. Do I have to wait until you tag a v2.6.33?

Thanks,

-Brian