netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IPV6_RTHDR with a type-0 routing header
@ 2009-08-20 11:11 Steinar H. Gunderson
  2009-08-20 11:29 ` Jens Rosenboom
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Steinar H. Gunderson @ 2009-08-20 11:11 UTC (permalink / raw)
  To: brian.haley, davem; +Cc: netdev, shanwei

Hi,

I've tried attaching a type-0 routing header to my IPv6 packets with
setsockopt(..., IPV6_RTHDR, ...), but the kernel just returns EINVAL.
looking at the source, it seems it simply refuses anything that's not type-2;
should that really be right? I found the following commit:

  http://kerneltrap.org/mailarchive/linux-netdev/2008/11/11/4064594

However, it only seems to change EPERM into EINVAL. I don't see any
reasonable explanation why it should not be simply success; in fact, RFC 3452
only seems to talk about using type-0 headers with this option.

Any ideas?

/* Steinar */
-- 
Homepage: http://www.sesse.net/

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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 11:11 IPV6_RTHDR with a type-0 routing header Steinar H. Gunderson
@ 2009-08-20 11:29 ` Jens Rosenboom
  2009-08-20 11:29 ` Rémi Denis-Courmont
  2009-08-21  1:09 ` Shan Wei
  2 siblings, 0 replies; 9+ messages in thread
From: Jens Rosenboom @ 2009-08-20 11:29 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: brian.haley, davem, netdev, shanwei

On Thu, 2009-08-20 at 13:11 +0200, Steinar H. Gunderson wrote:
> Hi,
> 
> I've tried attaching a type-0 routing header to my IPv6 packets with
> setsockopt(..., IPV6_RTHDR, ...), but the kernel just returns EINVAL.
> looking at the source, it seems it simply refuses anything that's not type-2;
> should that really be right? I found the following commit:
> 
>   http://kerneltrap.org/mailarchive/linux-netdev/2008/11/11/4064594
> 
> However, it only seems to change EPERM into EINVAL. I don't see any
> reasonable explanation why it should not be simply success; in fact, RFC 3452
> only seems to talk about using type-0 headers with this option.
> 
> Any ideas?

How about RFC5095?


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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 11:11 IPV6_RTHDR with a type-0 routing header Steinar H. Gunderson
  2009-08-20 11:29 ` Jens Rosenboom
@ 2009-08-20 11:29 ` Rémi Denis-Courmont
  2009-08-20 12:18   ` Steinar H. Gunderson
  2009-08-21  1:09 ` Shan Wei
  2 siblings, 1 reply; 9+ messages in thread
From: Rémi Denis-Courmont @ 2009-08-20 11:29 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: netdev


On Thu, 20 Aug 2009 13:11:52 +0200, "Steinar H. Gunderson"
<sgunderson@bigfoot.com> wrote:
> I've tried attaching a type-0 routing header to my IPv6 packets with
> setsockopt(..., IPV6_RTHDR, ...), but the kernel just returns EINVAL.
> looking at the source, it seems it simply refuses anything that's not
> type-2;
> should that really be right? I found the following commit:

RT0 headers have been deprecated by IETF. The kernel refuses to use then on
purpose.

-- 
Rémi Denis-Courmont


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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 11:29 ` Rémi Denis-Courmont
@ 2009-08-20 12:18   ` Steinar H. Gunderson
  2009-08-20 12:39     ` Steinar H. Gunderson
  0 siblings, 1 reply; 9+ messages in thread
From: Steinar H. Gunderson @ 2009-08-20 12:18 UTC (permalink / raw)
  To: Rémi Denis-Courmont; +Cc: netdev

On Thu, Aug 20, 2009 at 01:29:09PM +0200, Rémi Denis-Courmont wrote:
>> I've tried attaching a type-0 routing header to my IPv6 packets with
>> setsockopt(..., IPV6_RTHDR, ...), but the kernel just returns EINVAL.
>> looking at the source, it seems it simply refuses anything that's not
>> type-2;
>> should that really be right? I found the following commit:
> RT0 headers have been deprecated by IETF. The kernel refuses to use then on
> purpose.

Hm, OK. And no replacement has been proposed, the deprecation RFC just refers
to "future routing headers"...

/* Steinar */
-- 
Homepage: http://www.sesse.net/

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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 12:18   ` Steinar H. Gunderson
@ 2009-08-20 12:39     ` Steinar H. Gunderson
  2009-08-20 12:53       ` Jens Rosenboom
  0 siblings, 1 reply; 9+ messages in thread
From: Steinar H. Gunderson @ 2009-08-20 12:39 UTC (permalink / raw)
  To: Rémi Denis-Courmont; +Cc: netdev

On Thu, Aug 20, 2009 at 02:18:20PM +0200, Steinar H. Gunderson wrote:
> Hm, OK. And no replacement has been proposed, the deprecation RFC just refers
> to "future routing headers"...

It looks like I can use destination options instead, but those don't seem to
be too easy to use either. The kernel seems to demand that I put eight bytes
of padding at the end?

  #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)

Why the +1? 

FWIW, the program I try to run is at http://home.samfundet.no/~sesse/v6fun.c .
If I replace "len" in the setsockopt call by "len + 8", the program runs and
the packets get the right option attached -- but also eight padding bytes.
 
