1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 6 May 2022 13:54:44 +0200
3 Subject: [PATCH] net: fix dev_fill_forward_path with pppoe + bridge
5 When calling dev_fill_forward_path on a pppoe device, the provided destination
6 address is invalid. In order for the bridge fdb lookup to succeed, the pppoe
7 code needs to update ctx->daddr to the correct value.
8 Fix this by storing the address inside struct net_device_path_ctx
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
15 @@ -91,7 +91,6 @@ mtk_flow_get_wdma_info(struct net_device
17 struct net_device_path_ctx ctx = {
21 struct net_device_path path = {};
23 @@ -101,6 +100,7 @@ mtk_flow_get_wdma_info(struct net_device
24 if (!dev->netdev_ops->ndo_fill_forward_path)
27 + memcpy(ctx.daddr, addr, sizeof(ctx.daddr));
28 if (dev->netdev_ops->ndo_fill_forward_path(&ctx, &path))
31 --- a/drivers/net/ppp/pppoe.c
32 +++ b/drivers/net/ppp/pppoe.c
33 @@ -988,6 +988,7 @@ static int pppoe_fill_forward_path(struc
34 path->encap.proto = htons(ETH_P_PPP_SES);
35 path->encap.id = be16_to_cpu(po->num);
36 memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN);
37 + memcpy(ctx->daddr, po->pppoe_pa.remote, ETH_ALEN);
41 --- a/include/linux/netdevice.h
42 +++ b/include/linux/netdevice.h
43 @@ -892,7 +892,7 @@ struct net_device_path_stack {
45 struct net_device_path_ctx {
46 const struct net_device *dev;
54 @@ -863,11 +863,11 @@ int dev_fill_forward_path(const struct n
55 const struct net_device *last_dev;
56 struct net_device_path_ctx ctx = {
60 struct net_device_path *path;
63 + memcpy(ctx.daddr, daddr, sizeof(ctx.daddr));
65 while (ctx.dev && ctx.dev->netdev_ops->ndo_fill_forward_path) {