[iproute] List all interfaces by default

Petr Šabata psabata at fedoraproject.org
Thu Oct 4 13:29:58 UTC 2012


commit 9851a6c3f0487f545814204d1097ce45fdb584b2
Author: Petr Šabata <contyk at redhat.com>
Date:   Thu Oct 4 15:23:37 2012 +0200

    List all interfaces by default

 iproute.spec                                       |    7 ++-
 ...interfaces-without-net-address-by-default.patch |   87 ++++++++++++++++++++
 2 files changed, 93 insertions(+), 1 deletions(-)
---
diff --git a/iproute.spec b/iproute.spec
index fd1faa1..f118a12 100644
--- a/iproute.spec
+++ b/iproute.spec
@@ -2,7 +2,7 @@
 Summary:            Advanced IP routing and network device configuration tools
 Name:               iproute
 Version:            3.6.0
-Release:            1%{?dist}
+Release:            2%{?dist}
 Group:              Applications/System
 URL:                http://kernel.org/pub/linux/utils/net/%{name}2/
 Source0:            http://kernel.org/pub/linux/utils/net/%{name}2/%{name}2-%{version}.tar.gz
@@ -18,6 +18,7 @@ Patch6:             iproute2-example-cbq-service.patch
 Patch7:             iproute2-2.6.35-print-route.patch
 Patch8:             iproute2-2.6.39-create-peer-veth-without-a-name.patch
 Patch9:             iproute2-2.6.39-lnstat-dump-to-stdout.patch
+Patch10:            iproute2-3.6.0-List-interfaces-without-net-address-by-default.patch
 License:            GPLv2+ and Public Domain
 BuildRequires:      tex(latex) tex(dvips) linuxdoc-tools
 BuildRequires:      flex linux-atm-libs-devel psutils libdb-devel bison
@@ -62,6 +63,7 @@ sed -i "s/_VERSION_/%{version}/" man/man8/ss.8
 %patch7 -p1 -b .print-route
 %patch8 -p1 -b .peer-veth-without-name
 %patch9 -p1 -b .lnstat-dump-to-stdout
+%patch10 -p1 -b .list-all
 
 %build
 export LIBDIR=/%{_libdir}
@@ -168,6 +170,9 @@ done
 %{_includedir}/libnetlink.h
 
 %changelog
+* Thu Oct 04 2012 Petr Šabata <contyk at redhat.com> - 3.6.0-2
+- List all interfaces by default
+
 * Wed Oct 03 2012 Petr Šabata <contyk at redhat.com> - 3.6.0-1
 - 3.6.0 bump
 
diff --git a/iproute2-3.6.0-List-interfaces-without-net-address-by-default.patch b/iproute2-3.6.0-List-interfaces-without-net-address-by-default.patch
new file mode 100644
index 0000000..242cc7c
--- /dev/null
+++ b/iproute2-3.6.0-List-interfaces-without-net-address-by-default.patch
@@ -0,0 +1,87 @@
+From 7f747fd9377b8538adeba7332d25905ba08ac156 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 3 Oct 2012 16:42:41 +0200
+Subject: [PATCH] iproute2: List interfaces without net address by default
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes regression in iproute2-3.5.1 when `ip addr show' skipped
+interfaces without network layer address.
+
+Wrong output:
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
+    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+    inet 127.0.0.1/8 scope host lo
+    inet6 ::1/128 scope host
+       valid_lft forever preferred_lft forever
+2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
+    link/ether 00:50:54:00:0f:03 brd ff:ff:ff:ff:ff:ff
+    inet 10.34.25.198/23 brd 10.34.25.255 scope global eth0
+    inet6 2620:52:0:2219:250:54ff:fe00:f03/64 scope global dynamic
+       valid_lft 2591919sec preferred_lft 604719sec
+    inet6 fe80::250:54ff:fe00:f03/64 scope link
+       valid_lft forever preferred_lft forever
+
+Expected output:
+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
+    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+    inet 127.0.0.1/8 scope host lo
+    inet6 ::1/128 scope host
+       valid_lft forever preferred_lft forever
+2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
+    link/ether 00:50:54:00:0f:03 brd ff:ff:ff:ff:ff:ff
+    inet 10.34.25.198/23 brd 10.34.25.255 scope global eth0
+    inet6 2620:52:0:2219:250:54ff:fe00:f03/64 scope global dynamic
+       valid_lft 2591896sec preferred_lft 604696sec
+    inet6 fe80::250:54ff:fe00:f03/64 scope link
+       valid_lft forever preferred_lft forever
+5: veth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
+    link/ether 8a:ec:35:34:1f:a8 brd ff:ff:ff:ff:ff:ff
+6: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
+    link/ether 2e:97:ef:77:40:82 brd ff:ff:ff:ff:ff:ff
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+Signed-off-by: Petr Šabata <contyk at redhat.com>
+---
+ ip/ipaddress.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/ip/ipaddress.c b/ip/ipaddress.c
+index 6c11ce4..5498f46 100644
+--- a/ip/ipaddress.c
++++ b/ip/ipaddress.c
+@@ -884,6 +884,7 @@ static void ipaddr_filter(struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo)
+ 	lp = &linfo->head;
+ 	while ( (l = *lp) != NULL) {
+ 		int ok = 0;
++		int missing_net_address = 1;
+ 		struct ifinfomsg *ifi = NLMSG_DATA(&l->h);
+ 		struct nlmsg_list *a;
+ 
+@@ -891,8 +892,10 @@ static void ipaddr_filter(struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo)
+ 			struct nlmsghdr *n = &a->h;
+ 			struct ifaddrmsg *ifa = NLMSG_DATA(n);
+ 
+-			if (ifa->ifa_index != ifi->ifi_index ||
+-			    (filter.family && filter.family != ifa->ifa_family))
++			if (ifa->ifa_index != ifi->ifi_index)
++				continue;
++			missing_net_address = 0;
++			if (filter.family && filter.family != ifa->ifa_family)
+ 				continue;
+ 			if ((filter.scope^ifa->ifa_scope)&filter.scopemask)
+ 				continue;
+@@ -927,6 +930,9 @@ static void ipaddr_filter(struct nlmsg_chain *linfo, struct nlmsg_chain *ainfo)
+ 			ok = 1;
+ 			break;
+ 		}
++		if (missing_net_address &&
++		    (filter.family == AF_UNSPEC || filter.family == AF_PACKET))
++			ok = 1;
+ 		if (!ok) {
+ 			*lp = l->next;
+ 			free(l);
+-- 
+1.7.11.4
+


More information about the scm-commits mailing list