Bug 26833

Summary: `route change default' broken when gateway is over down interface
Product: Base System Reporter: mab <mab>
Component: miscAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-RELEASE   
Hardware: Any   
OS: Any   

Description mab 2001-04-25 07:40:00 UTC
The attached transcript says it about as well as I can hope to:  when
you ifconfig an interface down, the kernel removes the routes for
networks directly attached to that interface.  (Or, in the case of a
point-to-point interface, the route for the remote end of the link.)

After ifconfigging an interface down, you can add a route whose 
gateway is on a directly attached network, with `route add'.

However, `route change' under these conditions, when invoked to change
the route to what it already is, failed with EDQUOT.

I have reproduced this with both broadcast and point-to-point
interfaces, on FreeBSD 4.2 and 4.3, and on a number of different
machines.

How-To-Repeat: # netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
default            xxx.xxx.xxx.81     UGSc        1        0      ep0
127.0.0.1          127.0.0.1          UH         15   665693      lo0
xxx.xxx.xxx.80/28  link#9             UC          0        0      ep0 =>
# netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
default            xxx.xxx.xxx.81     UGSc        1        0      ep0
127.0.0.1          127.0.0.1          UH         15   665693      lo0
xxx.xxx.xxx.80/28  link#9             UC          0        0      ep0 =>
# ifconfig ep0 down
# netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
default            xxx.xxx.xxx.81     UGSc        1        0      ep0
127.0.0.1          127.0.0.1          UH         15   665693      lo0
# route delete default
delete net default
# netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
127.0.0.1          127.0.0.1          UH         15   665693      lo0
# route add default xxx.xxx.xxx.81
add net default: gateway xxx.xxx.xxx.81
# route change default xxx.xxx.xxx.81
route: writing to routing socket: Disc quota exceeded
change net default: gateway xxx.xxx.xxx.81: Disc quota exceeded
Comment 1 ru freebsd_committer freebsd_triage 2001-06-08 14:19:36 UTC
State Changed
From-To: open->closed

This is the normal behavior of the route(8) command. 
Kernel just tells you that the gateway route could 
not be allocated for a route due to a misconfigured 
routing table.  I've put some explanations here: 

sbin/route/route.c,v 1.47 
sbin/route/route.8,v 1.25
Comment 2 ru freebsd_committer freebsd_triage 2001-06-08 14:24:34 UTC
Responsible Changed
From-To: freebsd-bugs->ru

Mark as mine, for future references.