From patchwork Tue Apr 22 12:43:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenweilong X-Patchwork-Id: 341324 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E1A39140110 for ; Tue, 22 Apr 2014 22:43:30 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932413AbaDVMn1 (ORCPT ); Tue, 22 Apr 2014 08:43:27 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:33774 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932152AbaDVMnZ (ORCPT ); Tue, 22 Apr 2014 08:43:25 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BSU57007; Tue, 22 Apr 2014 20:43:09 +0800 (CST) Received: from SZXEML456-HUB.china.huawei.com (10.82.67.199) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.3.158.1; Tue, 22 Apr 2014 20:43:09 +0800 Received: from localhost (10.177.27.191) by szxeml456-hub.china.huawei.com (10.82.67.199) with Microsoft SMTP Server id 14.3.158.1; Tue, 22 Apr 2014 20:43:06 +0800 From: Chen Weilong To: , CC: Subject: [patch net-next] vlan: Don't allow vlan devices to change network namespaces. Date: Tue, 22 Apr 2014 20:43:06 +0800 Message-ID: <1398170586-6668-1-git-send-email-chenweilong@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.27.191] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Weilong Chen Like bonding, vlan as netdevice doesn't cross netns boundaries. Vlan port and vlan itself live in same netns. Signed-off-by: Weilong Chen --- net/8021q/vlan_dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 733ec28..2ef4a54 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -685,6 +685,9 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev, features |= old_features & NETIF_F_SOFT_FEATURES; features |= NETIF_F_LLTX; + /* Don't allow vlan devices to change network namespaces. */ + features |= NETIF_F_NETNS_LOCAL; + return features; }