netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Request for help with iproute2 bugs.
@ 2009-11-23 10:37 Andreas Henriksson
  2009-11-23 11:03 ` Patrick McHardy
  2009-12-03  1:08 ` Simon Horman
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Henriksson @ 2009-11-23 10:37 UTC (permalink / raw)
  To: netdev; +Cc: shemminger

Hello everybody!

This is a desperate attempt at finding people with time and motivation
to look into bugs that has been reported against the iproute package
in the debian bug tracking system. The reported bugs are usually
not Debian-specific...

You'll find the complete list at http://bugs.debian.org/iproute
If you have comments, please email them to <bugnumber>@bugs.debian.org


Here's a list of interesting candidates, hopefully you'll find some useful
comments if you follow the link (usually last comment at the bottom):

http://bugs.debian.org/532152 - incorrectly enumerates existing addresses.
  iproute: 'ip addr flush' exits with error on first try

http://bugs.debian.org/525933 - many ip-addresses not handled gracefully.
  iproute: "ip address" failes to list all IPs on an interface

http://bugs.debian.org/511720 - rip out flawed code in favor of sed ?
  iproute: ss filter parsing flawed

http://bugs.debian.org/532727
  iproute: "tc filter add ... protocol ip fw" broken?

http://bugs.debian.org/551937 - replacing ipv6 routes broken.
  iproute: "ip -6 route replace ..." behaves as "ip -6 route add ..."

http://bugs.debian.org/498498 - ipv6 specific blackhole routing.
  iproute: adding route blackholes doesn't work for IPv6

http://bugs.debian.org/508450 - weird behaviour confuses users.
   ip tun add fails to create tunnel without remote, though no error



-- 
Andreas Henriksson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for help with iproute2 bugs.
  2009-11-23 10:37 Request for help with iproute2 bugs Andreas Henriksson
@ 2009-11-23 11:03 ` Patrick McHardy
  2009-12-02  0:20   ` Stephen Hemminger
  2009-12-03  1:08 ` Simon Horman
  1 sibling, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2009-11-23 11:03 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: netdev, shemminger

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Andreas Henriksson wrote:
> http://bugs.debian.org/532727
>   iproute: "tc filter add ... protocol ip fw" broken?
> 

This one is caused by a regression in iproute2. The attached patch
should fix it.

[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1640 bytes --]

commit b3d80773099c13f60598857901cb2724c210614f
Author: Patrick McHardy <kaber@trash.net>
Date:   Mon Nov 23 12:00:46 2009 +0100

    f_fw: fix compat mode
    
    The kernel takes a lack of options as indication that the fw classifier
    should operate in compatibility mode, where marks are mapped directly to
    classids.
    
    Commit e22b42a (tc mask patch) broke this by adding an empty TCA_OPTIONS
    attribute even if no handle is specified. Restore the old behaviour.
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/tc/f_fw.c b/tc/f_fw.c
index b511735..cc8ea2d 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -38,15 +38,13 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
 	struct tc_police tp;
 	struct tcmsg *t = NLMSG_DATA(n);
 	struct rtattr *tail;
+	__u32 mask = 0;
+	int mask_set = 0;
 
 	memset(&tp, 0, sizeof(tp));
 
-	tail = NLMSG_TAIL(n);
-	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
-
 	if (handle) {
 		char *slash;
-		__u32 mask = 0;
 		if ((slash = strchr(handle, '/')) != NULL)
 			*slash = '\0';
 		if (get_u32(&t->tcm_handle, handle, 0)) {
@@ -58,13 +56,19 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
 				fprintf(stderr, "Illegal \"handle\" mask\n");
 				return -1;
 			}
-			addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
+			mask_set = 1;
 		}
 	}
 
 	if (argc == 0)
 		return 0;
 
+	tail = NLMSG_TAIL(n);
+	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+
+	if (mask_set)
+		addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
+
 	while (argc > 0) {
 		if (matches(*argv, "classid") == 0 ||
 		    matches(*argv, "flowid") == 0) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Request for help with iproute2 bugs.
  2009-11-23 11:03 ` Patrick McHardy
