aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-06 04:46:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-15 02:29:59 -0400
commitbb2db45b5495455ec7580315029184550709f4a2 (patch)
treeec79a1e987bcb1a93b389012d0d0eb2830f34b5c /net/sctp/protocol.c
parent13d782f6b4fbbaf9d0380a9947deb45a9de46ae7 (diff)
sctp: Enable sctp in all network namespaces
- Fix the sctp_af operations to work in all namespaces - Enable sctp socket creation in all network namespaces. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index de7994edb4ca..059c914c09f2 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -367,7 +367,8 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
367/* Should this be available for binding? */ 367/* Should this be available for binding? */
368static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) 368static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
369{ 369{
370 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr); 370 struct net *net = sock_net(&sp->inet.sk);
371 int ret = inet_addr_type(net, addr->v4.sin_addr.s_addr);
371 372
372 373
373 if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) && 374 if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) &&
@@ -454,7 +455,7 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
454 SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", 455 SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ",
455 __func__, &fl4->daddr, &fl4->saddr); 456 __func__, &fl4->daddr, &fl4->saddr);
456 457
457 rt = ip_route_output_key(&init_net, fl4); 458 rt = ip_route_output_key(sock_net(sk), fl4);
458 if (!IS_ERR(rt)) 459 if (!IS_ERR(rt))
459 dst = &rt->dst; 460 dst = &rt->dst;
460 461
@@ -500,7 +501,7 @@ static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
500 (AF_INET == laddr->a.sa.sa_family)) { 501 (AF_INET == laddr->a.sa.sa_family)) {
501 fl4->saddr = laddr->a.v4.sin_addr.s_addr; 502 fl4->saddr = laddr->a.v4.sin_addr.s_addr;
502 fl4->fl4_sport = laddr->a.v4.sin_port; 503 fl4->fl4_sport = laddr->a.v4.sin_port;
503 rt = ip_route_output_key(&init_net, fl4); 504 rt = ip_route_output_key(sock_net(sk), fl4);
504 if (!IS_ERR(rt)) { 505 if (!IS_ERR(rt)) {
505 dst = &rt->dst; 506 dst = &rt->dst;
506 goto out_unlock; 507 goto out_unlock;
@@ -1033,6 +1034,7 @@ static const struct net_protocol sctp_protocol = {
1033 .handler = sctp_rcv, 1034 .handler = sctp_rcv,
1034 .err_handler = sctp_v4_err, 1035 .err_handler = sctp_v4_err,
1035 .no_policy = 1, 1036 .no_policy = 1,
1037 .netns_ok = 1,
1036}; 1038};
1037 1039
1038/* IPv4 address related functions. */ 1040/* IPv4 address related functions. */