From 047d0f94e7dadab8db4ec23216b7717e80a48a82 Mon Sep 17 00:00:00 2001 From: Lars Gjesse Date: Fri, 24 Mar 2017 09:52:13 +0100 Subject: [PATCH] Add support for network namespaces --- os_dep/linux/ioctl_cfg80211.c | 4 ++++ os_dep/linux/os_intfs.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 0c97041..3a92353 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -6599,6 +6599,10 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); #endif +#if defined(CONFIG_NET_NS) + wiphy->flags |= WIPHY_FLAG_NETNS_OK; +#endif //CONFIG_NET_NS + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS; #endif diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index c5bc146..394bcbf 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1095,6 +1095,9 @@ int rtw_os_ndev_register(_adapter *adapter, char *name) rtw_init_netdev_name(ndev, name); _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); +#if defined(CONFIG_NET_NS) + dev_net_set(ndev, wiphy_net(adapter_to_wiphy(adapter))); +#endif //defined(CONFIG_NET_NS) /* Tell the network stack we exist */ if (register_netdev(ndev) != 0) {