@ 2009-12-02  0:20   ` Stephen Hemminger
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2009-12-02  0:20 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Andreas Henriksson, netdev

On Mon, 23 Nov 2009 12:03:41 +0100
Patrick McHardy <kaber@trash.net> wrote:

> Andreas Henriksson wrote:
> > http://bugs.debian.org/532727
> >   iproute: "tc filter add ... protocol ip fw" broken?
> > 
> 
> This one is caused by a regression in iproute2. The attached patch
> should fix it.

applied


-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for help with iproute2 bugs.
  2009-11-23 10:37 Request for help with iproute2 bugs Andreas Henriksson
  2009-11-23 11:03 ` Patrick McHardy
@ 2009-12-03  1:08 ` Simon Horman
  2009-12-07  3:47   ` Simon Horman
  2009-12-26 18:12   ` Stephen Hemminger
  1 sibling, 2 replies; 7+ messages in thread
From: Simon Horman @ 2009-12-03  1:08 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: netdev, shemminger, 532152

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On Mon, Nov 23, 2009 at 11:37:42AM +0100, Andreas Henriksson wrote:
> Hello everybody!
> 
> This is a desperate attempt at finding people with time and motivation
> to look into bugs that has been reported against the iproute package
> in the debian bug tracking system. The reported bugs are usually
> not Debian-specific...
> 
> You'll find the complete list at http://bugs.debian.org/iproute
> If you have comments, please email them to <bugnumber>@bugs.debian.org
> 
> 
> Here's a list of interesting candidates, hopefully you'll find some useful
> comments if you follow the link (usually last comment at the bottom):
> 
> http://bugs.debian.org/532152 - incorrectly enumerates existing addresses.
>   iproute: 'ip addr flush' exits with error on first try

I've taken a stab at this one.


[-- Attachment #2: rtnl_dump_filterl_inner.patch --]
[-- Type: text/x-diff, Size: 7737 bytes --]

To: Andreas Henriksson <andreas@fatal.se>
Cc: netdev@vger.kernel.org, shemminger@vyatta.com, 532152@bugs.debian.org
Subject: [rfc] iproute2: flush secondary addresses before primary ones
Date: Thu, 03 Dec 2009 12:05:55 +1100

Unless promote_secondaries has been active deleting the primary address of
an interface will automatically delete all the secondary addresses.

In the case where ip flush requests the primary then secondary addresses to
be removed - which is the order the addresses are returned by the kernel -
this will cause an error as by the time the request to remove a secondary
address is made it will be missing as it will have been deleted in the
course of deleting the primary address.

This approach to solving this problem orders requests for the
deletion of secondary addresses before primary ones providing
rtnl_dump_filter_l(), a version of rtnl_dump_filter() that
iterates over a list of filters. And by providing two specialised
filters print_addrinfo_secondary() and print_addrinfo_primary().

rtnl_dump_filter_l() first iterates over all addresses using
print_addrinfo_secondary(), which appends secondary addresses to the
request buffer.  Then again using print_addrinfo_primary() which appends
primary addresses.

This approach should work regardless of it promote_secondaries is
active or not. And regardless of if any primary of secondary addresses
are present or not.

Signed-off-by: Simon Horman <horms@verge.net.au>

--- 

 include/libnetlink.h |   12 +++++++
 ip/ipaddress.c       |   43 +++++++++++++++++++++++++
 lib/libnetlink.c     |   84 +++++++++++++++++++++++++++++---------------------
 3 files changed, 104 insertions(+), 35 deletions(-)

I'm not sure if this is the right place for this change,
but this patch seems worth posting for discussion.

Index: iproute2/lib/libnetlink.c
===================================================================
--- iproute2.orig/lib/libnetlink.c	2009-12-03 09:40:21.000000000 +0900
+++ iproute2/lib/libnetlink.c	2009-12-03 09:40:26.000000000 +0900
@@ -172,11 +172,8 @@ int rtnl_dump_request(struct rtnl_handle
 	return sendmsg(rth->fd, &msg, 0);
 }
 
-int rtnl_dump_filter(struct rtnl_handle *rth,
-		     rtnl_filter_t filter,
-		     void *arg1,
-		     rtnl_filter_t junk,
-		     void *arg2)
+int rtnl_dump_filter_l(struct rtnl_handle *rth,
+		       const struct rtnl_dump_filter_arg *arg)
 {
 	struct sockaddr_nl nladdr;
 	struct iovec iov;
@@ -191,7 +188,7 @@ int rtnl_dump_filter(struct rtnl_handle 
 	iov.iov_base = buf;
 	while (1) {
 		int status;
-		struct nlmsghdr *h;
+		const struct rtnl_dump_filter_arg *a;
 
 		iov.iov_len = sizeof(buf);
 		status = recvmsg(rth->fd, &msg, 0);
@@ -209,40 +206,45 @@ int rtnl_dump_filter(struct rtnl_handle 
 			return -1;
 		}
 
-		h = (struct nlmsghdr*)buf;
-		while (NLMSG_OK(h, status)) {
-			int err;
+		for (a = arg; a->filter; a++) {
+			struct nlmsghdr *h = (struct nlmsghdr*)buf;
 
-			if (nladdr.nl_pid != 0 ||
-			    h->nlmsg_pid != rth->local.nl_pid ||
-			    h->nlmsg_seq != rth->dump) {
-				if (junk) {
-					err = junk(&nladdr, h, arg2);
-					if (err < 0)
-						return err;
+			while (NLMSG_OK(h, status)) {
+				int err;
+
+				if (nladdr.nl_pid != 0 ||
+				    h->nlmsg_pid != rth->local.nl_pid ||
+				    h->nlmsg_seq != rth->dump) {
+					if (a->junk) {
+						err = a->junk(&nladdr, h,
+							      a->arg2);
+						if (err < 0)
+							return err;
+					}
+					goto skip_it;
 				}
-				goto skip_it;
-			}
 
-			if (h->nlmsg_type == NLMSG_DONE)
-				return 0;
-			if (h->nlmsg_type == NLMSG_ERROR) {
-				struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
-				if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
-					fprintf(stderr, "ERROR truncated\n");
-				} else {
-					errno = -err->error;
-					perror("RTNETLINK answers");
+				if (h->nlmsg_type == NLMSG_DONE)
+					return 0;
+				if (h->nlmsg_type == NLMSG_ERROR) {
+					struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
+					if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
+						fprintf(stderr,
+							"ERROR truncated\n");
+					} else {
+						errno = -err->error;
+						perror("RTNETLINK answers");
+					}
+					return -1;
 				}
-				return -1;
-			}
-			err = filter(&nladdr, h, arg1);
-			if (err < 0)
-				return err;
+				err = a->filter(&nladdr, h, a->arg1);
+				if (err < 0)
+					return err;
 
 skip_it:
-			h = NLMSG_NEXT(h, status);
-		}
+				h = NLMSG_NEXT(h, status);
+			}
+		} while (0);
 		if (msg.msg_flags & MSG_TRUNC) {
 			fprintf(stderr, "Message truncated\n");
 			continue;
@@ -254,6 +256,20 @@ skip_it:
 	}
 }
 
+int rtnl_dump_filter(struct rtnl_handle *rth,
+		     rtnl_filter_t filter,
+		     void *arg1,
+		     rtnl_filter_t junk,
+		     void *arg2)
+{
+	const struct rtnl_dump_filter_arg a[2] = {
+		{ .filter = filter, .arg1 = arg1, .junk = junk, .arg2 = arg2 },
+		{ .filter = NULL,   .arg1 = NULL, .junk = NULL, .arg2 = NULL }
+	};
+
+	return rtnl_dump_filter_l(rth, a);
+}
+
 int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
 	      unsigned groups, struct nlmsghdr *answer,
 	      rtnl_filter_t junk,
Index: iproute2/include/libnetlink.h
===================================================================
--- iproute2.orig/include/libnetlink.h	2009-12-03 09:40:21.000000000 +0900
+++ iproute2/include/libnetlink.h	2009-12-03 09:40:26.000000000 +0900
@@ -27,10 +27,22 @@ extern int rtnl_dump_request(struct rtnl
 
 typedef int (*rtnl_filter_t)(const struct sockaddr_nl *,
 			     struct nlmsghdr *n, void *);
+
+struct rtnl_dump_filter_arg
+{
+	rtnl_filter_t filter;
+	void *arg1;
+	rtnl_filter_t junk;
+	void *arg2;
+};
+
+extern int rtnl_dump_filter_l(struct rtnl_handle *rth,
+			      const struct rtnl_dump_filter_arg *arg);
 extern int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter,
 			    void *arg1,
 			    rtnl_filter_t junk,
 			    void *arg2);
+
 extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
 		     unsigned groups, struct nlmsghdr *answer,
 		     rtnl_filter_t junk,
Index: iproute2/ip/ipaddress.c
===================================================================
--- iproute2.orig/ip/ipaddress.c	2009-12-03 09:40:21.000000000 +0900
+++ iproute2/ip/ipaddress.c	2009-12-03 09:43:10.000000000 +0900
@@ -539,6 +539,27 @@ int print_addrinfo(const struct sockaddr
 	return 0;
 }
 
+int print_addrinfo_primary(const struct sockaddr_nl *who, struct nlmsghdr *n,
+			   void *arg)
+{
+	struct ifaddrmsg *ifa = NLMSG_DATA(n);
+
+	if (!ifa->ifa_flags & IFA_F_SECONDARY)
+		return 0;
+
+	return print_addrinfo(who, n, arg);
+}
+
+int print_addrinfo_secondary(const struct sockaddr_nl *who, struct nlmsghdr *n,
+			     void *arg)
+{
+	struct ifaddrmsg *ifa = NLMSG_DATA(n);
+
+	if (ifa->ifa_flags & IFA_F_SECONDARY)
+		return 0;
+
+	return print_addrinfo(who, n, arg);
+}
 
 struct nlmsg_list
 {
@@ -700,12 +721,32 @@ static int ipaddr_list_or_flush(int argc
 		filter.flushe = sizeof(flushb);
 
 		while (round < MAX_ROUNDS) {
+			const struct rtnl_dump_filter_arg a[3] = {
+				{
+					.filter = print_addrinfo_secondary,
+					.arg1 = stdout,
+					.junk = NULL,
+					.arg2 = NULL
+				},
+				{
+					.filter = print_addrinfo_primary,
+					.arg1 = stdout,
+					.junk = NULL,
+					.arg2 = NULL
+				},
+				{
+					.filter = NULL,
+					.arg1 = NULL,
+					.junk = NULL,
+					.arg2 = NULL
+				},
+			};
 			if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
 				perror("Cannot send dump request");
 				exit(1);
 			}
 			filter.flushed = 0;
-			if (rtnl_dump_filter(&rth, print_addrinfo, stdout, NULL, NULL) < 0) {
+			if (rtnl_dump_filter_l(&rth, a) < 0) {
 				fprintf(stderr, "Flush terminated\n");
 				exit(1);
 			}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for help with iproute2 bugs.
  2009-12-03  1:08 ` Simon Horman
