Netdev List
 help / color / mirror / Atom feed
* Source routing without rules?
@ 2013-08-28  0:16 Andy Lutomirski
  2013-08-28  0:57 ` Brian Haley
  2013-08-28  1:14 ` Hannes Frederic Sowa
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Lutomirski @ 2013-08-28  0:16 UTC (permalink / raw)
  To: Network Development

I'm about to implement a trivial source routing policy for the third
time, and this is IMO stupid.  I want to have two routes to a network.
 Each route should specify a src, and, if the flow matches the src,
then that route should win.

The rules that don't work are:

ip route add <net> via <gw1> dev <dev1> metric 0
ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10

Even if I bind a socket to dev2addr, the outgoing packets go out dev1
to gw1.  This is exactly what I don't want to have happen.

This would fix it:

ip route add <net> via <gw1> dev <dev1> src <dev1addr> metric 0 match_src
ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10

The semantics of match_src would be that, if set, the route only
matches if the flow has no assigned source address or if the assigned
source address matches.

(Also, if SO_BINDTODEVICE didn't require privilege, that would already
work.  Should there be a sysctl to allow anyone to use
SO_BINDTODEVICE?)

--Andy

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

end of thread, other threads:[~2013-08-28  1:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28  0:16 Source routing without rules? Andy Lutomirski
2013-08-28  0:57 ` Brian Haley
2013-08-28  1:29   ` Andy Lutomirski
2013-08-28  1:14 ` Hannes Frederic Sowa
2013-08-28  1:46   ` Andy Lutomirski
2013-08-28  1:51     ` Hannes Frederic Sowa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox