• Roopa Prabhu's avatar
    mpls: support for dead routes · c89359a4
    Roopa Prabhu authored
    Adds support for RTNH_F_DEAD and RTNH_F_LINKDOWN flags on mpls
    routes due to link events. Also adds code to ignore dead
    routes during route selection.
    
    Unlike ip routes, mpls routes are not deleted when the route goes
    dead. This is current mpls behaviour and this patch does not change
    that. With this patch however, routes will be marked dead.
    dead routes are not notified to userspace (this is consistent with ipv4
    routes).
    
    dead routes:
    -----------
    $ip -f mpls route show
    100
        nexthop as to 200 via inet 10.1.1.2  dev swp1
        nexthop as to 700 via inet 10.1.1.6  dev swp2
    
    $ip link set dev swp1 down
    
    $ip link show dev swp1
    4: swp1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode
    DEFAULT group default qlen 1000
        link/ether 00:02:00:00:00:01 brd ff:ff:ff:ff:ff:ff
    
    $ip -f mpls route show
    100
        nexthop as to 200 via inet 10.1.1.2  dev swp1 dead linkdown
        nexthop as to 700 via inet 10.1.1.6  dev swp2
    
    linkdown routes:
    ----------------
    $ip -f mpls route show
    100
        nexthop as to 200 via inet 10.1.1.2  dev swp1
        nexthop as to 700 via inet 10.1.1.6  dev swp2
    
    $ip link show dev swp1
    4: swp1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
    state UP mode DEFAULT group default qlen 1000
        link/ether 00:02:00:00:00:01 brd ff:ff:ff:ff:ff:ff
    
    /* carrier goes down */
    $ip link show dev swp1
    4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
    state DOWN mode DEFAULT group default qlen 1000
        link/ether 00:02:00:00:00:01 brd ff:ff:ff:ff:ff:ff
    
    $ip -f mpls route show
    100
        nexthop as to 200 via inet 10.1.1.2  dev swp1 linkdown
        nexthop as to 700 via inet 10.1.1.6  dev swp2
    Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
    Acked-by: default avatarRobert Shearman <rshearma@brocade.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c89359a4
af_mpls.c 38.5 KB