Skip to content

Commit 45ca3e6

Browse files
nbd168ummakynes
authored andcommitted
netfilter: nft_flow_offload: skip dst neigh lookup for ppp devices
The dst entry does not contain a valid hardware address, so skip the lookup in order to avoid running into errors here. The proper hardware address is filled in from nft_dev_path_info Fixes: 72efd58 ("netfilter: flowtable: add pppoe support") Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 396ef64 commit 45ca3e6

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

net/netfilter/nft_flow_offload.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ static void nft_default_forward_path(struct nf_flow_route *route,
3636
route->tuple[dir].xmit_type = nft_xmit_type(dst_cache);
3737
}
3838

39+
static bool nft_is_valid_ether_device(const struct net_device *dev)
40+
{
41+
if (!dev || (dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
42+
dev->addr_len != ETH_ALEN || !is_valid_ether_addr(dev->dev_addr))
43+
return false;
44+
45+
return true;
46+
}
47+
3948
static int nft_dev_fill_forward_path(const struct nf_flow_route *route,
4049
const struct dst_entry *dst_cache,
4150
const struct nf_conn *ct,
@@ -47,6 +56,9 @@ static int nft_dev_fill_forward_path(const struct nf_flow_route *route,
4756
struct neighbour *n;
4857
u8 nud_state;
4958

59+
if (!nft_is_valid_ether_device(dev))
60+
goto out;
61+
5062
n = dst_neigh_lookup(dst_cache, daddr);
5163
if (!n)
5264
return -1;
@@ -60,6 +72,7 @@ static int nft_dev_fill_forward_path(const struct nf_flow_route *route,
6072
if (!(nud_state & NUD_VALID))
6173
return -1;
6274

75+
out:
6376
return dev_fill_forward_path(dev, ha, stack);
6477
}
6578

@@ -78,15 +91,6 @@ struct nft_forward_info {
7891
enum flow_offload_xmit_type xmit_type;
7992
};
8093

81-
static bool nft_is_valid_ether_device(const struct net_device *dev)
82-
{
83-
if (!dev || (dev->flags & IFF_LOOPBACK) || dev->type != ARPHRD_ETHER ||
84-
dev->addr_len != ETH_ALEN || !is_valid_ether_addr(dev->dev_addr))
85-
return false;
86-
87-
return true;
88-
}
89-
9094
static void nft_dev_path_info(const struct net_device_path_stack *stack,
9195
struct nft_forward_info *info,
9296
unsigned char *ha, struct nf_flowtable *flowtable)

0 commit comments

Comments
 (0)