/* Steinar */
-- 
Homepage: http://www.sesse.net/

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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 12:39     ` Steinar H. Gunderson
@ 2009-08-20 12:53       ` Jens Rosenboom
  2009-08-20 13:00         ` Steinar H. Gunderson
  0 siblings, 1 reply; 9+ messages in thread
From: Jens Rosenboom @ 2009-08-20 12:53 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: Rémi Denis-Courmont, netdev

On Thu, 2009-08-20 at 14:39 +0200, Steinar H. Gunderson wrote:
> On Thu, Aug 20, 2009 at 02:18:20PM +0200, Steinar H. Gunderson wrote:
> > Hm, OK. And no replacement has been proposed, the deprecation RFC just refers
> > to "future routing headers"...
> 
> It looks like I can use destination options instead, but those don't seem to
> be too easy to use either. The kernel seems to demand that I put eight bytes
> of padding at the end?
> 
>   #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)
> 
> Why the +1? 

Because that matches the definition of the hdrlen field in RFC2460.

> FWIW, the program I try to run is at http://home.samfundet.no/~sesse/v6fun.c .
> If I replace "len" in the setsockopt call by "len + 8", the program runs and
> the packets get the right option attached -- but also eight padding bytes.

ERROR 404: Not Found.


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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 12:53       ` Jens Rosenboom
@ 2009-08-20 13:00         ` Steinar H. Gunderson
  2009-08-20 13:11           ` Steinar H. Gunderson
  0 siblings, 1 reply; 9+ messages in thread
From: Steinar H. Gunderson @ 2009-08-20 13:00 UTC (permalink / raw)
  To: Jens Rosenboom; +Cc: Rémi Denis-Courmont, netdev

On Thu, Aug 20, 2009 at 02:53:44PM +0200, Jens Rosenboom wrote:
>> It looks like I can use destination options instead, but those don't seem to
>> be too easy to use either. The kernel seems to demand that I put eight bytes
>> of padding at the end?
>> 
>>   #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)
>> 
>> Why the +1? 
> Because that matches the definition of the hdrlen field in RFC2460.

Hm, in that case I guess it's glibc that has one too much indeed (I never
write this field).

>> FWIW, the program I try to run is at http://home.samfundet.no/~sesse/v6fun.c .
>> If I replace "len" in the setsockopt call by "len + 8", the program runs and
>> the packets get the right option attached -- but also eight padding bytes.
> ERROR 404: Not Found.

Sorry, http://home.samfundet.no/~sesse/v6opt.c

/* Steinar */
-- 
Homepage: http://www.sesse.net/

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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 13:00         ` Steinar H. Gunderson
@ 2009-08-20 13:11           ` Steinar H. Gunderson
  0 siblings, 0 replies; 9+ messages in thread
From: Steinar H. Gunderson @ 2009-08-20 13:11 UTC (permalink / raw)
  To: Jens Rosenboom; +Cc: Rémi Denis-Courmont, netdev

On Thu, Aug 20, 2009 at 03:00:09PM +0200, Steinar H. Gunderson wrote:
>> Because that matches the definition of the hdrlen field in RFC2460.
> Hm, in that case I guess it's glibc that has one too much indeed (I never
> write this field).

Yes indeed. It's fixed in more recent glibc:

   [BZ #5760]
   * inet/inet6_opt.c (inet6_opt_init): Fix ip6h_len computation.
   Patch by Roland Bless <roland@bless.de>.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

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

* Re: IPV6_RTHDR with a type-0 routing header
  2009-08-20 11:11 IPV6_RTHDR with a type-0 routing header Steinar H. Gunderson
  2009-08-20 11:29 ` Jens Rosenboom
  2009-08-20 11:29 ` Rémi Denis-Courmont
@ 2009-08-21  1:09 ` Shan Wei
  2 siblings, 0 replies; 9+ messages in thread
From: Shan Wei @ 2009-08-21  1:09 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: brian.haley, davem, netdev

Steinar H. Gunderson wrote, at 08/20/2009 07:11 PM:
> Hi,
> 
> I've tried attaching a type-0 routing header to my IPv6 packets with
> setsockopt(..., IPV6_RTHDR, ...), but the kernel just returns EINVAL.
> looking at the source, it seems it simply refuses anything that's not type-2;
> should that really be right? I found the following commit:
> 
>   http://kerneltrap.org/mailarchive/linux-netdev/2008/11/11/4064594
> 
> However, it only seems to change EPERM into EINVAL. I don't see any

About the cause of changing EPERM into EINVAL, can refer to 
http://marc.info/?l=linux-netdev&m=122046709502496&w=3.

-- 
Best Regards
Shan Wei

> reasonable explanation why it should not be simply success; in fact, RFC 3452
> only seems to talk about using type-0 headers with this option.
> 
> Any ideas?
> 
> /* Steinar */


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

end of thread, other threads:[~2009-08-21  1:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-20 11:11 IPV6_RTHDR with a type-0 routing header Steinar H. Gunderson
2009-08-20 11:29 ` Jens Rosenboom
2009-08-20 11:29 ` Rémi Denis-Courmont
2009-08-20 12:18   ` Steinar H. Gunderson
2009-08-20 12:39     ` Steinar H. Gunderson
2009-08-20 12:53       ` Jens Rosenboom
2009-08-20 13:00         ` Steinar H. Gunderson
2009-08-20 13:11           ` Steinar H. Gunderson
2009-08-21  1:09 ` Shan Wei

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).