ipv4: Add support to rtable for ipv6 gateway

Add support for an IPv6 gateway to rtable. Since a gateway is either
IPv4 or IPv6, make it a union with rt_gw4 where rt_gw_family decides
which address is in use.

When dumping the route data, encode an ipv6 nexthop using RTA_VIA.

Signed-off-by: David Ahern <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
David Ahern 2019-04-05 16:30:29 -07:00 • committed by David S. Miller
commit 0f5f7d7bf6
5 changed files with 38 additions and 8 deletions

View file

@ -141,8 +141,9 @@ static int mpls_xmit(struct sk_buff *skb)
if (rt->rt_gw_family == AF_INET)
err = neigh_xmit(NEIGH_ARP_TABLE, out_dev, &rt->rt_gw4,
skb);
else
err = -EAFNOSUPPORT;
else if (rt->rt_gw_family == AF_INET6)
err = neigh_xmit(NEIGH_ND_TABLE, out_dev, &rt->rt_gw6,
skb);
} else if (rt6) {
if (ipv6_addr_v4mapped(&rt6->rt6i_gateway)) {
/* 6PE (RFC 4798) */