Subject: Re: [PATCH 09/25] netns ct: get proper netns from netdevice

From: Patrick McHardy <[email-masked]>
Date: Mon, 23 Jun 2008 12:35:00 +0200

Alexey Dobriyan wrote:
> Get netns from skb->dev on input, from skb->dst->dev on output to know
> where to create or search for conntrack.
> 
> Is there some documentation re which device accessible from skb is valid
> at which point?

For netfilter hooks, skb->dev points to the input device in
PREROUTING, INPUT, FORWARD, to the output device in POSTROUTING
and is invalid in OUTPUT.

> @@ -626,10 +628,14 @@ resolve_normal_ct(struct sk_buff *skb,
>  		return NULL;
>  	}
>  
> +	dev = skb->dev;
> +	if (!dev)
> +		dev = skb->dst->dev;
> +	net = dev_net(dev);

Maybe just pass it though nf_conntrack_in from the hook functions,
those get the devices as arguments.