summaryrefslogtreecommitdiff
path: root/patches/collateral-evolutions/network
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-03-31 07:20:25 +0000
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 18:16:21 -0700
commit8680eb1be12f4121fa4a49cbf6b4e043cdbb1c73 (patch)
tree6ae38c2e98aa6790e07796786d6759015e3de5d9 /patches/collateral-evolutions/network
parent92ed28aa878c47004a238ab67079f61043d56ed3 (diff)
backports: backport ieee802154 6lowpan support down to 3.5
Commit 633fc86ff62 added the ieee802154_6lowpan namespace and 7240cdec60b extended it (as on linux-next next-20140311). Its important to note though that 633fc86ff62 also extends the global net namespace. Since we cannot extend the global net namespace we define our own backport namespace for 6lowpan that can be used only be used by our backported subsystems, nothing more. Since ieee802154_6lowpan requires support for net_get_random_once() which uses static keys and a slew of new skb fragment support we simply require at least 3.5 to use 6lowpan. I did my best effort to backport this to kernels older than 3.5 but quickly ran into a slew of hairy issues. The last thing we needed to address was usage of the helper inet_frag_evictor() added by Alexander via commit 6b102865e7 through v3.7. Since we can't backport that with macros or inline helpers we add a patch to carry the changes there. If that grows we can consider using Coccinelle. If you are going to try to backport 6lowpan to kernels older than 3.5 be warned that the litmus test for patches will be to pass ckmake --allyesconfig for all supported kernels for every patch you provide. Cc: Alexander Aring <alex.aring@gmail.com> Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Amerigo Wang <amwang@redhat.com> Cc: linux-zigbee-devel@lists.sourceforge.net Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Diffstat (limited to 'patches/collateral-evolutions/network')
-rw-r--r--patches/collateral-evolutions/network/0012-ieee802154-6lowpan-namespace.patch63
-rw-r--r--patches/collateral-evolutions/network/0013-net-user-ns.patch17
-rw-r--r--patches/collateral-evolutions/network/0014-inet_frag_evictor.patch20
3 files changed, 100 insertions, 0 deletions
diff --git a/patches/collateral-evolutions/network/0012-ieee802154-6lowpan-namespace.patch b/patches/collateral-evolutions/network/0012-ieee802154-6lowpan-namespace.patch
new file mode 100644
index 00000000..218a7685
--- /dev/null
+++ b/patches/collateral-evolutions/network/0012-ieee802154-6lowpan-namespace.patch
@@ -0,0 +1,63 @@
+This is required unless we add some macro wrappers for this
+type of static work upstream but not sure if that is a good
+idea yet.
+
+--- a/net/ieee802154/reassembly.c
++++ b/net/ieee802154/reassembly.c
+@@ -104,7 +104,11 @@ static void lowpan_frag_expire(unsigned
+ struct net *net;
+
+ fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q);
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ net = container_of(fq->q.net, struct net, ieee802154_lowpan.frags);
++#else
++ net = &init_net;
++#endif
+
+ lowpan_expire_frag_queue(fq, &lowpan_frags);
+ }
+@@ -386,28 +390,44 @@ EXPORT_SYMBOL(lowpan_frag_rcv);
+ static struct ctl_table lowpan_frags_ns_ctl_table[] = {
+ {
+ .procname = "6lowpanfrag_high_thresh",
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ .data = &init_net.ieee802154_lowpan.frags.high_thresh,
++#else
++ .data = &ieee802154_lowpan.frags.high_thresh,
++#endif
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+ },
+ {
+ .procname = "6lowpanfrag_low_thresh",
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ .data = &init_net.ieee802154_lowpan.frags.low_thresh,
++#else
++ .data = &ieee802154_lowpan.frags.low_thresh,
++#endif
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+ },
+ {
+ .procname = "6lowpanfrag_time",
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ .data = &init_net.ieee802154_lowpan.frags.timeout,
++#else
++ .data = &ieee802154_lowpan.frags.timeout,
++#endif
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_jiffies,
+ },
+ {
+ .procname = "6lowpanfrag_max_datagram_size",
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0))
+ .data = &init_net.ieee802154_lowpan.max_dsize,
++#else
++ .data = &ieee802154_lowpan.max_dsize,
++#endif
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
diff --git a/patches/collateral-evolutions/network/0013-net-user-ns.patch b/patches/collateral-evolutions/network/0013-net-user-ns.patch
new file mode 100644
index 00000000..25752ca2
--- /dev/null
+++ b/patches/collateral-evolutions/network/0013-net-user-ns.patch
@@ -0,0 +1,17 @@
+network namespaces didn't get usernamespaces pegged until 3.8
+via commit 038e7332b8.
+
+--- a/net/ieee802154/reassembly.c
++++ b/net/ieee802154/reassembly.c
+@@ -472,9 +472,11 @@ static int __net_init lowpan_frags_ns_sy
+ table[2].data = &ieee802154_lowpan->frags.timeout;
+ table[3].data = &ieee802154_lowpan->max_dsize;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ /* Don't export sysctls to unprivileged users */
+ if (net->user_ns != &init_user_ns)
+ table[0].procname = NULL;
++#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3,8,0) */
+ }
+
+ hdr = register_net_sysctl(net, "net/ieee802154/6lowpan", table);
diff --git a/patches/collateral-evolutions/network/0014-inet_frag_evictor.patch b/patches/collateral-evolutions/network/0014-inet_frag_evictor.patch
new file mode 100644
index 00000000..cfcbb4df
--- /dev/null
+++ b/patches/collateral-evolutions/network/0014-inet_frag_evictor.patch
@@ -0,0 +1,20 @@
+We can't backport this with a macro or inline helper, so just
+carry the patch and if this grows consider Coccinelle SmPL version.
+
+--- a/net/ieee802154/reassembly.c
++++ b/net/ieee802154/reassembly.c
+@@ -374,7 +374,14 @@ int lowpan_frag_rcv(struct sk_buff *skb,
+ if (frag_info->d_size > ieee802154_lowpan->max_dsize)
+ goto err;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+ inet_frag_evictor(&ieee802154_lowpan->frags, &lowpan_frags, false);
++#else
++ if (atomic_read(&ieee802154_lowpan->frags.mem) <= &ieee802154_lowpan->frags.high_thresh)
++ return 0;
++ else
++ inet_frag_evictor(&ieee802154_lowpan->frags, &lowpan_frags);
++#endif
+
+ fq = fq_find(net, frag_info, &mac_cb(skb)->sa, &mac_cb(skb)->da);
+ if (fq != NULL) {