netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1
@ 2007-03-19 15:11 Pekka Savola
  2007-03-19 15:20 ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Pekka Savola @ 2007-03-19 15:11 UTC (permalink / raw)
  To: netdev

Hi,

On kernel based on 2.6.20.3-rc1 (FC6), 'ip -6 r l' shows:

default via fe80::212:f0ff:fe5f:c4ec dev eth1  proto kernel  metric 1024  expires 7191sec mtu 1500 advmss 1440 hoplimit 4294967295

(this is the same with iproute2-ss061214 and iproute2-ss070313.)

So, it seems that the data length for hoplimit is not quite right, or 
it's reported as 2^32-1 instead of 2^8-1...

-- 
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings

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

* Re: 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1
  2007-03-19 15:11 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1 Pekka Savola
@ 2007-03-19 15:20 ` Patrick McHardy
  2007-03-19 15:27   ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2007-03-19 15:20 UTC (permalink / raw)
  To: Pekka Savola; +Cc: netdev

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

Pekka Savola wrote:
> On kernel based on 2.6.20.3-rc1 (FC6), 'ip -6 r l' shows:
> 
> default via fe80::212:f0ff:fe5f:c4ec dev eth1  proto kernel  metric
> 1024  expires 7191sec mtu 1500 advmss 1440 hoplimit 4294967295
> 
> (this is the same with iproute2-ss061214 and iproute2-ss070313.)
> 
> So, it seems that the data length for hoplimit is not quite right, or
> it's reported as 2^32-1 instead of 2^8-1...


Does this fix it?

Signed-off-by: Patrick McHardy <kaber@trash.net>

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

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0e1f4b2..ec347e5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1216,7 +1216,7 @@ install_route:
 	}
 
 	if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0)
-		rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1;
+		rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255;
 	if (!rt->u.dst.metrics[RTAX_MTU-1])
 		rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev);
 	if (!rt->u.dst.metrics[RTAX_ADVMSS-1])
@@ -1821,7 +1821,7 @@ struct rt6_info *addrconf_dst_alloc(stru
 	rt->rt6i_idev = idev;
 	rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev);
 	rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst));
-	rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1;
+	rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255;
 	rt->u.dst.obsolete = -1;
 
 	rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP;

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

* Re: 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1
  2007-03-19 15:20 ` Patrick McHardy
@ 2007-03-19 15:27   ` Patrick McHardy
  2007-03-19 19:18     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2007-03-19 15:27 UTC (permalink / raw)
  To: Pekka Savola; +Cc: netdev

Patrick McHardy wrote:
> Pekka Savola wrote:
> 
>>On kernel based on 2.6.20.3-rc1 (FC6), 'ip -6 r l' shows:
>>
>>default via fe80::212:f0ff:fe5f:c4ec dev eth1  proto kernel  metric
>>1024  expires 7191sec mtu 1500 advmss 1440 hoplimit 4294967295
>>
>>(this is the same with iproute2-ss061214 and iproute2-ss070313.)
>>
>>So, it seems that the data length for hoplimit is not quite right, or
>>it's reported as 2^32-1 instead of 2^8-1...
> 
> 
> 
> Does this fix it?


Mhh actually this looks intentional:

icmpv6_send and some other output functions do:
	int hlimit;
...
        if (hlimit < 0)
                hlimit = dst_metric(dst, RTAX_HOPLIMIT);
        if (hlimit < 0)
                hlimit = ipv6_get_hoplimit(dst->dev);


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

* Re: 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1
  2007-03-19 15:27   ` Patrick McHardy
@ 2007-03-19 19:18     ` David Miller
  2007-03-20  8:27       ` Pekka Savola
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2007-03-19 19:18 UTC (permalink / raw)
  To: kaber; +Cc: pekkas, netdev

From: Patrick McHardy <kaber@trash.net>
Date: Mon, 19 Mar 2007 16:27:29 +0100

> Mhh actually this looks intentional:
> 
> icmpv6_send and some other output functions do:
> 	int hlimit;
> ...
>         if (hlimit < 0)
>                 hlimit = dst_metric(dst, RTAX_HOPLIMIT);
>         if (hlimit < 0)
>                 hlimit = ipv6_get_hoplimit(dst->dev);

Yep, negative value has a specific meaning.


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

* Re: 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1
  2007-03-19 19:18     ` David Miller
@ 2007-03-20  8:27       ` Pekka Savola
  2007-03-20  8:39         ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 6+ messages in thread
From: Pekka Savola @ 2007-03-20  8:27 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netdev

On Mon, 19 Mar 2007, David Miller wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Mon, 19 Mar 2007 16:27:29 +0100
>
>> Mhh actually this looks intentional:
>>
>> icmpv6_send and some other output functions do:
>> 	int hlimit;
>> ...
>>         if (hlimit < 0)
>>                 hlimit = dst_metric(dst, RTAX_HOPLIMIT);
>>         if (hlimit < 0)
>>                 hlimit = ipv6_get_hoplimit(dst->dev);
>
> Yep, negative value has a specific meaning.

Which seems to indicate that the kernel-internal implementation has a 
need to store a negative TTL.  Reporting it to the userspace as a 
negative doesn't seem right though?

-- 
Pekka Savola                 "You each name yourselves king, yet the
Netcore Oy                    kingdom bleeds."
Systems. Networks. Security. -- George R.R. Martin: A Clash of Kings

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

* Re: 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1
  2007-03-20  8:27       ` Pekka Savola
@ 2007-03-20  8:39         ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 0 replies; 6+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-03-20  8:39 UTC (permalink / raw)
  To: pekkas; +Cc: davem, kaber, netdev, yoshfuji

In article <Pine.LNX.4.64.0703201026300.25136@netcore.fi> (at Tue, 20 Mar 2007 10:27:51 +0200 (EET)), Pekka Savola <pekkas@netcore.fi> says:

> On Mon, 19 Mar 2007, David Miller wrote:
> > From: Patrick McHardy <kaber@trash.net>
> > Date: Mon, 19 Mar 2007 16:27:29 +0100
> >
> >> Mhh actually this looks intentional:
> >>
> >> icmpv6_send and some other output functions do:
> >> 	int hlimit;
> >> ...
> >>         if (hlimit < 0)
> >>                 hlimit = dst_metric(dst, RTAX_HOPLIMIT);
> >>         if (hlimit < 0)
> >>                 hlimit = ipv6_get_hoplimit(dst->dev);
> >
> > Yep, negative value has a specific meaning.
> 
> Which seems to indicate that the kernel-internal implementation has a 
> need to store a negative TTL.  Reporting it to the userspace as a 
> negative doesn't seem right though?

I think it is better to fix iproute2 instead, 1) to treat the variable as 
int, or, 2) not to show such variable.

--yoshfuji

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

end of thread, other threads:[~2007-03-20  8:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-19 15:11 2.6.20.3-rc1 / iproute2 hoplimit 2^32-1 vs 2^8-1 Pekka Savola
2007-03-19 15:20 ` Patrick McHardy
2007-03-19 15:27   ` Patrick McHardy
2007-03-19 19:18     ` David Miller
2007-03-20  8:27       ` Pekka Savola
2007-03-20  8:39         ` YOSHIFUJI Hideaki / 吉藤英明

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