Presumably in these "don't rely on routing" cases the application
would set SO_DONTROUTE or MSG_DONTROUTE.
If this flag were set, I wouldn't argue with insisting that the
message goes out the interface specified in ifi_ifindex.
But if not, what then...
There remains the fact that the only documentation I can find about
this(*) describes ifi_ifindex as the interface that a message
*arrived* on, and when specified in a sendmsg call, it is information
about the message that we are replying to. Interpreting this to mean
that the reply *must* go out that interface still seems wrong to me.
Do you agree which that definition of IP_PKTINFO? If not, can you
show me some documentation which supports your position?
(*) I looked in the Single Unix Specification and it doesn't mention
PKTINFO at all. I looked in the RFC's mentioned at the bottom of
"man 7 ip"
(RPC1122 and 1812) and they don't say anything about specifying an
interface for outgoing messages - only specifying a source address.
> I do no see how it is possible to classify a middle way as "rational".
> Well, and frankly speaking I do not see how it could be useful.
The "middle way" is that we do want to rely on routing tables (as we
have not set MSG_DONTROUTE) but that the routing tables do not give a
unique route to some addresses - as is certainly possible and even
encouraged by RFC1122 (end of discussion of Strong ES model in
With reliable routing that provides multiple routes in some cases, it
seems reasonable, even rational, to accept hints from the application
as to which interface to use.
As for "useful", it is more that I cannot see how the current
behaviour is useful - i.e. how can be used meaningfully by an
The particular behaviour is:
If MSG_DONTROUTE is not set, but a non-zero ifi_ifindex is given
If there is a known route to the destination address through that
interface, then use that route.
If there is no route through that interface to the destination
address, then treat it as a link-local address.
When would an application actually want that behaviour?
My current approach to 'fixing' what I perceive as the 'problem' would
be one of:
1/ if no route is found out the interface, return ENETUNREACH (not
that ENETUNREACH is listed in the man page for sendmsg :-( )
Also change to documentation to make the intent more explicit.
This would make my current problem clearly an application error and
I could take it to the maintainers of glibc.
2/ If MSG_DONTROUTE is not set, then ignore the value passed in
This would slightly weaken the applications options for
controlling routing, but I don't think the weakening would be
3/ Treat the ifi_ifindex as a hint if MSG_DONTROUTE isn't set. This
would be much more invasive to the code, and it is not clear that
the extra control it provides is needed in practice.
Thank you for your frankness,
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/