Commit cf2df74e authored by Felix Fietkau's avatar Felix Fietkau Committed by Pablo Neira Ayuso

net: fix dev_fill_forward_path with pppoe + bridge

When calling dev_fill_forward_path on a pppoe device, the provided destination
address is invalid. In order for the bridge fdb lookup to succeed, the pppoe
code needs to update ctx->daddr to the correct value.
Fix this by storing the address inside struct net_device_path_ctx

Fixes: f6efc675 ("net: ppp: resolve forwarding path for bridge pppoe devices")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 45ca3e61
...@@ -988,6 +988,7 @@ static int pppoe_fill_forward_path(struct net_device_path_ctx *ctx, ...@@ -988,6 +988,7 @@ static int pppoe_fill_forward_path(struct net_device_path_ctx *ctx,
path->encap.proto = htons(ETH_P_PPP_SES); path->encap.proto = htons(ETH_P_PPP_SES);
path->encap.id = be16_to_cpu(po->num); path->encap.id = be16_to_cpu(po->num);
memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN); memcpy(path->encap.h_dest, po->pppoe_pa.remote, ETH_ALEN);
memcpy(ctx->daddr, po->pppoe_pa.remote, ETH_ALEN);
path->dev = ctx->dev; path->dev = ctx->dev;
ctx->dev = dev; ctx->dev = dev;
......
...@@ -900,7 +900,7 @@ struct net_device_path_stack { ...@@ -900,7 +900,7 @@ struct net_device_path_stack {
struct net_device_path_ctx { struct net_device_path_ctx {
const struct net_device *dev; const struct net_device *dev;
const u8 *daddr; u8 daddr[ETH_ALEN];
int num_vlans; int num_vlans;
struct { struct {
......
...@@ -681,11 +681,11 @@ int dev_fill_forward_path(const struct net_device *dev, const u8 *daddr, ...@@ -681,11 +681,11 @@ int dev_fill_forward_path(const struct net_device *dev, const u8 *daddr,
const struct net_device *last_dev; const struct net_device *last_dev;
struct net_device_path_ctx ctx = { struct net_device_path_ctx ctx = {
.dev = dev, .dev = dev,
.daddr = daddr,
}; };
struct net_device_path *path; struct net_device_path *path;
int ret = 0; int ret = 0;
memcpy(ctx.daddr, daddr, sizeof(ctx.daddr));
stack->num_paths = 0; stack->num_paths = 0;
while (ctx.dev && ctx.dev->netdev_ops->ndo_fill_forward_path) { while (ctx.dev && ctx.dev->netdev_ops->ndo_fill_forward_path) {
last_dev = ctx.dev; last_dev = ctx.dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment