All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ip neigh: device is optional for proxy entries
@ 2015-11-30 22:17 Konstantin Khlebnikov
  2015-12-10 17:06 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Khlebnikov @ 2015-11-30 22:17 UTC (permalink / raw)
  To: netdev

Though dumping such entries crashes present kernels.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 ip/ipneigh.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index 54655842ed38..92b7cd6f2a75 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -100,8 +100,9 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
 		struct ndmsg		ndm;
 		char  			buf[256];
 	} req;
-	char  *d = NULL;
+	char  *dev = NULL;
 	int dst_ok = 0;
+	int dev_ok = 0;
 	int lladdr_ok = 0;
 	char * lla = NULL;
 	inet_prefix dst;
@@ -135,10 +136,12 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
 				duparg("address", *argv);
 			get_addr(&dst, *argv, preferred_family);
 			dst_ok = 1;
+			dev_ok = 1;
 			req.ndm.ndm_flags |= NTF_PROXY;
 		} else if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();
-			d = *argv;
+			dev = *argv;
+			dev_ok = 1;
 		} else {
 			if (strcmp(*argv, "to") == 0) {
 				NEXT_ARG();
@@ -153,7 +156,7 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
 		}
 		argc--; argv++;
 	}
-	if (d == NULL || !dst_ok || dst.family == AF_UNSPEC) {
+	if (!dev_ok || !dst_ok || dst.family == AF_UNSPEC) {
 		fprintf(stderr, "Device and destination are required arguments.\n");
 		exit(-1);
 	}
@@ -175,8 +178,8 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv)
 
 	ll_init_map(&rth);
 
-	if ((req.ndm.ndm_ifindex = ll_name_to_index(d)) == 0) {
-		fprintf(stderr, "Cannot find device \"%s\"\n", d);
+	if (dev && (req.ndm.ndm_ifindex = ll_name_to_index(dev)) == 0) {
+		fprintf(stderr, "Cannot find device \"%s\"\n", dev);
 		return -1;
 	}
 

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

* Re: [PATCH] ip neigh: device is optional for proxy entries
  2015-11-30 22:17 [PATCH] ip neigh: device is optional for proxy entries Konstantin Khlebnikov
@ 2015-12-10 17:06 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2015-12-10 17:06 UTC (permalink / raw)
  To: Konstantin Khlebnikov; +Cc: netdev

On Tue, 01 Dec 2015 01:17:06 +0300
Konstantin Khlebnikov <koct9i@gmail.com> wrote:

> Though dumping such entries crashes present kernels.
> 
> Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>

Applied thanks, but I nobody will use it until after your
kernel patch makes it to stable.

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

end of thread, other threads:[~2015-12-10 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-30 22:17 [PATCH] ip neigh: device is optional for proxy entries Konstantin Khlebnikov
2015-12-10 17:06 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.