diff options
-rw-r--r-- | include/net/inet_common.h | 2 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 4 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 4 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 12 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 5 | ||||
-rw-r--r-- | net/sctp/protocol.c | 4 |
7 files changed, 14 insertions, 21 deletions
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index d6238bdefbaf..4bfcf3f3555f 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
@@ -39,7 +39,7 @@ extern int inet_getname(struct socket *sock, | |||
39 | extern int inet_ioctl(struct socket *sock, | 39 | extern int inet_ioctl(struct socket *sock, |
40 | unsigned int cmd, unsigned long arg); | 40 | unsigned int cmd, unsigned long arg); |
41 | 41 | ||
42 | extern int inet_ctl_sock_create(struct socket **sock, | 42 | extern int inet_ctl_sock_create(struct sock **sk, |
43 | unsigned short family, | 43 | unsigned short family, |
44 | unsigned short type, | 44 | unsigned short type, |
45 | unsigned char protocol); | 45 | unsigned char protocol); |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index feb3fa5b7141..5669c895c873 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -991,7 +991,6 @@ static struct inet_protosw dccp_v4_protosw = { | |||
991 | 991 | ||
992 | static int __init dccp_v4_init(void) | 992 | static int __init dccp_v4_init(void) |
993 | { | 993 | { |
994 | struct socket *socket; | ||
995 | int err = proto_register(&dccp_v4_prot, 1); | 994 | int err = proto_register(&dccp_v4_prot, 1); |
996 | 995 | ||
997 | if (err != 0) | 996 | if (err != 0) |
@@ -1003,11 +1002,10 @@ static int __init dccp_v4_init(void) | |||
1003 | 1002 | ||
1004 | inet_register_protosw(&dccp_v4_protosw); | 1003 | inet_register_protosw(&dccp_v4_protosw); |
1005 | 1004 | ||
1006 | err = inet_ctl_sock_create(&socket, PF_INET, | 1005 | err = inet_ctl_sock_create(&dccp_v4_ctl_sk, PF_INET, |
1007 | SOCK_DCCP, IPPROTO_DCCP); | 1006 | SOCK_DCCP, IPPROTO_DCCP); |
1008 | if (err) | 1007 | if (err) |
1009 | goto out_unregister_protosw; | 1008 | goto out_unregister_protosw; |
1010 | dccp_v4_ctl_sk = socket->sk; | ||
1011 | out: | 1009 | out: |
1012 | return err; | 1010 | return err; |
1013 | out_unregister_protosw: | 1011 | out_unregister_protosw: |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 5690fbd3bf68..cf598bfc6a18 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -1173,7 +1173,6 @@ static struct inet_protosw dccp_v6_protosw = { | |||
1173 | 1173 | ||
1174 | static int __init dccp_v6_init(void) | 1174 | static int __init dccp_v6_init(void) |
1175 | { | 1175 | { |
1176 | struct socket *socket; | ||
1177 | int err = proto_register(&dccp_v6_prot, 1); | 1176 | int err = proto_register(&dccp_v6_prot, 1); |
1178 | 1177 | ||
1179 | if (err != 0) | 1178 | if (err != 0) |
@@ -1185,11 +1184,10 @@ static int __init dccp_v6_init(void) | |||
1185 | 1184 | ||
1186 | inet6_register_protosw(&dccp_v6_protosw); | 1185 | inet6_register_protosw(&dccp_v6_protosw); |
1187 | 1186 | ||
1188 | err = inet_ctl_sock_create(&socket, PF_INET6, | 1187 | err = inet_ctl_sock_create(&dccp_v6_ctl_sk, PF_INET6, |
1189 | SOCK_DCCP, IPPROTO_DCCP); | 1188 | SOCK_DCCP, IPPROTO_DCCP); |
1190 | if (err != 0) | 1189 | if (err != 0) |
1191 | goto out_unregister_protosw; | 1190 | goto out_unregister_protosw; |
1192 | dccp_v6_ctl_sk = socket->sk; | ||
1193 | out: | 1191 | out: |
1194 | return err; | 1192 | return err; |
1195 | out_unregister_protosw: | 1193 | out_unregister_protosw: |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 7ab0bd64c9d1..cad664bf3f2e 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1250,19 +1250,21 @@ out: | |||
1250 | return segs; | 1250 | return segs; |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | int inet_ctl_sock_create(struct socket **sock, unsigned short family, | 1253 | int inet_ctl_sock_create(struct sock **sk, unsigned short family, |
1254 | unsigned short type, unsigned char protocol) | 1254 | unsigned short type, unsigned char protocol) |
1255 | { | 1255 | { |
1256 | int rc = sock_create_kern(family, type, protocol, sock); | 1256 | struct socket *sock; |
1257 | int rc = sock_create_kern(family, type, protocol, &sock); | ||
1257 | 1258 | ||
1258 | if (rc == 0) { | 1259 | if (rc == 0) { |
1259 | (*sock)->sk->sk_allocation = GFP_ATOMIC; | 1260 | *sk = sock->sk; |
1260 | inet_sk((*sock)->sk)->uc_ttl = -1; | 1261 | (*sk)->sk_allocation = GFP_ATOMIC; |
1262 | inet_sk(*sk)->uc_ttl = -1; | ||
1261 | /* | 1263 | /* |
1262 | * Unhash it so that IP input processing does not even see it, | 1264 | * Unhash it so that IP input processing does not even see it, |
1263 | * we do not wish this socket to see incoming packets. | 1265 | * we do not wish this socket to see incoming packets. |
1264 | */ | 1266 | */ |
1265 | (*sock)->sk->sk_prot->unhash((*sock)->sk); | 1267 | (*sk)->sk_prot->unhash(*sk); |
1266 | } | 1268 | } |
1267 | return rc; | 1269 | return rc; |
1268 | } | 1270 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index edf5a37bb5c3..cfe5df76e14b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2490,11 +2490,9 @@ struct proto tcp_prot = { | |||
2490 | 2490 | ||
2491 | void __init tcp_v4_init(void) | 2491 | void __init tcp_v4_init(void) |
2492 | { | 2492 | { |
2493 | struct socket *__tcp_socket; | 2493 | if (inet_ctl_sock_create(&tcp_sock, PF_INET, SOCK_RAW, |
2494 | if (inet_ctl_sock_create(&__tcp_socket, PF_INET, SOCK_RAW, | ||
2495 | IPPROTO_TCP) < 0) | 2494 | IPPROTO_TCP) < 0) |
2496 | panic("Failed to create the TCP control socket.\n"); | 2495 | panic("Failed to create the TCP control socket.\n"); |
2497 | tcp_sock = __tcp_socket->sk; | ||
2498 | } | 2496 | } |
2499 | 2497 | ||
2500 | EXPORT_SYMBOL(ipv4_specific); | 2498 | EXPORT_SYMBOL(ipv4_specific); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index d98222fba041..2882cc51669e 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -2200,14 +2200,13 @@ static struct inet_protosw tcpv6_protosw = { | |||
2200 | static int tcpv6_net_init(struct net *net) | 2200 | static int tcpv6_net_init(struct net *net) |
2201 | { | 2201 | { |
2202 | int err; | 2202 | int err; |
2203 | struct socket *sock; | ||
2204 | struct sock *sk; | 2203 | struct sock *sk; |
2205 | 2204 | ||
2206 | err = inet_ctl_sock_create(&sock, PF_INET6, SOCK_RAW, IPPROTO_TCP); | 2205 | err = inet_ctl_sock_create(&sk, PF_INET6, SOCK_RAW, IPPROTO_TCP); |
2207 | if (err) | 2206 | if (err) |
2208 | return err; | 2207 | return err; |
2209 | 2208 | ||
2210 | net->ipv6.tcp_sk = sk = sock->sk; | 2209 | net->ipv6.tcp_sk = sk; |
2211 | sk_change_net(sk, net); | 2210 | sk_change_net(sk, net); |
2212 | return err; | 2211 | return err; |
2213 | } | 2212 | } |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index ac0833c19450..3c08d334d4a8 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -674,21 +674,19 @@ static int sctp_ctl_sock_init(void) | |||
674 | { | 674 | { |
675 | int err; | 675 | int err; |
676 | sa_family_t family; | 676 | sa_family_t family; |
677 | struct socket *socket; | ||
678 | 677 | ||
679 | if (sctp_get_pf_specific(PF_INET6)) | 678 | if (sctp_get_pf_specific(PF_INET6)) |
680 | family = PF_INET6; | 679 | family = PF_INET6; |
681 | else | 680 | else |
682 | family = PF_INET; | 681 | family = PF_INET; |
683 | 682 | ||
684 | err = inet_ctl_sock_create(&socket, family, | 683 | err = inet_ctl_sock_create(&sctp_ctl_sock, family, |
685 | SOCK_SEQPACKET, IPPROTO_SCTP); | 684 | SOCK_SEQPACKET, IPPROTO_SCTP); |
686 | if (err < 0) { | 685 | if (err < 0) { |
687 | printk(KERN_ERR | 686 | printk(KERN_ERR |
688 | "SCTP: Failed to create the SCTP control socket.\n"); | 687 | "SCTP: Failed to create the SCTP control socket.\n"); |
689 | return err; | 688 | return err; |
690 | } | 689 | } |
691 | sctp_ctl_sock = socket->sk; | ||
692 | return 0; | 690 | return 0; |
693 | } | 691 | } |
694 | 692 | ||