netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, devel@openvz.org,
	containers@lists.osdl.org, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 10/12 net-2.6.25] [NETNS]: Correct namespace for connect-time routing.
Date: Wed, 23 Jan 2008 10:46:25 +0300	[thread overview]
Message-ID: <1201074387-7366-1-git-send-email-den@openvz.org> (raw)
In-Reply-To: <479612BE.8030409@openvz.org>

ip_route_connect and ip_route_newports are a part of routing API presented to
the socket layer. The namespace is available inside them through a socket.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 include/net/route.h |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/net/route.h b/include/net/route.h
index d9b876a..1985d82 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -33,6 +33,7 @@
 #include <linux/ip.h>
 #include <linux/cache.h>
 #include <linux/security.h>
+#include <net/sock.h>
 
 #ifndef __KERNEL__
 #warning This file is not supposed to be used outside of kernel.
@@ -157,8 +158,9 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
 					 .dport = dport } } };
 
 	int err;
+	struct net *net = sk->sk_net;
 	if (!dst || !src) {
-		err = __ip_route_output_key(&init_net, rp, &fl);
+		err = __ip_route_output_key(net, rp, &fl);
 		if (err)
 			return err;
 		fl.fl4_dst = (*rp)->rt_dst;
@@ -167,7 +169,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
 		*rp = NULL;
 	}
 	security_sk_classify_flow(sk, &fl);
-	return ip_route_output_flow(&init_net, rp, &fl, sk, flags);
+	return ip_route_output_flow(net, rp, &fl, sk, flags);
 }
 
 static inline int ip_route_newports(struct rtable **rp, u8 protocol,
@@ -184,7 +186,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
 		ip_rt_put(*rp);
 		*rp = NULL;
 		security_sk_classify_flow(sk, &fl);
-		return ip_route_output_flow(&init_net, rp, &fl, sk, 0);
+		return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0);
 	}
 	return 0;
 }
-- 
1.5.3.rc5


  parent reply	other threads:[~2008-01-23  7:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22 15:58 [PATCH 0/12 net-2.6.25] [NETNS]: Routing namespacing on IP output path Denis V. Lunev
2008-01-22 15:59 ` [PATCH 1/12 net-2.6.25] [IPV4]: Declarations cleanup in ip_fib.h Denis V. Lunev
2008-01-22 15:59 ` [PATCH 2/12 net-2.6.25] [IPV4]: Consolidate fib_select_default Denis V. Lunev
2008-01-22 15:59 ` [PATCH 3/12 net-2.6.25] [NETNS]: Add netns parameter to fib_select_default Denis V. Lunev
2008-01-22 15:59 ` [PATCH 4/12 net-2.6.25] [NETNS]: Add namespace parameter to ip_dev_find Denis V. Lunev
2008-01-22 15:59 ` [PATCH 5/12 net-2.6.25] [NETNS]: Re-export init_net via EXPORT_SYMBOL Denis V. Lunev
2008-01-22 17:04   ` Patrick McHardy
2008-01-22 17:19     ` Denis V. Lunev
2008-01-23  6:08       ` David Miller
2008-01-22 15:59 ` [PATCH 6/12 net-2.6.25] [NETNS]: Add namespace parameter to ip_route_output_slow Denis V. Lunev
2008-01-22 15:59 ` [PATCH 7/12 net-2.6.25] [NETNS]: Add namespace parameter to __ip_route_output_key Denis V. Lunev
2008-01-22 15:59 ` [PATCH 8/12 net-2.6.25] [NETNS]: Add namespace parameter to ip_route_output_flow Denis V. Lunev
2008-01-22 15:59 ` [PATCH 9/12 net-2.6.25] [NETNS]: Add namespace parameter to ip_route_output_key Denis V. Lunev
2008-01-23  6:09 ` [PATCH 0/12 net-2.6.25] [NETNS]: Routing namespacing on IP output path David Miller
2008-01-23  7:46 ` Denis V. Lunev [this message]
2008-01-23  7:51   ` [PATCH 10/12 net-2.6.25] [NETNS]: Correct namespace for connect-time routing David Miller
2008-01-23  7:46 ` [PATCH 11/12 net-2.6.25] [NETNS]: Routing cache virtualization Denis V. Lunev
2008-01-23  7:51   ` David Miller
2008-01-23  7:46 ` [PATCH 12/12 net-2.6.25] [NETNS]: Add namespace for ICMP replying code Denis V. Lunev
2008-01-23  7:51   ` David Miller
     [not found]     ` <20080122.235130.84789113.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-01-23  9:16       ` Mathieu Lacage
2008-01-23  9:30         ` YOSHIFUJI Hideaki / 吉藤英明

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201074387-7366-1-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=containers@lists.osdl.org \
    --cc=davem@davemloft.net \
    --cc=devel@openvz.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).