diff options
| author | Oliver Hartkopp <socketcan@hartkopp.net> | 2026-02-01 15:33:18 +0100 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-02-05 11:58:40 +0100 |
| commit | 5a9229dbb48deb78ee1d20ccbd6453cfbf2a4a61 (patch) | |
| tree | 9921e8909de91efe0823321033ff30f15693d481 /drivers/net/can/dev | |
| parent | 96ea3a1e2d317e7ecb6b65dc65c9dd917905a6a8 (diff) | |
can: move ifindex to CAN skb extensions
When routing CAN frames over different CAN interfaces the interface index
skb->iif is overwritten with every single hop. To prevent sending a CAN
frame back to its originating (first) incoming CAN interface another
ifindex variable is needed, which was stored in can_skb_priv::ifindex.
Move the can_skb_priv::ifindex content to can_skb_ext::can_iif.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://patch.msgid.link/20260201-can_skb_ext-v8-3-3635d790fe8b@hartkopp.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/can/dev')
| -rw-r--r-- | drivers/net/can/dev/skb.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/can/dev/skb.c b/drivers/net/can/dev/skb.c index c572745565f6..470255fe7367 100644 --- a/drivers/net/can/dev/skb.c +++ b/drivers/net/can/dev/skb.c @@ -223,7 +223,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) skb->protocol = htons(ETH_P_CAN); init_can_skb_reserve(skb); - can_skb_prv(skb)->ifindex = dev->ifindex; + csx->can_iif = dev->ifindex; *cf = skb_put_zero(skb, sizeof(struct can_frame)); @@ -255,7 +255,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, skb->protocol = htons(ETH_P_CANFD); init_can_skb_reserve(skb); - can_skb_prv(skb)->ifindex = dev->ifindex; + csx->can_iif = dev->ifindex; *cfd = skb_put_zero(skb, sizeof(struct canfd_frame)); @@ -294,7 +294,7 @@ struct sk_buff *alloc_canxl_skb(struct net_device *dev, skb->protocol = htons(ETH_P_CANXL); init_can_skb_reserve(skb); - can_skb_prv(skb)->ifindex = dev->ifindex; + csx->can_iif = dev->ifindex; *cxl = skb_put_zero(skb, CANXL_HDR_SIZE + data_len); @@ -344,8 +344,7 @@ static bool can_skb_headroom_valid(struct net_device *dev, struct sk_buff *skb) return false; } - can_skb_prv(skb)->ifindex = dev->ifindex; - + csx->can_iif = dev->ifindex; skb->ip_summed = CHECKSUM_UNNECESSARY; /* perform proper loopback on capable devices */ |
