All of lore.kernel.org
 help / color / mirror / Atom feed
* iproute2: silence errors about kernel missing 6rd on "ip tun show".
@ 2010-03-31  8:08 Andreas Henriksson
  2010-03-31 23:06 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Henriksson @ 2010-03-31  8:08 UTC (permalink / raw)
  To: shemminger, Alexandre Cassen; +Cc: 575970, netdev

Hello!

As reported in http://bugs.debian.org/575970 there is currently a warning
printed for every tunnel when using latest iproute2 on atleast <= 2.6.32
kernels (missing 6rd?!).

The attached patch avoids perror when errno is EINVAL, which I assume
is the way to detect missing 6rd support. A better/cleaner
method to detect and avoid 6rd when there's no kernel support
is more then welcome.

Regards,
Andreas Henriksson


diff --git a/ip/tunnel.c b/ip/tunnel.c
index d389e86..bbb60bf 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -29,6 +29,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#include <errno.h>
 #include <netinet/in.h>
 #include <linux/if.h>
 #include <linux/ip.h>
@@ -168,7 +169,7 @@ int tnl_del_ioctl(const char *basedev, const char *name, void *p)
 	return err;
 }
 
-static int tnl_gen_ioctl(int cmd, const char *name, void *p)
+static int tnl_gen_ioctl(int cmd, const char *name, void *p, int quiet)
 {
 	struct ifreq ifr;
 	int fd;
@@ -178,7 +179,7 @@ static int tnl_gen_ioctl(int cmd, const char *name, void *p)
 	ifr.ifr_ifru.ifru_data = p;
 	fd = socket(preferred_family, SOCK_DGRAM, 0);
 	err = ioctl(fd, cmd, &ifr);
-	if (err)
+	if (err && !quiet)
 		perror("ioctl");
 	close(fd);
 	return err;
@@ -186,15 +187,18 @@ static int tnl_gen_ioctl(int cmd, const char *name, void *p)
 
 int tnl_prl_ioctl(int cmd, const char *name, void *p)
 {
-	return tnl_gen_ioctl(cmd, name, p);
+	return tnl_gen_ioctl(cmd, name, p, 0);
 }
 
 int tnl_6rd_ioctl(int cmd, const char *name, void *p)
 {
-	return tnl_gen_ioctl(cmd, name, p);
+	return tnl_gen_ioctl(cmd, name, p, 0);
 }
 
 int tnl_ioctl_get_6rd(const char *name, void *p)
 {
-	return tnl_gen_ioctl(SIOCGET6RD, name, p);
+	int err = tnl_gen_ioctl(SIOCGET6RD, name, p, 1);
+	if (err && errno != EINVAL)
+		perror("ioctl");
+	return err;
 }

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

* Re: iproute2: silence errors about kernel missing 6rd on "ip tun show".
  2010-03-31  8:08 iproute2: silence errors about kernel missing 6rd on "ip tun show" Andreas Henriksson
@ 2010-03-31 23:06 ` Stephen Hemminger
  2010-04-04 20:23   ` Bug#575970: " Alexandre Cassen
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2010-03-31 23:06 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: Alexandre Cassen, 575970, netdev

On Wed, 31 Mar 2010 10:08:54 +0200
Andreas Henriksson <andreas@fatal.se> wrote:

> Hello!
> 
> As reported in http://bugs.debian.org/575970 there is currently a warning
> printed for every tunnel when using latest iproute2 on atleast <= 2.6.32
> kernels (missing 6rd?!).
> 
> The attached patch avoids perror when errno is EINVAL, which I assume
> is the way to detect missing 6rd support. A better/cleaner
> method to detect and avoid 6rd when there's no kernel support
> is more then welcome.
> 
> Regards,
> Andreas Henriksson
> 

I will wait (a little while) to see if Alexandre has a preferred alternative.

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

* Bug#575970: iproute2: silence errors about kernel missing 6rd on "ip tun show".
  2010-03-31 23:06 ` Stephen Hemminger
@ 2010-04-04 20:23   ` Alexandre Cassen
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Cassen @ 2010-04-04 20:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Andreas Henriksson, 575970, netdev

Hello,

On Wed, 31 Mar 2010, Stephen Hemminger wrote:
> On Wed, 31 Mar 2010 10:08:54 +0200
> Andreas Henriksson <andreas@fatal.se> wrote:
>
>> Hello!
>>
>> As reported in http://bugs.debian.org/575970 there is currently a warning
>> printed for every tunnel when using latest iproute2 on atleast <= 2.6.32
>> kernels (missing 6rd?!).
>>
>> The attached patch avoids perror when errno is EINVAL, which I assume
>> is the way to detect missing 6rd support. A better/cleaner
>> method to detect and avoid 6rd when there's no kernel support
>> is more then welcome.
>>
>> Regards,
>> Andreas Henriksson
>>
>
> I will wait (a little while) to see if Alexandre has a preferred alternative.


IMHO, the proper way to detect 6rd kernel missing support is to catch 
EINVAL, but not others errno since they might be usefull in some case.

Reading the code again, there is also a need to test tunnel protocol since 
6rd scope is ipv6/ip only.

I will send another email with a proposed patch to fix those 2 issues.

Regs,
Alexandre

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

end of thread, other threads:[~2010-04-04 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-31  8:08 iproute2: silence errors about kernel missing 6rd on "ip tun show" Andreas Henriksson
2010-03-31 23:06 ` Stephen Hemminger
2010-04-04 20:23   ` Bug#575970: " Alexandre Cassen

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.