tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: IP_PKTINFO, sendmsg(2) and routing.



On Thu, Feb 14, 2019 at 02:12:11AM +0000, Roy Marples wrote:
> On 12/02/2019 17:39, David Young wrote:
> >On Tue, Feb 12, 2019 at 11:10:28AM +0000, Roy Marples wrote:
> >>On 08/02/2019 22:50, Dennis Ferguson wrote:
> >>>It should send the packet out the IP_PKTINFO interface if packet is sent
> >>>with MSG_DONTROUTE/SO_DONTROUTE. If this isn’t working it should probably
> >>>be made to, routing protocols in general depend on being able to do that.
> >>
> >>I don't see how the two are related.
> >>Routing can still be obeyed to an extent.
> >>Consider the following
> >>
> >>Interface A has 192.168.0.1/24
> >>Interface B has 192.168.0.2/24
> >>The subnet 192.168/24 belongs to interface A
> >>There is a default route to 192.168.0.10, again on interface A
> >>
> >>If I sent a packet to 1.2.3.4 and IP_PKTINFO says use interface B I
> >>would expect the packet to be sent to the default router of
> >>192.168.0.10 but exit via interface B and not interface A.
> >
> >If you don't use _DONTROUTE, then I would *hope* for the transmission to
> >fail with an error, probably EHOSTUNREACH, if 1.2.3.4 has no route on
> >interface B.  However, today I sort of *expect* for the transmission to
> >go out interface A, since the nexthop and its link-layer information are
> >on interface A.
> 
> So what benefit does IP_PKTINFO bring us for sending exactly?
> Because you've just ruled out the use case I tried to illustrate here:
> https://mail-index.netbsd.org/tech-net/2019/02/11/msg007254.html

If you want to send a packet to the directly-connected host
192.168.0.10, and subnets containing 192.168.0.10 are configured on
multiple interfaces, then IP_PKTINFO lets you choose a different
interface than the system default.

I don't know why you would ever use IP_PKTINFO for a destination
that is *not* on a directly-connected subnet (1.2.3.4 in your example).
Is that something you really need to do?

If 192.168.0.0/24 is assigned to interfaces A and B but not to interface
C, the nexthop for 1.2.3.4 is 192.168.0.10, and a program uses
IP_PKTINFO to try to send to 1.2.3.4 over interface C, then what do you
think should happen?  Consider a couple of cases: 1) interface C is a
point-to-point link, 2) it is a broadcast link.

Dave

-- 
David Young
dyoung%pobox.com@localhost    Urbana, IL    (217) 721-9981


Home | Main Index | Thread Index | Old Index