Subject: Re: [PATCH nf] netfilter: nf_reject: init skb->dev for reset packet

From: Florian Westphal <[email-masked]>
Date: Thu, 6 Jun 2024 16:38:16 +0200

Willem de Bruijn <[email-masked]> wrote:
> > I named the copypasta as nf_skb_get_hash. If placed in sk_buff.h:
> > net_get_hash_net()?
> > skb_get_hash()?
> 
> Still passing an skb too, so skb_get_hash_net()?

Sounds good to me.

> > And if either of that exists, maybe then use
> > skb_get_hash_symmetric_net(net, skb)
> 
> If symmetric is equally good for nft, that would be preferable, as it
> avoids the extra function. But I suppose it aliases the two flow
> directions, which may be exactly what you don't want?

It would actually be fine, but the more important part is that
skb->hash is set.

For the trace id, I want a stable identifier that won't change
(e.g. when nat rewrites addresses).

This currently works because skb_get_hash computes it at most once.

skb_get_hash_symmetric_net() will be used from nft_hash.c as
__skb_get_hash_symmetric "replacement".

Pablo, you can drop this patch, I will try the 'pass net to dissector'
route.