From patchwork Mon Sep 14 21:01:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Haley X-Patchwork-Id: 33610 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 942B9B7BBD for ; Tue, 15 Sep 2009 07:02:32 +1000 (EST) Received: by ozlabs.org (Postfix) id 79CF7DDD0B; Tue, 15 Sep 2009 07:02:32 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 22F5DDDD01 for ; Tue, 15 Sep 2009 07:02:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757167AbZINVBm (ORCPT ); Mon, 14 Sep 2009 17:01:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757062AbZINVBm (ORCPT ); Mon, 14 Sep 2009 17:01:42 -0400 Received: from g5t0007.atlanta.hp.com ([15.192.0.44]:29488 "EHLO g5t0007.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755817AbZINVBl (ORCPT ); Mon, 14 Sep 2009 17:01:41 -0400 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g5t0007.atlanta.hp.com (Postfix) with ESMTP id CA1E714030; Mon, 14 Sep 2009 21:01:44 +0000 (UTC) Received: from [16.1.1.100] (squirrel.fc.hp.com [15.11.146.57]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 262BB3011A; Mon, 14 Sep 2009 21:01:43 +0000 (UTC) Message-ID: <4AAEAF37.7020305@hp.com> Date: Mon, 14 Sep 2009 17:01:43 -0400 From: Brian Haley Organization: Open Source and Linux Organization User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Stephen Hemminger CC: "netdev@vger.kernel.org" Subject: [PATCH iproute2] ip: print "temporary" for IPv6 temp addresses Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 32c9008..8492fa8 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -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) { diff --git a/man/man8/ip.8 b/man/man8/ip.8 index 1145b28..24a3812 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -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.