Re: [PATCH net-next v4 3/4] net: ipv6: seg6_iptunnel: mitigate 2-realloc issue
From: Justin Iurman
Date: Tue Nov 19 2024 - 08:07:24 EST
On 11/19/24 11:47, Paolo Abeni wrote:
On 11/18/24 14:15, Justin Iurman wrote:
[...]
/* encapsulate an IPv6 packet within an outer IPv6 header with reduced SRH */
static int seg6_do_srh_encap_red(struct sk_buff *skb,
- struct ipv6_sr_hdr *osrh, int proto)
+ struct ipv6_sr_hdr *osrh, int proto,
+ struct dst_entry *dst)
{
__u8 first_seg = osrh->first_segment;
- struct dst_entry *dst = skb_dst(skb);
- struct net *net = dev_net(dst->dev);
+ struct net *net = dev_net(skb_dst(skb)->dev);
struct ipv6hdr *hdr, *inner_hdr;
int hdrlen = ipv6_optlen(osrh);
int red_tlv_offset, tlv_offset;
Minor nit: please respect the reverse x-mas tree order above.
Oopsie, forgot to move the old one on top. Will do, thanks!
Also the code would probably be more readable with:
struct dst_entry *old_dst = skb_dst(skb);
and using 'old_dst' instead of 'skb_dst(skb)'
Ack. How about "dst" instead of "old_dst" (since it's the current
dst_entry), and "cache_dst" instead of "dst"?
Cheers,
Paolo