diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-05-15 16:20:39 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-05-15 16:20:39 -0700 |
| commit | d51b9d81f7883f526b26e3ab903e646274aebeb1 (patch) | |
| tree | 9027f2e9b9f7529eda9220c4bcb38e4541c81646 /drivers/net/ipvlan/ipvlan_core.c | |
| parent | 74d3da135f69a910df0f3487bebd3de540450d4a (diff) | |
| parent | 82f2b0b97b36ee3fcddf0f0780a9a0825d52fec3 (diff) | |
| download | linux-next-d51b9d81f7883f526b26e3ab903e646274aebeb1.tar.gz linux-next-d51b9d81f7883f526b26e3ab903e646274aebeb1.zip | |
Merge tag 'v6.15-rc6' into next
Sync up with mainline to bring in xpad controller changes.
Diffstat (limited to 'drivers/net/ipvlan/ipvlan_core.c')
| -rw-r--r-- | drivers/net/ipvlan/ipvlan_core.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index fd591ddb3884..ca62188a317a 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -416,20 +416,25 @@ struct ipvl_addr *ipvlan_addr_lookup(struct ipvl_port *port, void *lyr3h, static noinline_for_stack int ipvlan_process_v4_outbound(struct sk_buff *skb) { - const struct iphdr *ip4h = ip_hdr(skb); struct net_device *dev = skb->dev; struct net *net = dev_net(dev); - struct rtable *rt; int err, ret = NET_XMIT_DROP; + const struct iphdr *ip4h; + struct rtable *rt; struct flowi4 fl4 = { .flowi4_oif = dev->ifindex, - .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip4h)), .flowi4_flags = FLOWI_FLAG_ANYSRC, .flowi4_mark = skb->mark, - .daddr = ip4h->daddr, - .saddr = ip4h->saddr, }; + if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) + goto err; + + ip4h = ip_hdr(skb); + fl4.daddr = ip4h->daddr; + fl4.saddr = ip4h->saddr; + fl4.flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip4h)); + rt = ip_route_output_flow(net, &fl4, NULL); if (IS_ERR(rt)) goto err; @@ -488,6 +493,12 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) struct net_device *dev = skb->dev; int err, ret = NET_XMIT_DROP; + if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr))) { + DEV_STATS_INC(dev, tx_errors); + kfree_skb(skb); + return ret; + } + err = ipvlan_route_v6_outbound(dev, skb); if (unlikely(err)) { DEV_STATS_INC(dev, tx_errors); |
