• David Ahern's avatar
    net: vrf: ipv6 support for local traffic to local addresses · 625b47b5
    David Ahern authored
    Add support for locally originated traffic to VRF-local IPv6 addresses.
    Similar to IPv4 a local dst is set on the skb and the packet is
    reinserted with a call to netif_rx. With this patch, ping, tcp and udp
    packets to a local IPv6 address are successfully routed:
    
        $ ip addr show dev eth1
        4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master red state UP group default qlen 1000
            link/ether 02:e0:f9:1c:b9:74 brd ff:ff:ff:ff:ff:ff
            inet 10.100.1.1/24 brd 10.100.1.255 scope global eth1
               valid_lft forever preferred_lft forever
            inet6 2100:1::1/120 scope global
               valid_lft forever preferred_lft forever
            inet6 fe80::e0:f9ff:fe1c:b974/64 scope link
               valid_lft forever preferred_lft forever
    
        $ ping6 -c1 -I red 2100:1::1
        ping6: Warning: source address might be selected on device other than red.
        PING 2100:1::1(2100:1::1) from 2100:1::1 red: 56 data bytes
        64 bytes from 2100:1::1: icmp_seq=1 ttl=64 time=0.098 ms
    
    ip6_input is exported so the VRF driver can use it for the dst input
    function. The dst_alloc function for IPv4 defaults to setting the input and
    output functions; IPv6's does not. VRF does not need to duplicate the Rx path
    so just export the ipv6 input function.
    Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    625b47b5
vrf.c 24 KB