Patchwork net: shy netns_ok check

login
register
mail settings
Submitter Alexey Dobriyan
Date Nov. 12, 2008, 12:15 a.m.
Message ID <20081112001509.GA2749@x200.localdomain>
Download mbox | patch
Permalink /patch/8215/
State Accepted
Delegated to: David Miller
Headers show

Comments

Alexey Dobriyan - Nov. 12, 2008, 12:15 a.m.
Sigh...

Failure to pass netns_ok check is SILENT, except some MIB counted is
incremented somewhere.

And adding "netns_ok = 1" (after long head-scratching session) is usually
the last step in making some protocol netns-ready...

Please, apply.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 net/ipv4/ip_input.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Nov. 13, 2008, 7:24 a.m.
From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Wed, 12 Nov 2008 03:15:09 +0300

> Sigh...
> 
> Failure to pass netns_ok check is SILENT, except some MIB counted is
> incremented somewhere.
> 
> And adding "netns_ok = 1" (after long head-scratching session) is usually
> the last step in making some protocol netns-ready...
> 
> Please, apply.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied, thanks Alexey.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -209,9 +209,17 @@  static int ip_local_deliver_finish(struct sk_buff *skb)
 
 		hash = protocol & (MAX_INET_PROTOS - 1);
 		ipprot = rcu_dereference(inet_protos[hash]);
-		if (ipprot != NULL && (net == &init_net || ipprot->netns_ok)) {
+		if (ipprot != NULL) {
 			int ret;
 
+			if (!net_eq(net, &init_net) && !ipprot->netns_ok) {
+				if (net_ratelimit())
+					printk("%s: proto %d isn't netns-ready\n",
+						__func__, protocol);
+				kfree_skb(skb);
+				goto out;
+			}
+
 			if (!ipprot->no_policy) {
 				if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
 					kfree_skb(skb);