[iproute/f18] Support IPv6 addresses for route's nexthop

Petr Šabata psabata at fedoraproject.org
Thu Dec 20 16:02:20 UTC 2012


commit aef5711fddd120aeba18148dd98928191e0ad69e
Author: Petr Šabata <contyk at redhat.com>
Date:   Thu Dec 20 17:02:16 2012 +0100

    Support IPv6 addresses for route's nexthop

 iproute.spec                      |    7 ++++++-
 iproute2-3.7.0-ipv6-nexthop.patch |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/iproute.spec b/iproute.spec
index 61eaebd..677faa3 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:            4%{?dist}
+Release:            5%{?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
@@ -20,6 +20,7 @@ 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
 Patch11:            iproute2-3.7.0-ss-change-default-filter-to-include-all-soc.patch
+Patch12:            iproute2-3.7.0-ipv6-nexthop.patch
 License:            GPLv2+ and Public Domain
 BuildRequires:      tex(latex) tex(dvips) tex(ecrm1000.tfm) tex(cm-super-t1.enc) linuxdoc-tools
 BuildRequires:      flex linux-atm-libs-devel psutils libdb-devel bison
@@ -66,6 +67,7 @@ sed -i "s/_VERSION_/%{version}/" man/man8/ss.8
 %patch9 -p1 -b .lnstat-dump-to-stdout
 %patch10 -p1 -b .list-all
 %patch11 -p1 -b .ss-list-all
+%patch12 -p1 -b .ipv6-nexthop
 
 %build
 export LIBDIR=/%{_libdir}
@@ -175,6 +177,9 @@ done
 %{_includedir}/libnetlink.h
 
 %changelog
+* Thu Dec 20 2012 Petr Šabata <contyk at redhat.com> - 3.6.0-5
+- Support IPv6 addresses for route's nexthop
+
 * Wed Dec 12 2012 Petr Šabata <contyk at redhat.com> - 3.6.0-4
 - ss: list all, not just TCP sockets by default (#829630)
 
diff --git a/iproute2-3.7.0-ipv6-nexthop.patch b/iproute2-3.7.0-ipv6-nexthop.patch
new file mode 100644
index 0000000..a454de0
--- /dev/null
+++ b/iproute2-3.7.0-ipv6-nexthop.patch
@@ -0,0 +1,37 @@
+diff --git a/ip/iproute.c b/ip/iproute.c
+index c2178cf..2cbcc34 100644
+--- a/ip/iproute.c
++++ b/ip/iproute.c
+@@ -625,16 +625,20 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+ }
+ 
+ 
+-int parse_one_nh(struct rtattr *rta, struct rtnexthop *rtnh, int *argcp, char ***argvp)
++int parse_one_nh(struct rtmsg *r, struct rtattr *rta, struct rtnexthop *rtnh, int *argcp, char ***argvp)
+ {
+ 	int argc = *argcp;
+ 	char **argv = *argvp;
+ 
+ 	while (++argv, --argc > 0) {
+ 		if (strcmp(*argv, "via") == 0) {
++			inet_prefix addr;
+ 			NEXT_ARG();
+-			rta_addattr32(rta, 4096, RTA_GATEWAY, get_addr32(*argv));
+-			rtnh->rtnh_len += sizeof(struct rtattr) + 4;
++			get_addr(&addr, *argv, r->rtm_family);
++			if (r->rtm_family == AF_UNSPEC)
++				r->rtm_family = addr.family;
++			rta_addattr_l(rta, 4096, RTA_GATEWAY, &addr.data, addr.bytelen);
++			rtnh->rtnh_len += sizeof(struct rtattr) + addr.bytelen;
+ 		} else if (strcmp(*argv, "dev") == 0) {
+ 			NEXT_ARG();
+ 			if ((rtnh->rtnh_ifindex = ll_name_to_index(*argv)) == 0) {
+@@ -686,7 +690,7 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
+ 		memset(rtnh, 0, sizeof(*rtnh));
+ 		rtnh->rtnh_len = sizeof(*rtnh);
+ 		rta->rta_len += rtnh->rtnh_len;
+-		parse_one_nh(rta, rtnh, &argc, &argv);
++		parse_one_nh(r, rta, rtnh, &argc, &argv);
+ 		rtnh = RTNH_NEXT(rtnh);
+ 	}
+ 


More information about the scm-commits mailing list