@ 2009-12-07  3:47   ` Simon Horman
  2009-12-07  6:50     ` Bug#532152: " Andreas Henriksson
  2009-12-26 18:12   ` Stephen Hemminger
  1 sibling, 1 reply; 7+ messages in thread
From: Simon Horman @ 2009-12-07  3:47 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: netdev, shemminger, 532152

On Thu, Dec 03, 2009 at 12:08:27PM +1100, Simon Horman wrote:
> On Mon, Nov 23, 2009 at 11:37:42AM +0100, Andreas Henriksson wrote:
> > Hello everybody!
> > 
> > This is a desperate attempt at finding people with time and motivation
> > to look into bugs that has been reported against the iproute package
> > in the debian bug tracking system. The reported bugs are usually
> > not Debian-specific...
> > 
> > You'll find the complete list at http://bugs.debian.org/iproute
> > If you have comments, please email them to <bugnumber>@bugs.debian.org
> > 
> > 
> > Here's a list of interesting candidates, hopefully you'll find some useful
> > comments if you follow the link (usually last comment at the bottom):
> > 
> > http://bugs.debian.org/532152 - incorrectly enumerates existing addresses.
> >   iproute: 'ip addr flush' exits with error on first try
> 
> I've taken a stab at this one.
> 

Any feedback?

> To: Andreas Henriksson <andreas@fatal.se>
> Cc: netdev@vger.kernel.org, shemminger@vyatta.com, 532152@bugs.debian.org
> Subject: [rfc] iproute2: flush secondary addresses before primary ones
> Date: Thu, 03 Dec 2009 12:05:55 +1100
> 
> Unless promote_secondaries has been active deleting the primary address of
> an interface will automatically delete all the secondary addresses.
> 
> In the case where ip flush requests the primary then secondary addresses to
> be removed - which is the order the addresses are returned by the kernel -
> this will cause an error as by the time the request to remove a secondary
> address is made it will be missing as it will have been deleted in the
> course of deleting the primary address.
> 
> This approach to solving this problem orders requests for the
> deletion of secondary addresses before primary ones providing
> rtnl_dump_filter_l(), a version of rtnl_dump_filter() that
> iterates over a list of filters. And by providing two specialised
> filters print_addrinfo_secondary() and print_addrinfo_primary().
> 
> rtnl_dump_filter_l() first iterates over all addresses using
> print_addrinfo_secondary(), which appends secondary addresses to the
> request buffer.  Then again using print_addrinfo_primary() which appends
> primary addresses.
> 
> This approach should work regardless of it promote_secondaries is
> active or not. And regardless of if any primary of secondary addresses
> are present or not.
> 
> Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> --- 
> 
>  include/libnetlink.h |   12 +++++++
>  ip/ipaddress.c       |   43 +++++++++++++++++++++++++
>  lib/libnetlink.c     |   84 +++++++++++++++++++++++++++++---------------------
>  3 files changed, 104 insertions(+), 35 deletions(-)
> 
> I'm not sure if this is the right place for this change,
> but this patch seems worth posting for discussion.
> 
> Index: iproute2/lib/libnetlink.c
> ===================================================================
> --- iproute2.orig/lib/libnetlink.c	2009-12-03 09:40:21.000000000 +0900
> +++ iproute2/lib/libnetlink.c	2009-12-03 09:40:26.000000000 +0900
> @@ -172,11 +172,8 @@ int rtnl_dump_request(struct rtnl_handle
>  	return sendmsg(rth->fd, &msg, 0);
>  }
>  
> -int rtnl_dump_filter(struct rtnl_handle *rth,
> -		     rtnl_filter_t filter,
> -		     void *arg1,
> -		     rtnl_filter_t junk,
> -		     void *arg2)
> +int rtnl_dump_filter_l(struct rtnl_handle *rth,
> +		       const struct rtnl_dump_filter_arg *arg)
>  {
>  	struct sockaddr_nl nladdr;
>  	struct iovec iov;
> @@ -191,7 +188,7 @@ int rtnl_dump_filter(struct rtnl_handle 
>  	iov.iov_base = buf;
>  	while (1) {
>  		int status;
> -		struct nlmsghdr *h;
> +		const struct rtnl_dump_filter_arg *a;
>  
>  		iov.iov_len = sizeof(buf);
>  		status = recvmsg(rth->fd, &msg, 0);
> @@ -209,40 +206,45 @@ int rtnl_dump_filter(struct rtnl_handle 
>  			return -1;
>  		}
>  
> -		h = (struct nlmsghdr*)buf;
> -		while (NLMSG_OK(h, status)) {
> -			int err;
> +		for (a = arg; a->filter; a++) {
> +			struct nlmsghdr *h = (struct nlmsghdr*)buf;
>  
> -			if (nladdr.nl_pid != 0 ||
> -			    h->nlmsg_pid != rth->local.nl_pid ||
> -			    h->nlmsg_seq != rth->dump) {
> -				if (junk) {
> -					err = junk(&nladdr, h, arg2);
> -					if (err < 0)
> -						return err;
> +			while (NLMSG_OK(h, status)) {
> +				int err;
> +
> +				if (nladdr.nl_pid != 0 ||
> +				    h->nlmsg_pid != rth->local.nl_pid ||
> +				    h->nlmsg_seq != rth->dump) {
> +					if (a->junk) {
> +						err = a->junk(&nladdr, h,
> +							      a->arg2);
> +						if (err < 0)
> +							return err;
> +					}
> +					goto skip_it;
>  				}
> -				goto skip_it;
> -			}
>  
> -			if (h->nlmsg_type == NLMSG_DONE)
> -				return 0;
> -			if (h->nlmsg_type == NLMSG_ERROR) {
> -				struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
> -				if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
> -					fprintf(stderr, "ERROR truncated\n");
> -				} else {
> -					errno = -err->error;
> -					perror("RTNETLINK answers");
> +				if (h->nlmsg_type == NLMSG_DONE)
> +					return 0;
> +				if (h->nlmsg_type == NLMSG_ERROR) {
> +					struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
> +					if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
> +						fprintf(stderr,
> +							"ERROR truncated\n");
> +					} else {
> +						errno = -err->error;
> +						perror("RTNETLINK answers");
> +					}
> +					return -1;
>  				}
> -				return -1;
> -			}
> -			err = filter(&nladdr, h, arg1);
> -			if (err < 0)
> -				return err;
> +				err = a->filter(&nladdr, h, a->arg1);
> +				if (err < 0)
> +					return err;
>  
>  skip_it:
> -			h = NLMSG_NEXT(h, status);
> -		}
> +				h = NLMSG_NEXT(h, status);
> +			}
> +		} while (0);
>  		if (msg.msg_flags & MSG_TRUNC) {
>  			fprintf(stderr, "Message truncated\n");
>  			continue;
> @@ -254,6 +256,20 @@ skip_it:
>  	}
>  }
>  
> +int rtnl_dump_filter(struct rtnl_handle *rth,
> +		     rtnl_filter_t filter,
> +		     void *arg1,
> +		     rtnl_filter_t junk,
> +		     void *arg2)
> +{
> +	const struct rtnl_dump_filter_arg a[2] = {
> +		{ .filter = filter, .arg1 = arg1, .junk = junk, .arg2 = arg2 },
> +		{ .filter = NULL,   .arg1 = NULL, .junk = NULL, .arg2 = NULL }
> +	};
> +
> +	return rtnl_dump_filter_l(rth, a);
> +}
> +
>  int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
>  	      unsigned groups, struct nlmsghdr *answer,
>  	      rtnl_filter_t junk,
> Index: iproute2/include/libnetlink.h
> ===================================================================
> --- iproute2.orig/include/libnetlink.h	2009-12-03 09:40:21.000000000 +0900
> +++ iproute2/include/libnetlink.h	2009-12-03 09:40:26.000000000 +0900
> @@ -27,10 +27,22 @@ extern int rtnl_dump_request(struct rtnl
>  
>  typedef int (*rtnl_filter_t)(const struct sockaddr_nl *,
>  			     struct nlmsghdr *n, void *);
> +
> +struct rtnl_dump_filter_arg
> +{
> +	rtnl_filter_t filter;
> +	void *arg1;
> +	rtnl_filter_t junk;
> +	void *arg2;
> +};
> +
> +extern int rtnl_dump_filter_l(struct rtnl_handle *rth,
> +			      const struct rtnl_dump_filter_arg *arg);
>  extern int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter,
>  			    void *arg1,
>  			    rtnl_filter_t junk,
>  			    void *arg2);
> +
>  extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
>  		     unsigned groups, struct nlmsghdr *answer,
>  		     rtnl_filter_t junk,
> Index: iproute2/ip/ipaddress.c
> ===================================================================
> --- iproute2.orig/ip/ipaddress.c	2009-12-03 09:40:21.000000000 +0900
> +++ iproute2/ip/ipaddress.c	2009-12-03 09:43:10.000000000 +0900
> @@ -539,6 +539,27 @@ int print_addrinfo(const struct sockaddr
>  	return 0;
>  }
>  
> +int print_addrinfo_primary(const struct sockaddr_nl *who, struct nlmsghdr *n,
> +			   void *arg)
> +{
> +	struct ifaddrmsg *ifa = NLMSG_DATA(n);
> +
> +	if (!ifa->ifa_flags & IFA_F_SECONDARY)
> +		return 0;
> +
> +	return print_addrinfo(who, n, arg);
> +}
> +
> +int print_addrinfo_secondary(const struct sockaddr_nl *who, struct nlmsghdr *n,
> +			     void *arg)
> +{
> +	struct ifaddrmsg *ifa = NLMSG_DATA(n);
> +
> +	if (ifa->ifa_flags & IFA_F_SECONDARY)
> +		return 0;
> +
> +	return print_addrinfo(who, n, arg);
> +}
>  
>  struct nlmsg_list
>  {
> @@ -700,12 +721,32 @@ static int ipaddr_list_or_flush(int argc
>  		filter.flushe = sizeof(flushb);
>  
>  		while (round < MAX_ROUNDS) {
> +			const struct rtnl_dump_filter_arg a[3] = {
> +				{
> +					.filter = print_addrinfo_secondary,
> +					.arg1 = stdout,
> +					.junk = NULL,
> +					.arg2 = NULL
> +				},
> +				{
> +					.filter = print_addrinfo_primary,
> +					.arg1 = stdout,
> +					.junk = NULL,
> +					.arg2 = NULL
> +				},
> +				{
> +					.filter = NULL,
> +					.arg1 = NULL,
> +					.junk = NULL,
> +					.arg2 = NULL
> +				},
> +			};
>  			if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
>  				perror("Cannot send dump request");
>  				exit(1);
>  			}
>  			filter.flushed = 0;
> -			if (rtnl_dump_filter(&rth, print_addrinfo, stdout, NULL, NULL) < 0) {
> +			if (rtnl_dump_filter_l(&rth, a) < 0) {
>  				fprintf(stderr, "Flush terminated\n");
>  				exit(1);
>  			}


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bug#532152: Request for help with iproute2 bugs.
  2009-12-07  3:47   ` Simon Horman
