Subject: Your proposed changes to route flush/route flushall
To: None <firstname.lastname@example.org>
From: Bill Sommerfeld <email@example.com>
Date: 02/20/1997 15:37:01
Greg Hudson recently opened NetBSD PR#3227, with some changes from you
which added a "flushall" command to `route', and changed the behavor
of `route flush' to also delete routes flagged with RTM_STATIC and
I assume that the problem you're attempting to address is the problem
of mobile hosts which disconnect and reconnect with different
addresses, or which use the same address through different interfaces
(e.g., either over ethernet or PPP with the PPP server doing
proxy-arp), but I'm not sure that this change is necessarily the right
way to do this.
- `flushall' is a very big hammer, as I believe it makes all
currently-up interfaces unusable until they're brought down and back
- I can understand why you want to take out RTM_LLINFO routes, but
why RTM_STATIC? Do you have any routes which are RTM_STATIC but which
*aren't* also RTM_GATEWAY or RTM_LLINFO?
Let's look a little closer at what's in the routing table on a typical
% route -n show
Destination Gateway Flags
default 188.8.131.52 UG /* 1 */
184.108.40.206 link#1 U /* 2 */
220.127.116.11 0:60:70:2d:90:20 UH /* 3 */
127.0.0.1 127.0.0.1 UH /* 4 */
Now, of these,
/* 4 */ was added by the ifconfig of lo0
/* 2 */ was added by the ifconfig of ep0
/* 1 */ was added by "route add default ..."
/* 3 */ was added by ARP (the ethernet address of the default gateway)
The existing "route flush" will delete only route 1.
4 and 2 can be deleted by an "ifconfig xx0 down; ifconfig xx0 delete"
of the appropriate interfaces; I'd argue that you probably *don't*
want to delete the localhost route. I don't think you really want to
delete these unless you're taking the interface off the air, so I
think deletion of these is best left for ifconfig...
So, this leaves the RTM_LLINFO (ARP) entries..
There's currently no *good* way to flush entries added via ARP; my
current laptop configuration does something, well, kludgy (a loop in a
shellscript calling `arp -d').
I can think of three ways to implement an arp-table flush.
1) add an "route flushll" command which takes out RTM_LLINFO entries.
2) have ifconfig flush all (non-static??) RTM_LLINFO entries
associated with an interface when taking down that interface with
3) have the kernel ioctl(x, SIOCDIFADDR, a)
delete the matching RTM_LLINFO entries..
I like #3 best, though I'm not quite sure yet where to put the code;
perhaps in rtrequest() in sys/net/route.c.. when deleting a route with
RTM_CLONING set, also clobber any other routes which were cloned from
Anyone have any advice? Thanks in advance..