diff options
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/Makefile | 7 | ||||
-rw-r--r-- | net/dccp/dccp.h | 6 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 140 | ||||
-rw-r--r-- | net/dccp/options.c | 2 | ||||
-rw-r--r-- | net/dccp/output.c | 2 | ||||
-rw-r--r-- | net/dccp/proto.c | 132 |
6 files changed, 148 insertions, 141 deletions
diff --git a/net/dccp/Makefile b/net/dccp/Makefile index 7af0569fe4cb..7696e219b05d 100644 --- a/net/dccp/Makefile +++ b/net/dccp/Makefile | |||
@@ -2,10 +2,11 @@ obj-$(CONFIG_IPV6) += dccp_ipv6.o | |||
2 | 2 | ||
3 | dccp_ipv6-y := ipv6.o | 3 | dccp_ipv6-y := ipv6.o |
4 | 4 | ||
5 | obj-$(CONFIG_IP_DCCP) += dccp.o | 5 | obj-$(CONFIG_IP_DCCP) += dccp.o dccp_ipv4.o |
6 | 6 | ||
7 | dccp-y := ccid.o feat.o input.o ipv4.o minisocks.o options.o output.o proto.o \ | 7 | dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o |
8 | timer.o | 8 | |
9 | dccp_ipv4-y := ipv4.o | ||
9 | 10 | ||
10 | dccp-$(CONFIG_IP_DCCP_ACKVEC) += ackvec.o | 11 | dccp-$(CONFIG_IP_DCCP_ACKVEC) += ackvec.o |
11 | 12 | ||
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index b6ea4cc12608..46aa4814d65f 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -59,8 +59,6 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo); | |||
59 | 59 | ||
60 | #define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */ | 60 | #define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */ |
61 | 61 | ||
62 | extern struct proto dccp_prot; | ||
63 | |||
64 | /* is seq1 < seq2 ? */ | 62 | /* is seq1 < seq2 ? */ |
65 | static inline int before48(const u64 seq1, const u64 seq2) | 63 | static inline int before48(const u64 seq1, const u64 seq2) |
66 | { | 64 | { |
@@ -209,10 +207,6 @@ extern struct sock *dccp_create_openreq_child(struct sock *sk, | |||
209 | 207 | ||
210 | extern int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); | 208 | extern int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); |
211 | 209 | ||
212 | extern void dccp_v4_err(struct sk_buff *skb, u32); | ||
213 | |||
214 | extern int dccp_v4_rcv(struct sk_buff *skb); | ||
215 | |||
216 | extern struct sock *dccp_v4_request_recv_sock(struct sock *sk, | 210 | extern struct sock *dccp_v4_request_recv_sock(struct sock *sk, |
217 | struct sk_buff *skb, | 211 | struct sk_buff *skb, |
218 | struct request_sock *req, | 212 | struct request_sock *req, |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index a7332f0f85c4..033c3ab8fe33 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -18,8 +18,10 @@ | |||
18 | #include <linux/random.h> | 18 | #include <linux/random.h> |
19 | 19 | ||
20 | #include <net/icmp.h> | 20 | #include <net/icmp.h> |
21 | #include <net/inet_common.h> | ||
21 | #include <net/inet_hashtables.h> | 22 | #include <net/inet_hashtables.h> |
22 | #include <net/inet_sock.h> | 23 | #include <net/inet_sock.h> |
24 | #include <net/protocol.h> | ||
23 | #include <net/sock.h> | 25 | #include <net/sock.h> |
24 | #include <net/timewait_sock.h> | 26 | #include <net/timewait_sock.h> |
25 | #include <net/tcp_states.h> | 27 | #include <net/tcp_states.h> |
@@ -285,7 +287,7 @@ out: | |||
285 | * check at all. A more general error queue to queue errors for later handling | 287 | * check at all. A more general error queue to queue errors for later handling |
286 | * is probably better. | 288 | * is probably better. |
287 | */ | 289 | */ |
288 | void dccp_v4_err(struct sk_buff *skb, u32 info) | 290 | static void dccp_v4_err(struct sk_buff *skb, u32 info) |
289 | { | 291 | { |
290 | const struct iphdr *iph = (struct iphdr *)skb->data; | 292 | const struct iphdr *iph = (struct iphdr *)skb->data; |
291 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + | 293 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + |
@@ -639,6 +641,8 @@ int dccp_v4_checksum(const struct sk_buff *skb, const __be32 saddr, | |||
639 | IPPROTO_DCCP, tmp); | 641 | IPPROTO_DCCP, tmp); |
640 | } | 642 | } |
641 | 643 | ||
644 | EXPORT_SYMBOL_GPL(dccp_v4_checksum); | ||
645 | |||
642 | static int dccp_v4_verify_checksum(struct sk_buff *skb, | 646 | static int dccp_v4_verify_checksum(struct sk_buff *skb, |
643 | const __be32 saddr, const __be32 daddr) | 647 | const __be32 saddr, const __be32 daddr) |
644 | { | 648 | { |
@@ -871,7 +875,7 @@ int dccp_invalid_packet(struct sk_buff *skb) | |||
871 | EXPORT_SYMBOL_GPL(dccp_invalid_packet); | 875 | EXPORT_SYMBOL_GPL(dccp_invalid_packet); |
872 | 876 | ||
873 | /* this is called when real data arrives */ | 877 | /* this is called when real data arrives */ |
874 | int dccp_v4_rcv(struct sk_buff *skb) | 878 | static int dccp_v4_rcv(struct sk_buff *skb) |
875 | { | 879 | { |
876 | const struct dccp_hdr *dh; | 880 | const struct dccp_hdr *dh; |
877 | struct sock *sk; | 881 | struct sock *sk; |
@@ -978,7 +982,7 @@ do_time_wait: | |||
978 | goto no_dccp_socket; | 982 | goto no_dccp_socket; |
979 | } | 983 | } |
980 | 984 | ||
981 | struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { | 985 | static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { |
982 | .queue_xmit = ip_queue_xmit, | 986 | .queue_xmit = ip_queue_xmit, |
983 | .send_check = dccp_v4_send_check, | 987 | .send_check = dccp_v4_send_check, |
984 | .rebuild_header = inet_sk_rebuild_header, | 988 | .rebuild_header = inet_sk_rebuild_header, |
@@ -1018,7 +1022,7 @@ static struct timewait_sock_ops dccp_timewait_sock_ops = { | |||
1018 | .twsk_obj_size = sizeof(struct inet_timewait_sock), | 1022 | .twsk_obj_size = sizeof(struct inet_timewait_sock), |
1019 | }; | 1023 | }; |
1020 | 1024 | ||
1021 | struct proto dccp_prot = { | 1025 | struct proto dccp_v4_prot = { |
1022 | .name = "DCCP", | 1026 | .name = "DCCP", |
1023 | .owner = THIS_MODULE, | 1027 | .owner = THIS_MODULE, |
1024 | .close = dccp_close, | 1028 | .close = dccp_close, |
@@ -1044,4 +1048,130 @@ struct proto dccp_prot = { | |||
1044 | .twsk_prot = &dccp_timewait_sock_ops, | 1048 | .twsk_prot = &dccp_timewait_sock_ops, |
1045 | }; | 1049 | }; |
1046 | 1050 | ||
1047 | EXPORT_SYMBOL_GPL(dccp_prot); | 1051 | static struct net_protocol dccp_v4_protocol = { |
1052 | .handler = dccp_v4_rcv, | ||
1053 | .err_handler = dccp_v4_err, | ||
1054 | .no_policy = 1, | ||
1055 | }; | ||
1056 | |||
1057 | static const struct proto_ops inet_dccp_ops = { | ||
1058 | .family = PF_INET, | ||
1059 | .owner = THIS_MODULE, | ||
1060 | .release = inet_release, | ||
1061 | .bind = inet_bind, | ||
1062 | .connect = inet_stream_connect, | ||
1063 | .socketpair = sock_no_socketpair, | ||
1064 | .accept = inet_accept, | ||
1065 | .getname = inet_getname, | ||
1066 | /* FIXME: work on tcp_poll to rename it to inet_csk_poll */ | ||
1067 | .poll = dccp_poll, | ||
1068 | .ioctl = inet_ioctl, | ||
1069 | /* FIXME: work on inet_listen to rename it to sock_common_listen */ | ||
1070 | .listen = inet_dccp_listen, | ||
1071 | .shutdown = inet_shutdown, | ||
1072 | .setsockopt = sock_common_setsockopt, | ||
1073 | .getsockopt = sock_common_getsockopt, | ||
1074 | .sendmsg = inet_sendmsg, | ||
1075 | .recvmsg = sock_common_recvmsg, | ||
1076 | .mmap = sock_no_mmap, | ||
1077 | .sendpage = sock_no_sendpage, | ||
1078 | }; | ||
1079 | |||
1080 | static struct inet_protosw dccp_v4_protosw = { | ||
1081 | .type = SOCK_DCCP, | ||
1082 | .protocol = IPPROTO_DCCP, | ||
1083 | .prot = &dccp_v4_prot, | ||
1084 | .ops = &inet_dccp_ops, | ||
1085 | .capability = -1, | ||
1086 | .no_check = 0, | ||
1087 | .flags = INET_PROTOSW_ICSK, | ||
1088 | }; | ||
1089 | |||
1090 | /* | ||
1091 | * This is the global socket data structure used for responding to | ||
1092 | * the Out-of-the-blue (OOTB) packets. A control sock will be created | ||
1093 | * for this socket at the initialization time. | ||
1094 | */ | ||
1095 | struct socket *dccp_ctl_socket; | ||
1096 | |||
1097 | static char dccp_ctl_socket_err_msg[] __initdata = | ||
1098 | KERN_ERR "DCCP: Failed to create the control socket.\n"; | ||
1099 | |||
1100 | static int __init dccp_ctl_sock_init(void) | ||
1101 | { | ||
1102 | int rc = sock_create_kern(PF_INET, SOCK_DCCP, IPPROTO_DCCP, | ||
1103 | &dccp_ctl_socket); | ||
1104 | if (rc < 0) | ||
1105 | printk(dccp_ctl_socket_err_msg); | ||
1106 | else { | ||
1107 | dccp_ctl_socket->sk->sk_allocation = GFP_ATOMIC; | ||
1108 | inet_sk(dccp_ctl_socket->sk)->uc_ttl = -1; | ||
1109 | |||
1110 | /* Unhash it so that IP input processing does not even | ||
1111 | * see it, we do not wish this socket to see incoming | ||
1112 | * packets. | ||
1113 | */ | ||
1114 | dccp_ctl_socket->sk->sk_prot->unhash(dccp_ctl_socket->sk); | ||
1115 | } | ||
1116 | |||
1117 | return rc; | ||
1118 | } | ||
1119 | |||
1120 | #ifdef CONFIG_IP_DCCP_UNLOAD_HACK | ||
1121 | void dccp_ctl_sock_exit(void) | ||
1122 | { | ||
1123 | if (dccp_ctl_socket != NULL) { | ||
1124 | sock_release(dccp_ctl_socket); | ||
1125 | dccp_ctl_socket = NULL; | ||
1126 | } | ||
1127 | } | ||
1128 | |||
1129 | EXPORT_SYMBOL_GPL(dccp_ctl_sock_exit); | ||
1130 | #endif | ||
1131 | |||
1132 | static int __init dccp_v4_init(void) | ||
1133 | { | ||
1134 | int err = proto_register(&dccp_v4_prot, 1); | ||
1135 | |||
1136 | if (err != 0) | ||
1137 | goto out; | ||
1138 | |||
1139 | err = inet_add_protocol(&dccp_v4_protocol, IPPROTO_DCCP); | ||
1140 | if (err != 0) | ||
1141 | goto out_proto_unregister; | ||
1142 | |||
1143 | inet_register_protosw(&dccp_v4_protosw); | ||
1144 | |||
1145 | err = dccp_ctl_sock_init(); | ||
1146 | if (err) | ||
1147 | goto out_unregister_protosw; | ||
1148 | out: | ||
1149 | return err; | ||
1150 | out_unregister_protosw: | ||
1151 | inet_unregister_protosw(&dccp_v4_protosw); | ||
1152 | inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP); | ||
1153 | out_proto_unregister: | ||
1154 | proto_unregister(&dccp_v4_prot); | ||
1155 | goto out; | ||
1156 | } | ||
1157 | |||
1158 | static void __exit dccp_v4_exit(void) | ||
1159 | { | ||
1160 | inet_unregister_protosw(&dccp_v4_protosw); | ||
1161 | inet_del_protocol(&dccp_v4_protocol, IPPROTO_DCCP); | ||
1162 | proto_unregister(&dccp_v4_prot); | ||
1163 | } | ||
1164 | |||
1165 | module_init(dccp_v4_init); | ||
1166 | module_exit(dccp_v4_exit); | ||
1167 | |||
1168 | /* | ||
1169 | * __stringify doesn't likes enums, so use SOCK_DCCP (6) and IPPROTO_DCCP (33) | ||
1170 | * values directly, Also cover the case where the protocol is not specified, | ||
1171 | * i.e. net-pf-PF_INET-proto-0-type-SOCK_DCCP | ||
1172 | */ | ||
1173 | MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-33-type-6"); | ||
1174 | MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-0-type-6"); | ||
1175 | MODULE_LICENSE("GPL"); | ||
1176 | MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>"); | ||
1177 | MODULE_DESCRIPTION("DCCP - Datagram Congestion Controlled Protocol"); | ||
diff --git a/net/dccp/options.c b/net/dccp/options.c index 3ecd319c0f59..79d228e4d6b2 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
@@ -258,6 +258,8 @@ out_invalid_option: | |||
258 | return -1; | 258 | return -1; |
259 | } | 259 | } |
260 | 260 | ||
261 | EXPORT_SYMBOL_GPL(dccp_parse_options); | ||
262 | |||
261 | static void dccp_encode_value_var(const u32 value, unsigned char *to, | 263 | static void dccp_encode_value_var(const u32 value, unsigned char *to, |
262 | const unsigned int len) | 264 | const unsigned int len) |
263 | { | 265 | { |
diff --git a/net/dccp/output.c b/net/dccp/output.c index 6bd21e37686e..8c83aa51572e 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -526,6 +526,8 @@ void dccp_send_sync(struct sock *sk, const u64 seq, | |||
526 | dccp_transmit_skb(sk, skb); | 526 | dccp_transmit_skb(sk, skb); |
527 | } | 527 | } |
528 | 528 | ||
529 | EXPORT_SYMBOL_GPL(dccp_send_sync); | ||
530 | |||
529 | /* | 531 | /* |
530 | * Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This | 532 | * Send a DCCP_PKT_CLOSE/CLOSEREQ. The caller locks the socket for us. This |
531 | * cannot be allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under | 533 | * cannot be allowed to fail queueing a DCCP_PKT_CLOSE/CLOSEREQ frame under |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index abab6c10af96..ef94b0c8a0c0 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -23,9 +23,7 @@ | |||
23 | #include <linux/random.h> | 23 | #include <linux/random.h> |
24 | #include <net/checksum.h> | 24 | #include <net/checksum.h> |
25 | 25 | ||
26 | #include <net/inet_common.h> | ||
27 | #include <net/inet_sock.h> | 26 | #include <net/inet_sock.h> |
28 | #include <net/protocol.h> | ||
29 | #include <net/sock.h> | 27 | #include <net/sock.h> |
30 | #include <net/xfrm.h> | 28 | #include <net/xfrm.h> |
31 | 29 | ||
@@ -55,12 +53,6 @@ struct inet_hashinfo __cacheline_aligned dccp_hashinfo = { | |||
55 | 53 | ||
56 | EXPORT_SYMBOL_GPL(dccp_hashinfo); | 54 | EXPORT_SYMBOL_GPL(dccp_hashinfo); |
57 | 55 | ||
58 | static struct net_protocol dccp_protocol = { | ||
59 | .handler = dccp_v4_rcv, | ||
60 | .err_handler = dccp_v4_err, | ||
61 | .no_policy = 1, | ||
62 | }; | ||
63 | |||
64 | const char *dccp_packet_name(const int type) | 56 | const char *dccp_packet_name(const int type) |
65 | { | 57 | { |
66 | static const char *dccp_packet_names[] = { | 58 | static const char *dccp_packet_names[] = { |
@@ -856,83 +848,6 @@ void dccp_shutdown(struct sock *sk, int how) | |||
856 | 848 | ||
857 | EXPORT_SYMBOL_GPL(dccp_shutdown); | 849 | EXPORT_SYMBOL_GPL(dccp_shutdown); |
858 | 850 | ||
859 | static const struct proto_ops inet_dccp_ops = { | ||
860 | .family = PF_INET, | ||
861 | .owner = THIS_MODULE, | ||
862 | .release = inet_release, | ||
863 | .bind = inet_bind, | ||
864 | .connect = inet_stream_connect, | ||
865 | .socketpair = sock_no_socketpair, | ||
866 | .accept = inet_accept, | ||
867 | .getname = inet_getname, | ||
868 | /* FIXME: work on tcp_poll to rename it to inet_csk_poll */ | ||
869 | .poll = dccp_poll, | ||
870 | .ioctl = inet_ioctl, | ||
871 | /* FIXME: work on inet_listen to rename it to sock_common_listen */ | ||
872 | .listen = inet_dccp_listen, | ||
873 | .shutdown = inet_shutdown, | ||
874 | .setsockopt = sock_common_setsockopt, | ||
875 | .getsockopt = sock_common_getsockopt, | ||
876 | .sendmsg = inet_sendmsg, | ||
877 | .recvmsg = sock_common_recvmsg, | ||
878 | .mmap = sock_no_mmap, | ||
879 | .sendpage = sock_no_sendpage, | ||
880 | }; | ||
881 | |||
882 | extern struct net_proto_family inet_family_ops; | ||
883 | |||
884 | static struct inet_protosw dccp_v4_protosw = { | ||
885 | .type = SOCK_DCCP, | ||
886 | .protocol = IPPROTO_DCCP, | ||
887 | .prot = &dccp_prot, | ||
888 | .ops = &inet_dccp_ops, | ||
889 | .capability = -1, | ||
890 | .no_check = 0, | ||
891 | .flags = INET_PROTOSW_ICSK, | ||
892 | }; | ||
893 | |||
894 | /* | ||
895 | * This is the global socket data structure used for responding to | ||
896 | * the Out-of-the-blue (OOTB) packets. A control sock will be created | ||
897 | * for this socket at the initialization time. | ||
898 | */ | ||
899 | struct socket *dccp_ctl_socket; | ||
900 | |||
901 | static char dccp_ctl_socket_err_msg[] __initdata = | ||
902 | KERN_ERR "DCCP: Failed to create the control socket.\n"; | ||
903 | |||
904 | static int __init dccp_ctl_sock_init(void) | ||
905 | { | ||
906 | int rc = sock_create_kern(PF_INET, SOCK_DCCP, IPPROTO_DCCP, | ||
907 | &dccp_ctl_socket); | ||
908 | if (rc < 0) | ||
909 | printk(dccp_ctl_socket_err_msg); | ||
910 | else { | ||
911 | dccp_ctl_socket->sk->sk_allocation = GFP_ATOMIC; | ||
912 | inet_sk(dccp_ctl_socket->sk)->uc_ttl = -1; | ||
913 | |||
914 | /* Unhash it so that IP input processing does not even | ||
915 | * see it, we do not wish this socket to see incoming | ||
916 | * packets. | ||
917 | */ | ||
918 | dccp_ctl_socket->sk->sk_prot->unhash(dccp_ctl_socket->sk); | ||
919 | } | ||
920 | |||
921 | return rc; | ||
922 | } | ||
923 | |||
924 | #ifdef CONFIG_IP_DCCP_UNLOAD_HACK | ||
925 | void dccp_ctl_sock_exit(void) | ||
926 | { | ||
927 | if (dccp_ctl_socket != NULL) { | ||
928 | sock_release(dccp_ctl_socket); | ||
929 | dccp_ctl_socket = NULL; | ||
930 | } | ||
931 | } | ||
932 | |||
933 | EXPORT_SYMBOL_GPL(dccp_ctl_sock_exit); | ||
934 | #endif | ||
935 | |||
936 | static int __init dccp_mib_init(void) | 851 | static int __init dccp_mib_init(void) |
937 | { | 852 | { |
938 | int rc = -ENOMEM; | 853 | int rc = -ENOMEM; |
@@ -955,7 +870,7 @@ out_free_one: | |||
955 | 870 | ||
956 | } | 871 | } |
957 | 872 | ||
958 | static int dccp_mib_exit(void) | 873 | static void dccp_mib_exit(void) |
959 | { | 874 | { |
960 | free_percpu(dccp_statistics[0]); | 875 | free_percpu(dccp_statistics[0]); |
961 | free_percpu(dccp_statistics[1]); | 876 | free_percpu(dccp_statistics[1]); |
@@ -978,18 +893,14 @@ static int __init dccp_init(void) | |||
978 | { | 893 | { |
979 | unsigned long goal; | 894 | unsigned long goal; |
980 | int ehash_order, bhash_order, i; | 895 | int ehash_order, bhash_order, i; |
981 | int rc = proto_register(&dccp_prot, 1); | 896 | int rc = -ENOBUFS; |
982 | 897 | ||
983 | if (rc) | ||
984 | goto out; | ||
985 | |||
986 | rc = -ENOBUFS; | ||
987 | dccp_hashinfo.bind_bucket_cachep = | 898 | dccp_hashinfo.bind_bucket_cachep = |
988 | kmem_cache_create("dccp_bind_bucket", | 899 | kmem_cache_create("dccp_bind_bucket", |
989 | sizeof(struct inet_bind_bucket), 0, | 900 | sizeof(struct inet_bind_bucket), 0, |
990 | SLAB_HWCACHE_ALIGN, NULL, NULL); | 901 | SLAB_HWCACHE_ALIGN, NULL, NULL); |
991 | if (!dccp_hashinfo.bind_bucket_cachep) | 902 | if (!dccp_hashinfo.bind_bucket_cachep) |
992 | goto out_proto_unregister; | 903 | goto out; |
993 | 904 | ||
994 | /* | 905 | /* |
995 | * Size and allocate the main established and bind bucket | 906 | * Size and allocate the main established and bind bucket |
@@ -1055,33 +966,18 @@ static int __init dccp_init(void) | |||
1055 | if (rc) | 966 | if (rc) |
1056 | goto out_free_dccp_bhash; | 967 | goto out_free_dccp_bhash; |
1057 | 968 | ||
1058 | rc = -EAGAIN; | ||
1059 | if (inet_add_protocol(&dccp_protocol, IPPROTO_DCCP)) | ||
1060 | goto out_free_dccp_v4_mibs; | ||
1061 | |||
1062 | inet_register_protosw(&dccp_v4_protosw); | ||
1063 | |||
1064 | rc = dccp_ackvec_init(); | 969 | rc = dccp_ackvec_init(); |
1065 | if (rc) | 970 | if (rc) |
1066 | goto out_unregister_protosw; | 971 | goto out_free_dccp_mib; |
1067 | 972 | ||
1068 | rc = dccp_sysctl_init(); | 973 | rc = dccp_sysctl_init(); |
1069 | if (rc) | 974 | if (rc) |
1070 | goto out_ackvec_exit; | 975 | goto out_ackvec_exit; |
1071 | |||
1072 | rc = dccp_ctl_sock_init(); | ||
1073 | if (rc) | ||
1074 | goto out_sysctl_exit; | ||
1075 | out: | 976 | out: |
1076 | return rc; | 977 | return rc; |
1077 | out_sysctl_exit: | ||
1078 | dccp_sysctl_exit(); | ||
1079 | out_ackvec_exit: | 978 | out_ackvec_exit: |
1080 | dccp_ackvec_exit(); | 979 | dccp_ackvec_exit(); |
1081 | out_unregister_protosw: | 980 | out_free_dccp_mib: |
1082 | inet_unregister_protosw(&dccp_v4_protosw); | ||
1083 | inet_del_protocol(&dccp_protocol, IPPROTO_DCCP); | ||
1084 | out_free_dccp_v4_mibs: | ||
1085 | dccp_mib_exit(); | 981 | dccp_mib_exit(); |
1086 | out_free_dccp_bhash: | 982 | out_free_dccp_bhash: |
1087 | free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); | 983 | free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); |
@@ -1092,21 +988,11 @@ out_free_dccp_ehash: | |||
1092 | out_free_bind_bucket_cachep: | 988 | out_free_bind_bucket_cachep: |
1093 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); | 989 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); |
1094 | dccp_hashinfo.bind_bucket_cachep = NULL; | 990 | dccp_hashinfo.bind_bucket_cachep = NULL; |
1095 | out_proto_unregister: | ||
1096 | proto_unregister(&dccp_prot); | ||
1097 | goto out; | 991 | goto out; |
1098 | } | 992 | } |
1099 | 993 | ||
1100 | static const char dccp_del_proto_err_msg[] __exitdata = | ||
1101 | KERN_ERR "can't remove dccp net_protocol\n"; | ||
1102 | |||
1103 | static void __exit dccp_fini(void) | 994 | static void __exit dccp_fini(void) |
1104 | { | 995 | { |
1105 | inet_unregister_protosw(&dccp_v4_protosw); | ||
1106 | |||
1107 | if (inet_del_protocol(&dccp_protocol, IPPROTO_DCCP) < 0) | ||
1108 | printk(dccp_del_proto_err_msg); | ||
1109 | |||
1110 | dccp_mib_exit(); | 996 | dccp_mib_exit(); |
1111 | free_pages((unsigned long)dccp_hashinfo.bhash, | 997 | free_pages((unsigned long)dccp_hashinfo.bhash, |
1112 | get_order(dccp_hashinfo.bhash_size * | 998 | get_order(dccp_hashinfo.bhash_size * |
@@ -1115,7 +1001,6 @@ static void __exit dccp_fini(void) | |||
1115 | get_order(dccp_hashinfo.ehash_size * | 1001 | get_order(dccp_hashinfo.ehash_size * |
1116 | sizeof(struct inet_ehash_bucket))); | 1002 | sizeof(struct inet_ehash_bucket))); |
1117 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); | 1003 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); |
1118 | proto_unregister(&dccp_prot); | ||
1119 | dccp_ackvec_exit(); | 1004 | dccp_ackvec_exit(); |
1120 | dccp_sysctl_exit(); | 1005 | dccp_sysctl_exit(); |
1121 | } | 1006 | } |
@@ -1123,13 +1008,6 @@ static void __exit dccp_fini(void) | |||
1123 | module_init(dccp_init); | 1008 | module_init(dccp_init); |
1124 | module_exit(dccp_fini); | 1009 | module_exit(dccp_fini); |
1125 | 1010 | ||
1126 | /* | ||
1127 | * __stringify doesn't likes enums, so use SOCK_DCCP (6) and IPPROTO_DCCP (33) | ||
1128 | * values directly, Also cover the case where the protocol is not specified, | ||
1129 | * i.e. net-pf-PF_INET-proto-0-type-SOCK_DCCP | ||
1130 | */ | ||
1131 | MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-33-type-6"); | ||
1132 | MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-0-type-6"); | ||
1133 | MODULE_LICENSE("GPL"); | 1011 | MODULE_LICENSE("GPL"); |
1134 | MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@conectiva.com.br>"); | 1012 | MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@conectiva.com.br>"); |
1135 | MODULE_DESCRIPTION("DCCP - Datagram Congestion Controlled Protocol"); | 1013 | MODULE_DESCRIPTION("DCCP - Datagram Congestion Controlled Protocol"); |