@ 2009-12-07  6:50     ` Andreas Henriksson
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Henriksson @ 2009-12-07  6:50 UTC (permalink / raw)
  To: Simon Horman, 532152; +Cc: netdev, shemminger

On mån, 2009-12-07 at 14:47 +1100, Simon Horman wrote:
> On Thu, Dec 03, 2009 at 12:08:27PM +1100, Simon Horman wrote:
> > On Mon, Nov 23, 2009 at 11:37:42AM +0100, Andreas Henriksson wrote:
> > > http://bugs.debian.org/532152 - incorrectly enumerates existing addresses.
> > >   iproute: 'ip addr flush' exits with error on first try
> > 
> > I've taken a stab at this one.
> > 
> 
> Any feedback?


Looks good to me! Thanks for taking care of this.

Hopefully Stephen does his next round of reviews soon so this (and other
pending patches) gets applied. We'll have to wait and see....

-- 
Regards,
Andreas Henriksson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Request for help with iproute2 bugs.
  2009-12-03  1:08 ` Simon Horman
  2009-12-07  3:47   ` Simon Horman
@ 2009-12-26 18:12   ` Stephen Hemminger
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2009-12-26 18:12 UTC (permalink / raw)
  To: Simon Horman; +Cc: Andreas Henriksson, netdev, 532152

