git: if: Bandaid ifa_ifwithnet() for ifaddrs w/ same netmask

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Thu Dec 10 23:48:05 PST 2015


commit 0925f9d882e80bae6773fbae547965da8ac5ba3e
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Fri Dec 11 15:39:03 2015 +0800

    if: Bandaid ifa_ifwithnet() for ifaddrs w/ same netmask
    
    The original ifaddr selection logic would cause trouble for
    SO_DONTROUTE sockets, if following stuffs happened:
    ifconfig drv0 inet a.b.c.1
    ifconfig drv0 down
    ifconfig drv1 inet a.b.c.2
    
    The original ifaddr selection logic in ifa_ifwithnet() will
    select a.b.c.1 at drv0, which is down.  Instead, a.b.c.2 at drv1
    should be selected.
    
    We thus prefer ifaddr w/ IFF_UP interface or is routable.
    
    Same bandaid probably should be applied to ifa_ifwithdstaddr(),
    ifa_ifwithaddr() [broadcast part], and ifaof_ifpforaddr() too.

Summary of changes:
 sys/net/if.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0925f9d882e80bae6773fbae547965da8ac5ba3e


-- 
DragonFly BSD source repository



More information about the Commits mailing list