From: "Rémi Denis-Courmont" <rdenis@simphalempin.com>
To: Brian Haley <brian.haley@hp.com>
Cc: Andrew Morton <akpm@osdl.org>, netdev@vger.kernel.org
Subject: Re: Fw: [Bugme-new] [Bug 7665] New: getsockopt(IPV6_*CAST_HOPS) returns -1
Date: Tue, 12 Dec 2006 09:08:14 +0100 [thread overview]
Message-ID: <200612120908.19378@auguste.remlab.net> (raw)
In-Reply-To: <457DD3EB.9030201@hp.com>
Hello,
Le lundi 11 décembre 2006 22:55, Brian Haley a écrit :
> Andrew Morton wrote:
> > Where fd is a socket (datagram or raw) with IPv6 protocol family,
> > getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, ...) succeeds, but
> > the returned hop limit is -1. connect()'ing the socket first does
> > not solve the problem.
>
> An IPv6 socket's hoplimit value is not set at creation time, instead,
> the hoplimit in an outgoing packet is set dynamically at transmit
> time to one of the following (in this order):
>
> 1. Hoplimit route metric (if set)
> 2. Outgoing interface value (/proc/sys/net/ipv6/conf/ethX/hop_limit)
> 3. Global IPv6 value (/proc/sys/net/ipv6/conf/all/hop_limit)
>
> A setsockopt() value *will* override this.
Relevant standard (RFC 3493) notes:
The IPV6_UNICAST_HOPS option may be used with getsockopt() to
determine the hop limit value that the system will use for subsequent
unicast packets sent via that socket.
I don't reckon -1 could be the hop limit value. IMHO, the value from
case 1 (if socket is connected to some destination), otherwise case 2
(if bound to a scope interface) or ultimately the default hop limit
ought to be returned instead, as it will be most often correct, while
the current behavior is always wrong, unless setsockopt() has been used
first. I don't if some people may think doing a route lookup in
getsockopt might be overly expensive, but at least the two other cases
should be ok, particularly the last one.
--
Rémi Denis-Courmont
next prev parent reply other threads:[~2006-12-12 8:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-11 17:56 Fw: [Bugme-new] [Bug 7665] New: getsockopt(IPV6_*CAST_HOPS) returns -1 Andrew Morton
2006-12-11 21:55 ` Brian Haley
2006-12-12 8:08 ` Rémi Denis-Courmont [this message]
2006-12-12 21:16 ` Brian Haley
2006-12-12 22:38 ` Rémi Denis-Courmont
2006-12-13 1:11 ` David Miller
2006-12-13 17:28 ` Brian Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200612120908.19378@auguste.remlab.net \
--to=rdenis@simphalempin.com \
--cc=akpm@osdl.org \
--cc=brian.haley@hp.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).