DragonFly commits List (threaded) for 2008-12
DragonFly BSD
DragonFly commits List (threaded) for 2008-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

DragonFly-2.1.1.210.g102e9 master sys/netinet in.c


From: Sepherosa Ziehau <sephe@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Dec 2008 02:19:39 -0800 (PST)

commit 102e97f31733741a73135d716be6fb305e8842fd
Author: Sepherosa Ziehau <sephe@dragonflybsd.org>
Date:   Sat Dec 27 21:13:53 2008 +0800

    Bring in in_{add,scrub}prefix() from OpenBSD.
    
    These two functions are used to add/delete "prefix route" for
    interface addresses.
    
    in_addprefix() allows addresses with same prefix to be added by
    checking the prefix's existence before calling rtinit(), if same
    prefix exists, it returns silently.  Originally rtinit() will fail
    in in_ifinit() and the address will not be added.  This function
    at least makes the result of address assignment consistent in
    following two cases:
    
    ifconfig iface1 inet 192.168.5.2
    ifconfig iface0 inet 192.168.5.1
    
    Origianlly last command will fail, since the route to 192.168.5.0/24
    already exists.
    
    ifconfig iface0 inet 192.168.5.1
    ifconfig iface0 down
    ifconfig iface1 inet 192.168.5.2
    ifconfig iface0 up
    
    However, originally, above commands sequence will successfully add
    192.168.5.1 to iface0 ;)
    
    To make in_addprefix() function properly following fix is brought
    in from ru@freebsd.org via OpenBSD:
      For loopback, set ia_dstaddr instead of ia_ifa.ifa_dstaddr in
      in_ifinit()
    
    Following changes are made to the OpenBSD's in_addprefix():
    - Don't try to match the prefix against the address to be added.
    - Test subnetmask only if the tested address and the to be added
      address are not for loopback or point to point interface.
    
    in_scrubprefix() will try to find an address with same prefix
    as the to-be-deleted address.  If suitable address is found, then
    in addition to delete the to-be-deleted address's prefix route,
    a new prefix route associated with the suitable address will be
    installed.
    
    Following changes are made to OpenBSD's in_scrubprefix():
    - Don't try to match the prefix against the address to be deleted.
    - Don't even try to add prefix route for an address whose parent
      interface is not up yet.

Summary of changes:
 sys/netinet/in.c |  178 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 161 insertions(+), 17 deletions(-)

http://gitweb.dragonflybsd.org/?p=dragonfly.git;a=commitdiff;h=102e97f31733741a73135d716be6fb305e8842fd


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]