On Thu, 3 Dec 2009 12:08:27 +1100
Simon Horman <horms@verge.net.au> wrote:

> On Mon, Nov 23, 2009 at 11:37:42AM +0100, Andreas Henriksson wrote:
> > Hello everybody!
> > 
> > This is a desperate attempt at finding people with time and motivation
> > to look into bugs that has been reported against the iproute package
> > in the debian bug tracking system. The reported bugs are usually
> > not Debian-specific...
> > 
> > You'll find the complete list at http://bugs.debian.org/iproute
> > If you have comments, please email them to <bugnumber>@bugs.debian.org
> > 
> > 
> > Here's a list of interesting candidates, hopefully you'll find some useful
> > comments if you follow the link (usually last comment at the bottom):
> > 
> > http://bugs.debian.org/532152 - incorrectly enumerates existing addresses.
> >   iproute: 'ip addr flush' exits with error on first try
> 
> I've taken a stab at this one.
> 

applied thanks

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-26 18:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-23 10:37 Request for help with iproute2 bugs Andreas Henriksson
2009-11-23 11:03 ` Patrick McHardy
2009-12-02  0:20   ` Stephen Hemminger
2009-12-03  1:08 ` Simon Horman
2009-12-07  3:47   ` Simon Horman
2009-12-07  6:50     ` Bug#532152: " Andreas Henriksson
2009-12-26 18:12   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).