From ed2d5f8a32f1deffb6e8a59c4b153b36f7c30e16 Mon Sep 17 00:00:00 2001 From: Wataru Ishida <5915117+ishidawataru@users.noreply.github.com> Date: Mon, 23 Dec 2019 10:27:22 -0800 Subject: [PATCH] [broadcom]: respect the current network namespace when creating netdev (#3896) https://github.com/Broadcom-Switch/OpenNSL/issues/26 Signed-off-by: Wataru Ishida --- .../systems/linux/kernel/modules/bcm-knet/bcm-knet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c index 0c91c3ecd5f7..077386e6dcbc 100644 --- a/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c +++ b/platform/broadcom/saibcm-modules/systems/linux/kernel/modules/bcm-knet/bcm-knet.c @@ -6165,6 +6165,10 @@ bkn_init_ndev(u8 *mac, char *name) strncpy(dev->name, name, IFNAMSIZ-1); } +#ifdef CONFIG_NET_NS + dev_net_set(dev, current->nsproxy->net_ns); +#endif + /* Register the kernel Ethernet device */ if (register_netdev(dev)) { DBG_WARN(("Error registering Ethernet device.\n"));