Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1550c171 authored by David Ahern's avatar David Ahern Committed by David S. Miller
Browse files

ipv4: Prepare rtable for IPv6 gateway



To allow the gateway to be either an IPv4 or IPv6 address, remove
rt_uses_gateway from rtable and replace with rt_gw_family. If
rt_gw_family is set it implies rt_uses_gateway. Rename rt_gateway
to rt_gw4 to represent the IPv4 version.

Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bdf00467
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ static bool has_gateway(const struct dst_entry *dst, sa_family_t family)

	if (family == AF_INET) {
		rt = container_of(dst, struct rtable, dst);
		return rt->rt_uses_gateway;
		return rt->rt_gw_family == AF_INET;
	}

	rt6 = container_of(dst, struct rt6_info, dst);
+1 −1
Original line number Diff line number Diff line
@@ -1407,7 +1407,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
		if (neigh->nud_state & NUD_VALID) {
			nes_debug(NES_DBG_CM, "Neighbor MAC address for 0x%08X"
				  " is %pM, Gateway is 0x%08X \n", dst_ip,
				  neigh->ha, ntohl(rt->rt_gateway));
				  neigh->ha, ntohl(rt->rt_gw4));

			if (arpindex >= 0) {
				if (ether_addr_equal(nesadapter->arp_table[arpindex].mac_addr, neigh->ha)) {
+5 −1
Original line number Diff line number Diff line
@@ -116,11 +116,15 @@ static struct net_device * __init ipddp_init(void)
 */
static netdev_tx_t ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
{
	__be32 paddr = skb_rtable(skb)->rt_gateway;
        struct rtable *rtable = skb_rtable(skb);
        __be32 paddr = 0;
        struct ddpehdr *ddp;
        struct ipddp_route *rt;
        struct atalk_addr *our_addr;

	if (rtable->rt_gw_family == AF_INET)
		paddr = rtable->rt_gw4;

	spin_lock(&ipddp_route_lock);

	/*
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
	if (ret)
		return ret;

	if (mlx5_lag_is_multipath(mdev) && !rt->rt_gateway)
	if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET)
		return -ENETUNREACH;
#else
	return -EOPNOTSUPP;
+2 −1
Original line number Diff line number Diff line
@@ -316,7 +316,8 @@ mlxsw_sp_span_gretap4_route(const struct net_device *to_dev,

	dev = rt->dst.dev;
	*saddrp = fl4.saddr;
	*daddrp = rt->rt_gateway;
	if (rt->rt_gw_family == AF_INET)
		*daddrp = rt->rt_gw4;

out:
	ip_rt_put(rt);
Loading