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

Commit 6104e112 authored by David Ahern's avatar David Ahern Committed by David S. Miller
Browse files

net: ipv4: Do not drop to make_route if oif is l3mdev



Commit e0d56fdd was a bit aggressive removing l3mdev calls in
the IPv4 stack. If the fib_lookup fails we do not want to drop to
make_route if the oif is an l3mdev device.

Also reverts 19664c6a ("net: l3mdev: Remove netif_index_is_l3_master")
which removed netif_index_is_l3_master.

Fixes: e0d56fdd ("net: l3mdev: remove redundant calls")
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c293f4e
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -114,6 +114,25 @@ static inline u32 l3mdev_fib_table(const struct net_device *dev)
	return tb_id;
}

static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
{
	struct net_device *dev;
	bool rc = false;

	if (ifindex == 0)
		return false;

	rcu_read_lock();

	dev = dev_get_by_index_rcu(net, ifindex);
	if (dev)
		rc = netif_is_l3_master(dev);

	rcu_read_unlock();

	return rc;
}

struct dst_entry *l3mdev_link_scope_lookup(struct net *net, struct flowi6 *fl6);

static inline
@@ -207,6 +226,11 @@ static inline u32 l3mdev_fib_table_by_index(struct net *net, int ifindex)
	return 0;
}

static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
{
	return false;
}

static inline
struct dst_entry *l3mdev_link_scope_lookup(struct net *net, struct flowi6 *fl6)
{
+2 −1
Original line number Diff line number Diff line
@@ -2265,7 +2265,8 @@ struct rtable *__ip_route_output_key_hash(struct net *net, struct flowi4 *fl4,
	if (err) {
		res.fi = NULL;
		res.table = NULL;
		if (fl4->flowi4_oif) {
		if (fl4->flowi4_oif &&
		    !netif_index_is_l3_master(net, fl4->flowi4_oif)) {
			/* Apparently, routing tables are wrong. Assume,
			   that the destination is on link.