aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-03-24 18:31:35 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-24 18:31:35 -0400
commit05cf89d40c85e622dac20e44713168767be5c520 (patch)
tree81e7826794b95fe027ba8ecb10134460d42d1196
parentcb84663e4d239f23f0d872bc6463c272e74daad8 (diff)
[NETNS]: Process INET socket layer in the correct namespace.
Replace all the reast of the init_net with a proper net on the socket layer. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/af_inet.c4
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/udp.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 44f5ce1fbfa4..a9e241cdc5b2 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -446,7 +446,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
446 if (addr_len < sizeof(struct sockaddr_in)) 446 if (addr_len < sizeof(struct sockaddr_in))
447 goto out; 447 goto out;
448 448
449 chk_addr_ret = inet_addr_type(&init_net, addr->sin_addr.s_addr); 449 chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr);
450 450
451 /* Not specified by any standard per-se, however it breaks too 451 /* Not specified by any standard per-se, however it breaks too
452 * many applications when removed. It is unfortunate since 452 * many applications when removed. It is unfortunate since
@@ -1114,7 +1114,7 @@ int inet_sk_rebuild_header(struct sock *sk)
1114 }; 1114 };
1115 1115
1116 security_sk_classify_flow(sk, &fl); 1116 security_sk_classify_flow(sk, &fl);
1117 err = ip_route_output_flow(&init_net, &rt, &fl, sk, 0); 1117 err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0);
1118} 1118}
1119 if (!err) 1119 if (!err)
1120 sk_setup_caps(sk, &rt->u.dst); 1120 sk_setup_caps(sk, &rt->u.dst);
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index f9c5c4def1ba..d13c5f12bb32 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -333,7 +333,7 @@ struct dst_entry* inet_csk_route_req(struct sock *sk,
333 .dport = ireq->rmt_port } } }; 333 .dport = ireq->rmt_port } } };
334 334
335 security_req_classify_flow(req, &fl); 335 security_req_classify_flow(req, &fl);
336 if (ip_route_output_flow(&init_net, &rt, &fl, sk, 0)) { 336 if (ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0)) {
337 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); 337 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
338 return NULL; 338 return NULL;
339 } 339 }
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 7d29a05bf887..3f68a937b602 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -499,7 +499,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
499 ipc.oif = sk->sk_bound_dev_if; 499 ipc.oif = sk->sk_bound_dev_if;
500 500
501 if (msg->msg_controllen) { 501 if (msg->msg_controllen) {
502 err = ip_cmsg_send(&init_net, msg, &ipc); 502 err = ip_cmsg_send(sk->sk_net, msg, &ipc);
503 if (err) 503 if (err)
504 goto out; 504 goto out;
505 if (ipc.opt) 505 if (ipc.opt)
@@ -553,7 +553,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
553 } 553 }
554 554
555 security_sk_classify_flow(sk, &fl); 555 security_sk_classify_flow(sk, &fl);
556 err = ip_route_output_flow(&init_net, &rt, &fl, sk, 1); 556 err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1);
557 } 557 }
558 if (err) 558 if (err)
559 goto done; 559 goto done;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d142b87e9eb8..b37581dfd029 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -607,7 +607,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
607 607
608 ipc.oif = sk->sk_bound_dev_if; 608 ipc.oif = sk->sk_bound_dev_if;
609 if (msg->msg_controllen) { 609 if (msg->msg_controllen) {
610 err = ip_cmsg_send(&init_net, msg, &ipc); 610 err = ip_cmsg_send(sk->sk_net, msg, &ipc);
611 if (err) 611 if (err)
612 return err; 612 return err;
613 if (ipc.opt) 613 if (ipc.opt)
@@ -656,7 +656,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
656 { .sport = inet->sport, 656 { .sport = inet->sport,
657 .dport = dport } } }; 657 .dport = dport } } };
658 security_sk_classify_flow(sk, &fl); 658 security_sk_classify_flow(sk, &fl);
659 err = ip_route_output_flow(&init_net, &rt, &fl, sk, 1); 659 err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1);
660 if (err) { 660 if (err) {
661 if (err == -ENETUNREACH) 661 if (err == -ENETUNREACH)
662 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); 662 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);