summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-04-07 10:42:18 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2015-04-22 21:15:24 +0200
commit3d418885971c003534df222c9c7159703ca039cd (patch)
tree721b1eccb482ee99767f26b24c9089868352b270
parentc0fabb92ec88f6a7abd76e4cc350bd1d04cd425f (diff)
backports: deal better with possible_net_t
Instead of just assuming CONFIG_NET_NS is defined, deal with this better. Sadly, it needs a header file patch (as an spatch doesn't deal properly with header files.) Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/net/net_namespace.h22
-rw-r--r--patches/collateral-evolutions/network/0053-possible_net_t.patch19
2 files changed, 40 insertions, 1 deletions
diff --git a/backport/backport-include/net/net_namespace.h b/backport/backport-include/net/net_namespace.h
index b9f8b2ba..90c044f1 100644
--- a/backport/backport-include/net/net_namespace.h
+++ b/backport/backport-include/net/net_namespace.h
@@ -36,7 +36,27 @@ static inline struct net *get_net_ns_by_fd(int fd)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-#define possible_net_t struct net *
+typedef struct {
+#ifdef CONFIG_NET_NS
+ struct net *net;
#endif
+} possible_net_t;
+
+static inline void possible_write_pnet(possible_net_t *pnet, struct net *net)
+{
+#ifdef CONFIG_NET_NS
+ pnet->net = net;
+#endif
+}
+
+static inline struct net *possible_read_pnet(const possible_net_t *pnet)
+{
+#ifdef CONFIG_NET_NS
+ return pnet->net;
+#else
+ return &init_net;
+#endif
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
#endif /* _COMPAT_NET_NET_NAMESPACE_H */
diff --git a/patches/collateral-evolutions/network/0053-possible_net_t.patch b/patches/collateral-evolutions/network/0053-possible_net_t.patch
new file mode 100644
index 00000000..c2217b5b
--- /dev/null
+++ b/patches/collateral-evolutions/network/0053-possible_net_t.patch
@@ -0,0 +1,19 @@
+diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
+index 04e5785..a251da1 100644
+--- a/include/net/cfg80211.h
++++ b/include/net/cfg80211.h
+@@ -3239,12 +3239,12 @@ struct wiphy {
+
+ static inline struct net *wiphy_net(struct wiphy *wiphy)
+ {
+- return read_pnet(&wiphy->_net);
++ return possible_read_pnet(&wiphy->_net);
+ }
+
+ static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
+ {
+- write_pnet(&wiphy->_net, net);
++ possible_write_pnet(&wiphy->_net, net);
+ }
+
+ /**