[723] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Re: Anybody knows BSD 4.3 semantics of SIOCADDRT/DELRT?

daemon@ATHENA.MIT.EDU (Matthias Urlichs)
Tue Jul 18 22:05:41 1995

To: submit-linux-dev-net@ratatosk.yggdrasil.com
From: urlichs@smurf.noris.de (Matthias Urlichs)
Date: 18 Jul 1995 16:13:24 +0200

In linux.dev.net, article <3uen7i$bm@Q.cistron.nl>,
  miquels@cistron.nl (Miquel van Smoorenburg) writes:
> 
> Deleting a route only succeeded when the BSD ip_rt_delete finds an exact
> match. This way, one can first add a new route and then delete the
> old route, whereas you'd get a race condition (no route to host) if
> you do it the other way around.
> 
There's another problem with the Linux code right now: deleting a route
doesn't take any netmask into account. For instance:

10.1.1.0 netmask 255.255.255.0   goes to 10.2.3.4
10.1.1.0 netmask 255.255.255.240 goes to 10.2.3.5
10.1.1.0 netmask 255.255.255.252 goes to 10.2.3.6

it's impossible to delete only one of these beasts; all three are tossed
when I say "route del 10.1.1.0".

> 1. only have one route at any time to a given destination
>    (as in kernel 1.3.9+)
> 2. The 1.3.8 behaviour where an existing route is not deleted if a route
>    with a smaller metric is added (why?). We have to change ip_rt_del to
>    try and match the metric if multiple routes with different metrics
>    to one destination are present.
> 3. Always treat routes with the same destination but different metrics
>    as different routes so you can selectively add / delete them without
>    side effects.

I'd opt for (3), mainly because I want to add checking in the kernel to
verify that packets arrive on the correct interfaces (i.e., if I were to
route something to the address that packet claims to come from, would it go
to that interface)? Now, a packet may legitimately arrive from more than
one interface, so I'd like to have more than one route for that.

The alternate approach would be to create a huge amount of per-device IP
filter rules. This is very ugly, as anybody who actually tries this with
gated-maintained routing tables should know. :-/

I would auto-delete a route when adding another (with the same netmask and
metric, or with the same netmask and destination).

-- 
Our people are warriors, often savage, but we are also many other pleasant
things.
        -- Romulan Commander, "The Enterprise Incident," stardate 5027.3
-- 
Matthias Urlichs        \ XLink-POP Nürnberg  | EMail: urlichs@smurf.noris.de
Schleiermacherstraße 12  \  Unix+Linux+Mac    | Phone: ...please use email.
90491 Nürnberg (Germany)  \   Consulting+Networking+Programming+etc'ing     42
          PGP: 1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE 
      Click <A HREF="http://smurf.noris.de/~urlichs/finger">here</A>.

home help back first fref pref prev next nref lref last post