[PATCH 4/6] add SO_NSID and SO_NETNS socket options

Eric W. Biederman ebiederm at xmission.com
Thu Oct 30 16:02:33 PDT 2008


> +	case SO_NSID:
> +		if (!capable(CAP_NET_ADMIN)) {
> +			ret = -EPERM;
> +		} else {
> +			struct net *old_net, *new_net;
> +
> +			ret = -EINVAL;
> +			new_net = get_net_ns_by_id(val);
> +			if (new_net) {
> +				ret = 0;
> +				old_net = sock_net(sk);
> +				sock_net_set(sk, get_net(new_net));
> +				put_net(old_net);
> +			}
> +		}

Ouch.  This is incomplete.  We can't perform this transformation on a bound socket.
And I don't see anything that would prevent that. 

Eric



More information about the Containers mailing list