• Matteo Croce's avatar
    ipv4: don't set IPv6 only flags to IPv4 addresses · 2e605463
    Matteo Croce authored
    Avoid the situation where an IPV6 only flag is applied to an IPv4 address:
    
        # ip addr add 192.0.2.1/24 dev dummy0 nodad home mngtmpaddr noprefixroute
        # ip -4 addr show dev dummy0
        2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
            inet 192.0.2.1/24 scope global noprefixroute dummy0
               valid_lft forever preferred_lft forever
    
    Or worse, by sending a malicious netlink command:
    
        # ip -4 addr show dev dummy0
        2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
            inet 192.0.2.1/24 scope global nodad optimistic dadfailed home tentative mngtmpaddr noprefixroute stable-privacy dummy0
               valid_lft forever preferred_lft forever
    Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
    Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2e605463
devinet.c 67.1 KB