Subject: Re: switching network namespace midway

From: [email-masked] (Eric W. Biederman)
Date: Wed, 24 Oct 2012 14:11:14 -0700

rsa <[email-masked]> writes:

> Assuming I have a tunnel interface where two route lookups are done --
> one for innter
> packet and the other for outer -- do you see any issues in switching
> the network
> namespace prior to second route lookup (and restore to the original namespace
> after the second lookup is done)?
>
> If so, are there any other calls other than sk_change_net() needed?

In general sk_change_net is a bad idea.

Most likely what you want to do is simply memorize both struct net's
that you care about and perform the routing lookup as appropriate.

Certainly you don't want to be calling sk_change_net for every packet
that goes through your tunnel.

Eric