git: net/if: Call if_ioctl() if the protocol didn't handle the ioctl

Aaron LI aly at crater.dragonflybsd.org
Sun Nov 4 19:30:01 PST 2018


commit baf84f0ae5e25ae2d46fba3c9aafca24ba8e6074
Author: Aaron LI <aly at aaronly.me>
Date:   Sun Nov 4 17:55:53 2018 +0800

    net/if: Call if_ioctl() if the protocol didn't handle the ioctl
    
    This allows for a non-interface socket (like AF_LOCAL which ifconfig(8)
    now uses since commit d4e856128472e2e79172aebf65f19f527ac0010f) to use
    a broader class of interface ioctls.
    
    This fixes the regression in ifconfig(8) that is introduced by the above
    mentioned commit, which changed ifconfig(8) to use AF_LOCAL socket by
    default and thus caused some ioctls failures.  For example:
    
    dfly# ifconfig tap0 create
    dfly# ifconfig tap0 up
    dfly# ifconfig bridge0 create
    dfly# ifconfig bridge0 addm tap0
    
    [before]
    dfly# ifconfig bridge0
    bridge0: flags=8002<BROADCAST,MULTICAST> mtu 1500
            ether be:48:6d:6d:a6:1f
            groups: bridge
    
    [after]
    dfly# ifconfig bridge0
    bridge0: flags=8002<BROADCAST,MULTICAST> mtu 1500
            ether be:48:6d:6d:a6:1f
            priority 32768 hellotime 2 fwddelay 15 maxage 20
            member: tap0 flags=3<LEARNING,DISCOVER>
            groups: bridge
    
    Do not pass the SIOCSIF{ADDR,BRDADDR,DSTADDR,NETMASK} iotcls to the
    drivers because they may assume these ioctls come from an already
    privileged layer and thus skip credentials check and input validation.
    
    While there, improve a NULL check.
    
    Taken-from: FreeBSD (r190151, r255442)
    Reviewed-by: dillon, sephe

Summary of changes:
 sys/net/if.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/baf84f0ae5e25ae2d46fba3c9aafca24ba8e6074


-- 
DragonFly BSD source repository



More information about the Commits mailing list