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 08/02/2019 19:16, David Young wrote:
On Fri, Feb 08, 2019 at 05:19:40PM +0000, Roy Marples wrote:
Hi List

Whilst traking down a dhcpcd issue for Jared it occured to me that
my use of IP_PKTINFO might not be ideal for NetBSD. Here's the
scenario:

interface a: 192.168.0.101/24
interface b: 192.168.0.102/24

The route to 192.168.0.255 belongs on interface a.

If I send a UDP packet to 192.168.0.1 it will by default leave by
interface a.
My question is this - should IP_PKTINFO allow the same message to
leave by interface b - ie effectively bypassing the routing table?

I think so, but I think that if you want to send a packet that both has
a particular source address and transmits on a particular interface,
IP_PKTINFO may not be adequate?

Well, our implementation of it is not adequate as it stands, especially if you share the same address across interfaces.

I suppose it's also a security question because a non privileged process can set IP_PKTINFO but only root can create routes. It's works on Linux (my primary use case) because each interface address has it's own prefix route and the lowest metric wins. Root has already created the routes, so it's an expression of choice.

Roy


Home | Main Index | Thread Index | Old Index