On Tue, Nov 24, 2026 at 10:06:28PM +0900, Xuanqiang Luo wrote: ...
> @@ -166,10 +164,10 @@ static int icmp_filter(const struct sock *sk, const struct sk_buff *skb) > * RFC 1122: SHOULD pass TOS value up to the transport layer. > * -> It does. And not only TOS, but all IP header. > */ > -static int raw_v4_input(struct net *net, struct sk_buff *skb, > - const struct iphdr *iph, int hash) > +static int raw_v4_input(struct net *net, struct sk_buff *skb, int hash) > { > int sdif = inet_sdif(skb); > + const struct iphdr *iph; > struct hlist_head *hlist; > int dif = inet_iif(skb); > int delivered = 0;
nit: If you have to respin this patchset for some other reason then please preserve reverse xmas tree - longest line to shortest - order for local variable declarations.
> @@ -178,13 +176,19 @@ static int raw_v4_input(struct net *net, struct sk_buff *skb, > hlist = &raw_v4_hashinfo.ht[hash]; > rcu_read_lock(); > sk_for_each_rcu(sk, hlist) { > + iph = ip_hdr(skb);
FWIIW, I would lean towards declaring iph in this scope.
> if (!raw_v4_match(net, sk, iph->protocol, > iph->saddr, iph->daddr, dif, sdif)) > continue; > > delivered = 1; > - if ((iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) && > - ip_mc_sf_allow(sk, iph->daddr, iph->saddr, > + if (iph->protocol == IPPROTO_ICMP) { > + if (icmp_filter(sk, skb)) > + continue; > + /* icmp_filter() might have changed skb->head. */ > + iph = ip_hdr(skb); > + } > + if (ip_mc_sf_allow(sk, iph->daddr, iph->saddr, > skb->dev->ifindex, sdif)) { > struct sk_buff *clone; > > @@ -208,8 +212,7 @@ int raw_local_deliver(struct sk_buff *skb, int protocol) > { > struct net *net = dev_net(skb->dev); > > - return raw_v4_input(net, skb, ip_hdr(skb), > - raw_hashfunc(net, protocol)); > + return raw_v4_input(net, skb, raw_hashfunc(net, protocol)); > } > > static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info) > -- > 2.43.0 >