diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-14 02:24:16 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:10:50 -0500 |
commit | f21e68caa0ddffddf98a1e729e734a470957b6ec (patch) | |
tree | 52b372d10cbacd066867ba1c918f48b9fdaad950 | |
parent | 34ca6860810342441f801226b19ae6c9e0ecb34f (diff) |
[DCCP]: Prepare the AF agnostic core for the introduction of DCCPv6
Basically exports a similar set of functions as the one exported by
the non-AF specific TCP code.
In the process moved some non-AF specific code from dccp_v4_connect to
dccp_connect_init and moved the checksum verification from
dccp_invalid_packet to dccp_v4_rcv, so as to use it in dccp_v6_rcv
too.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/dccp/dccp.h | 22 | ||||
-rw-r--r-- | net/dccp/input.c | 4 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 73 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 8 | ||||
-rw-r--r-- | net/dccp/output.c | 27 | ||||
-rw-r--r-- | net/dccp/proto.c | 32 |
6 files changed, 114 insertions, 52 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index e711f850053b..93f26dd6e6cb 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -228,6 +228,9 @@ extern int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
228 | extern int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, | 228 | extern int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, |
229 | const struct dccp_hdr *dh, const unsigned len); | 229 | const struct dccp_hdr *dh, const unsigned len); |
230 | 230 | ||
231 | extern int dccp_v4_init_sock(struct sock *sk); | ||
232 | extern int dccp_v4_destroy_sock(struct sock *sk); | ||
233 | |||
231 | extern void dccp_close(struct sock *sk, long timeout); | 234 | extern void dccp_close(struct sock *sk, long timeout); |
232 | extern struct sk_buff *dccp_make_response(struct sock *sk, | 235 | extern struct sk_buff *dccp_make_response(struct sock *sk, |
233 | struct dst_entry *dst, | 236 | struct dst_entry *dst, |
@@ -238,6 +241,7 @@ extern struct sk_buff *dccp_make_reset(struct sock *sk, | |||
238 | 241 | ||
239 | extern int dccp_connect(struct sock *sk); | 242 | extern int dccp_connect(struct sock *sk); |
240 | extern int dccp_disconnect(struct sock *sk, int flags); | 243 | extern int dccp_disconnect(struct sock *sk, int flags); |
244 | extern void dccp_unhash(struct sock *sk); | ||
241 | extern int dccp_getsockopt(struct sock *sk, int level, int optname, | 245 | extern int dccp_getsockopt(struct sock *sk, int level, int optname, |
242 | char __user *optval, int __user *optlen); | 246 | char __user *optval, int __user *optlen); |
243 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, | 247 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, |
@@ -249,6 +253,13 @@ extern int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
249 | struct msghdr *msg, size_t len, int nonblock, | 253 | struct msghdr *msg, size_t len, int nonblock, |
250 | int flags, int *addr_len); | 254 | int flags, int *addr_len); |
251 | extern void dccp_shutdown(struct sock *sk, int how); | 255 | extern void dccp_shutdown(struct sock *sk, int how); |
256 | extern int inet_dccp_listen(struct socket *sock, int backlog); | ||
257 | extern unsigned int dccp_poll(struct file *file, struct socket *sock, | ||
258 | poll_table *wait); | ||
259 | extern void dccp_v4_send_check(struct sock *sk, int len, | ||
260 | struct sk_buff *skb); | ||
261 | extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | ||
262 | int addr_len); | ||
252 | 263 | ||
253 | extern int dccp_v4_checksum(const struct sk_buff *skb, | 264 | extern int dccp_v4_checksum(const struct sk_buff *skb, |
254 | const u32 saddr, const u32 daddr); | 265 | const u32 saddr, const u32 daddr); |
@@ -256,6 +267,17 @@ extern int dccp_v4_checksum(const struct sk_buff *skb, | |||
256 | extern int dccp_v4_send_reset(struct sock *sk, | 267 | extern int dccp_v4_send_reset(struct sock *sk, |
257 | enum dccp_reset_codes code); | 268 | enum dccp_reset_codes code); |
258 | extern void dccp_send_close(struct sock *sk, const int active); | 269 | extern void dccp_send_close(struct sock *sk, const int active); |
270 | extern int dccp_invalid_packet(struct sk_buff *skb); | ||
271 | |||
272 | static inline int dccp_bad_service_code(const struct sock *sk, | ||
273 | const __u32 service) | ||
274 | { | ||
275 | const struct dccp_sock *dp = dccp_sk(sk); | ||
276 | |||
277 | if (dp->dccps_service == service) | ||
278 | return 0; | ||
279 | return !dccp_list_has_service(dp->dccps_service_list, service); | ||
280 | } | ||
259 | 281 | ||
260 | struct dccp_skb_cb { | 282 | struct dccp_skb_cb { |
261 | __u8 dccpd_type:4; | 283 | __u8 dccpd_type:4; |
diff --git a/net/dccp/input.c b/net/dccp/input.c index c81488fa293e..9a724ff2a622 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -250,6 +250,8 @@ discard: | |||
250 | return 0; | 250 | return 0; |
251 | } | 251 | } |
252 | 252 | ||
253 | EXPORT_SYMBOL_GPL(dccp_rcv_established); | ||
254 | |||
253 | static int dccp_rcv_request_sent_state_process(struct sock *sk, | 255 | static int dccp_rcv_request_sent_state_process(struct sock *sk, |
254 | struct sk_buff *skb, | 256 | struct sk_buff *skb, |
255 | const struct dccp_hdr *dh, | 257 | const struct dccp_hdr *dh, |
@@ -567,3 +569,5 @@ discard: | |||
567 | } | 569 | } |
568 | return 0; | 570 | return 0; |
569 | } | 571 | } |
572 | |||
573 | EXPORT_SYMBOL_GPL(dccp_rcv_state_process); | ||
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 9f69a67a4b01..3108c9d464f7 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -46,11 +46,13 @@ static void dccp_v4_hash(struct sock *sk) | |||
46 | inet_hash(&dccp_hashinfo, sk); | 46 | inet_hash(&dccp_hashinfo, sk); |
47 | } | 47 | } |
48 | 48 | ||
49 | static void dccp_v4_unhash(struct sock *sk) | 49 | void dccp_unhash(struct sock *sk) |
50 | { | 50 | { |
51 | inet_unhash(&dccp_hashinfo, sk); | 51 | inet_unhash(&dccp_hashinfo, sk); |
52 | } | 52 | } |
53 | 53 | ||
54 | EXPORT_SYMBOL_GPL(dccp_unhash); | ||
55 | |||
54 | /* called with local bh disabled */ | 56 | /* called with local bh disabled */ |
55 | static int __dccp_v4_check_established(struct sock *sk, const __u16 lport, | 57 | static int __dccp_v4_check_established(struct sock *sk, const __u16 lport, |
56 | struct inet_timewait_sock **twp) | 58 | struct inet_timewait_sock **twp) |
@@ -209,8 +211,7 @@ out: | |||
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||
212 | static int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | 214 | int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
213 | int addr_len) | ||
214 | { | 215 | { |
215 | struct inet_sock *inet = inet_sk(sk); | 216 | struct inet_sock *inet = inet_sk(sk); |
216 | struct dccp_sock *dp = dccp_sk(sk); | 217 | struct dccp_sock *dp = dccp_sk(sk); |
@@ -288,16 +289,6 @@ static int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |||
288 | usin->sin_port); | 289 | usin->sin_port); |
289 | dccp_update_gss(sk, dp->dccps_iss); | 290 | dccp_update_gss(sk, dp->dccps_iss); |
290 | 291 | ||
291 | /* | ||
292 | * SWL and AWL are initially adjusted so that they are not less than | ||
293 | * the initial Sequence Numbers received and sent, respectively: | ||
294 | * SWL := max(GSR + 1 - floor(W/4), ISR), | ||
295 | * AWL := max(GSS - W' + 1, ISS). | ||
296 | * These adjustments MUST be applied only at the beginning of the | ||
297 | * connection. | ||
298 | */ | ||
299 | dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss)); | ||
300 | |||
301 | inet->id = dp->dccps_iss ^ jiffies; | 292 | inet->id = dp->dccps_iss ^ jiffies; |
302 | 293 | ||
303 | err = dccp_connect(sk); | 294 | err = dccp_connect(sk); |
@@ -317,6 +308,8 @@ failure: | |||
317 | goto out; | 308 | goto out; |
318 | } | 309 | } |
319 | 310 | ||
311 | EXPORT_SYMBOL_GPL(dccp_v4_connect); | ||
312 | |||
320 | /* | 313 | /* |
321 | * This routine does path mtu discovery as defined in RFC1191. | 314 | * This routine does path mtu discovery as defined in RFC1191. |
322 | */ | 315 | */ |
@@ -608,7 +601,7 @@ out: | |||
608 | } | 601 | } |
609 | 602 | ||
610 | /* This routine computes an IPv4 DCCP checksum. */ | 603 | /* This routine computes an IPv4 DCCP checksum. */ |
611 | static void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) | 604 | void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) |
612 | { | 605 | { |
613 | const struct inet_sock *inet = inet_sk(sk); | 606 | const struct inet_sock *inet = inet_sk(sk); |
614 | struct dccp_hdr *dh = dccp_hdr(skb); | 607 | struct dccp_hdr *dh = dccp_hdr(skb); |
@@ -616,6 +609,8 @@ static void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb) | |||
616 | dh->dccph_checksum = dccp_v4_checksum(skb, inet->saddr, inet->daddr); | 609 | dh->dccph_checksum = dccp_v4_checksum(skb, inet->saddr, inet->daddr); |
617 | } | 610 | } |
618 | 611 | ||
612 | EXPORT_SYMBOL_GPL(dccp_v4_send_check); | ||
613 | |||
619 | int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) | 614 | int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) |
620 | { | 615 | { |
621 | struct sk_buff *skb; | 616 | struct sk_buff *skb; |
@@ -651,16 +646,6 @@ static inline u64 dccp_v4_init_sequence(const struct sock *sk, | |||
651 | dccp_hdr(skb)->dccph_sport); | 646 | dccp_hdr(skb)->dccph_sport); |
652 | } | 647 | } |
653 | 648 | ||
654 | static inline int dccp_bad_service_code(const struct sock *sk, | ||
655 | const __u32 service) | ||
656 | { | ||
657 | const struct dccp_sock *dp = dccp_sk(sk); | ||
658 | |||
659 | if (dp->dccps_service == service) | ||
660 | return 0; | ||
661 | return !dccp_list_has_service(dp->dccps_service_list, service); | ||
662 | } | ||
663 | |||
664 | int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | 649 | int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) |
665 | { | 650 | { |
666 | struct inet_request_sock *ireq; | 651 | struct inet_request_sock *ireq; |
@@ -672,7 +657,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
672 | const __u32 service = dccp_hdr_request(skb)->dccph_req_service; | 657 | const __u32 service = dccp_hdr_request(skb)->dccph_req_service; |
673 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); | 658 | struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); |
674 | __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY; | 659 | __u8 reset_code = DCCP_RESET_CODE_TOO_BUSY; |
675 | struct dst_entry *dst = NULL; | ||
676 | 660 | ||
677 | /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ | 661 | /* Never answer to DCCP_PKT_REQUESTs send to broadcast or multicast */ |
678 | if (((struct rtable *)skb->dst)->rt_flags & | 662 | if (((struct rtable *)skb->dst)->rt_flags & |
@@ -713,7 +697,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
713 | ireq = inet_rsk(req); | 697 | ireq = inet_rsk(req); |
714 | ireq->loc_addr = daddr; | 698 | ireq->loc_addr = daddr; |
715 | ireq->rmt_addr = saddr; | 699 | ireq->rmt_addr = saddr; |
716 | /* FIXME: Merge Aristeu's option parsing code when ready */ | ||
717 | req->rcv_wnd = 100; /* Fake, option parsing will get the | 700 | req->rcv_wnd = 100; /* Fake, option parsing will get the |
718 | right value */ | 701 | right value */ |
719 | ireq->opt = NULL; | 702 | ireq->opt = NULL; |
@@ -731,7 +714,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
731 | dreq->dreq_iss = dccp_v4_init_sequence(sk, skb); | 714 | dreq->dreq_iss = dccp_v4_init_sequence(sk, skb); |
732 | dreq->dreq_service = service; | 715 | dreq->dreq_service = service; |
733 | 716 | ||
734 | if (dccp_v4_send_response(sk, req, dst)) | 717 | if (dccp_v4_send_response(sk, req, NULL)) |
735 | goto drop_and_free; | 718 | goto drop_and_free; |
736 | 719 | ||
737 | inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); | 720 | inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); |
@@ -748,6 +731,8 @@ drop: | |||
748 | return -1; | 731 | return -1; |
749 | } | 732 | } |
750 | 733 | ||
734 | EXPORT_SYMBOL_GPL(dccp_v4_conn_request); | ||
735 | |||
751 | /* | 736 | /* |
752 | * The three way handshake has completed - we got a valid ACK or DATAACK - | 737 | * The three way handshake has completed - we got a valid ACK or DATAACK - |
753 | * now create the new socket. | 738 | * now create the new socket. |
@@ -802,6 +787,8 @@ exit: | |||
802 | return NULL; | 787 | return NULL; |
803 | } | 788 | } |
804 | 789 | ||
790 | EXPORT_SYMBOL_GPL(dccp_v4_request_recv_sock); | ||
791 | |||
805 | static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | 792 | static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) |
806 | { | 793 | { |
807 | const struct dccp_hdr *dh = dccp_hdr(skb); | 794 | const struct dccp_hdr *dh = dccp_hdr(skb); |
@@ -1021,7 +1008,9 @@ discard: | |||
1021 | return 0; | 1008 | return 0; |
1022 | } | 1009 | } |
1023 | 1010 | ||
1024 | static inline int dccp_invalid_packet(struct sk_buff *skb) | 1011 | EXPORT_SYMBOL_GPL(dccp_v4_do_rcv); |
1012 | |||
1013 | int dccp_invalid_packet(struct sk_buff *skb) | ||
1025 | { | 1014 | { |
1026 | const struct dccp_hdr *dh; | 1015 | const struct dccp_hdr *dh; |
1027 | 1016 | ||
@@ -1075,17 +1064,11 @@ static inline int dccp_invalid_packet(struct sk_buff *skb) | |||
1075 | return 1; | 1064 | return 1; |
1076 | } | 1065 | } |
1077 | 1066 | ||
1078 | /* If the header checksum is incorrect, drop packet and return */ | ||
1079 | if (dccp_v4_verify_checksum(skb, skb->nh.iph->saddr, | ||
1080 | skb->nh.iph->daddr) < 0) { | ||
1081 | LIMIT_NETDEBUG(KERN_WARNING "DCCP: header checksum is " | ||
1082 | "incorrect\n"); | ||
1083 | return 1; | ||
1084 | } | ||
1085 | |||
1086 | return 0; | 1067 | return 0; |
1087 | } | 1068 | } |
1088 | 1069 | ||
1070 | EXPORT_SYMBOL_GPL(dccp_invalid_packet); | ||
1071 | |||
1089 | /* this is called when real data arrives */ | 1072 | /* this is called when real data arrives */ |
1090 | int dccp_v4_rcv(struct sk_buff *skb) | 1073 | int dccp_v4_rcv(struct sk_buff *skb) |
1091 | { | 1074 | { |
@@ -1098,6 +1081,14 @@ int dccp_v4_rcv(struct sk_buff *skb) | |||
1098 | if (dccp_invalid_packet(skb)) | 1081 | if (dccp_invalid_packet(skb)) |
1099 | goto discard_it; | 1082 | goto discard_it; |
1100 | 1083 | ||
1084 | /* If the header checksum is incorrect, drop packet and return */ | ||
1085 | if (dccp_v4_verify_checksum(skb, skb->nh.iph->saddr, | ||
1086 | skb->nh.iph->daddr) < 0) { | ||
1087 | LIMIT_NETDEBUG(KERN_WARNING "%s: incorrect header checksum\n", | ||
1088 | __FUNCTION__); | ||
1089 | goto discard_it; | ||
1090 | } | ||
1091 | |||
1101 | dh = dccp_hdr(skb); | 1092 | dh = dccp_hdr(skb); |
1102 | 1093 | ||
1103 | DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(skb); | 1094 | DCCP_SKB_CB(skb)->dccpd_seq = dccp_hdr_seq(skb); |
@@ -1217,7 +1208,7 @@ struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { | |||
1217 | .sockaddr_len = sizeof(struct sockaddr_in), | 1208 | .sockaddr_len = sizeof(struct sockaddr_in), |
1218 | }; | 1209 | }; |
1219 | 1210 | ||
1220 | static int dccp_v4_init_sock(struct sock *sk) | 1211 | int dccp_v4_init_sock(struct sock *sk) |
1221 | { | 1212 | { |
1222 | struct dccp_sock *dp = dccp_sk(sk); | 1213 | struct dccp_sock *dp = dccp_sk(sk); |
1223 | static int dccp_ctl_socket_init = 1; | 1214 | static int dccp_ctl_socket_init = 1; |
@@ -1270,7 +1261,9 @@ static int dccp_v4_init_sock(struct sock *sk) | |||
1270 | return 0; | 1261 | return 0; |
1271 | } | 1262 | } |
1272 | 1263 | ||
1273 | static int dccp_v4_destroy_sock(struct sock *sk) | 1264 | EXPORT_SYMBOL_GPL(dccp_v4_init_sock); |
1265 | |||
1266 | int dccp_v4_destroy_sock(struct sock *sk) | ||
1274 | { | 1267 | { |
1275 | struct dccp_sock *dp = dccp_sk(sk); | 1268 | struct dccp_sock *dp = dccp_sk(sk); |
1276 | 1269 | ||
@@ -1303,6 +1296,8 @@ static int dccp_v4_destroy_sock(struct sock *sk) | |||
1303 | return 0; | 1296 | return 0; |
1304 | } | 1297 | } |
1305 | 1298 | ||
1299 | EXPORT_SYMBOL_GPL(dccp_v4_destroy_sock); | ||
1300 | |||
1306 | static void dccp_v4_reqsk_destructor(struct request_sock *req) | 1301 | static void dccp_v4_reqsk_destructor(struct request_sock *req) |
1307 | { | 1302 | { |
1308 | kfree(inet_rsk(req)->opt); | 1303 | kfree(inet_rsk(req)->opt); |
@@ -1331,7 +1326,7 @@ struct proto dccp_prot = { | |||
1331 | .recvmsg = dccp_recvmsg, | 1326 | .recvmsg = dccp_recvmsg, |
1332 | .backlog_rcv = dccp_v4_do_rcv, | 1327 | .backlog_rcv = dccp_v4_do_rcv, |
1333 | .hash = dccp_v4_hash, | 1328 | .hash = dccp_v4_hash, |
1334 | .unhash = dccp_v4_unhash, | 1329 | .unhash = dccp_unhash, |
1335 | .accept = inet_csk_accept, | 1330 | .accept = inet_csk_accept, |
1336 | .get_port = dccp_v4_get_port, | 1331 | .get_port = dccp_v4_get_port, |
1337 | .shutdown = dccp_shutdown, | 1332 | .shutdown = dccp_shutdown, |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index c7ff80cf53a0..5c767b5e9a52 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -40,6 +40,8 @@ struct inet_timewait_death_row dccp_death_row = { | |||
40 | (unsigned long)&dccp_death_row), | 40 | (unsigned long)&dccp_death_row), |
41 | }; | 41 | }; |
42 | 42 | ||
43 | EXPORT_SYMBOL_GPL(dccp_death_row); | ||
44 | |||
43 | void dccp_time_wait(struct sock *sk, int state, int timeo) | 45 | void dccp_time_wait(struct sock *sk, int state, int timeo) |
44 | { | 46 | { |
45 | struct inet_timewait_sock *tw = NULL; | 47 | struct inet_timewait_sock *tw = NULL; |
@@ -170,6 +172,8 @@ out_free: | |||
170 | return newsk; | 172 | return newsk; |
171 | } | 173 | } |
172 | 174 | ||
175 | EXPORT_SYMBOL_GPL(dccp_create_openreq_child); | ||
176 | |||
173 | /* | 177 | /* |
174 | * Process an incoming packet for RESPOND sockets represented | 178 | * Process an incoming packet for RESPOND sockets represented |
175 | * as an request_sock. | 179 | * as an request_sock. |
@@ -236,6 +240,8 @@ drop: | |||
236 | goto out; | 240 | goto out; |
237 | } | 241 | } |
238 | 242 | ||
243 | EXPORT_SYMBOL_GPL(dccp_check_req); | ||
244 | |||
239 | /* | 245 | /* |
240 | * Queue segment on the new socket if the new socket is active, | 246 | * Queue segment on the new socket if the new socket is active, |
241 | * otherwise we just shortcircuit this and continue with | 247 | * otherwise we just shortcircuit this and continue with |
@@ -266,3 +272,5 @@ int dccp_child_process(struct sock *parent, struct sock *child, | |||
266 | sock_put(child); | 272 | sock_put(child); |
267 | return ret; | 273 | return ret; |
268 | } | 274 | } |
275 | |||
276 | EXPORT_SYMBOL_GPL(dccp_child_process); | ||
diff --git a/net/dccp/output.c b/net/dccp/output.c index f35880503bb8..c40f7f8a328b 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -135,12 +135,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
135 | unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu) | 135 | unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu) |
136 | { | 136 | { |
137 | struct dccp_sock *dp = dccp_sk(sk); | 137 | struct dccp_sock *dp = dccp_sk(sk); |
138 | /* | ||
139 | * FIXME: we really should be using the af_specific thing to support | ||
140 | * IPv6. | ||
141 | * mss_now = pmtu - tp->af_specific->net_header_len - | ||
142 | * sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext); | ||
143 | */ | ||
144 | int mss_now = (pmtu - inet_csk(sk)->icsk_af_ops->net_header_len - | 138 | int mss_now = (pmtu - inet_csk(sk)->icsk_af_ops->net_header_len - |
145 | sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext)); | 139 | sizeof(struct dccp_hdr) - sizeof(struct dccp_hdr_ext)); |
146 | 140 | ||
@@ -164,6 +158,8 @@ unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu) | |||
164 | return mss_now; | 158 | return mss_now; |
165 | } | 159 | } |
166 | 160 | ||
161 | EXPORT_SYMBOL_GPL(dccp_sync_mss); | ||
162 | |||
167 | void dccp_write_space(struct sock *sk) | 163 | void dccp_write_space(struct sock *sk) |
168 | { | 164 | { |
169 | read_lock(&sk->sk_callback_lock); | 165 | read_lock(&sk->sk_callback_lock); |
@@ -319,6 +315,8 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, | |||
319 | return skb; | 315 | return skb; |
320 | } | 316 | } |
321 | 317 | ||
318 | EXPORT_SYMBOL_GPL(dccp_make_response); | ||
319 | |||
322 | struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, | 320 | struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, |
323 | const enum dccp_reset_codes code) | 321 | const enum dccp_reset_codes code) |
324 | 322 | ||
@@ -375,6 +373,7 @@ struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, | |||
375 | */ | 373 | */ |
376 | static inline void dccp_connect_init(struct sock *sk) | 374 | static inline void dccp_connect_init(struct sock *sk) |
377 | { | 375 | { |
376 | struct dccp_sock *dp = dccp_sk(sk); | ||
378 | struct dst_entry *dst = __sk_dst_get(sk); | 377 | struct dst_entry *dst = __sk_dst_get(sk); |
379 | struct inet_connection_sock *icsk = inet_csk(sk); | 378 | struct inet_connection_sock *icsk = inet_csk(sk); |
380 | 379 | ||
@@ -383,10 +382,16 @@ static inline void dccp_connect_init(struct sock *sk) | |||
383 | 382 | ||
384 | dccp_sync_mss(sk, dst_mtu(dst)); | 383 | dccp_sync_mss(sk, dst_mtu(dst)); |
385 | 384 | ||
386 | /* | 385 | dccp_update_gss(sk, dp->dccps_iss); |
387 | * FIXME: set dp->{dccps_swh,dccps_swl}, with | 386 | /* |
388 | * something like dccp_inc_seq | 387 | * SWL and AWL are initially adjusted so that they are not less than |
389 | */ | 388 | * the initial Sequence Numbers received and sent, respectively: |
389 | * SWL := max(GSR + 1 - floor(W/4), ISR), | ||
390 | * AWL := max(GSS - W' + 1, ISS). | ||
391 | * These adjustments MUST be applied only at the beginning of the | ||
392 | * connection. | ||
393 | */ | ||
394 | dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss)); | ||
390 | 395 | ||
391 | icsk->icsk_retransmits = 0; | 396 | icsk->icsk_retransmits = 0; |
392 | } | 397 | } |
@@ -418,6 +423,8 @@ int dccp_connect(struct sock *sk) | |||
418 | return 0; | 423 | return 0; |
419 | } | 424 | } |
420 | 425 | ||
426 | EXPORT_SYMBOL_GPL(dccp_connect); | ||
427 | |||
421 | void dccp_send_ack(struct sock *sk) | 428 | void dccp_send_ack(struct sock *sk) |
422 | { | 429 | { |
423 | /* If we have been reset, we may not send again. */ | 430 | /* If we have been reset, we may not send again. */ |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 9cb2989f93b2..51dfacd22a6e 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -41,8 +41,12 @@ | |||
41 | 41 | ||
42 | DEFINE_SNMP_STAT(struct dccp_mib, dccp_statistics) __read_mostly; | 42 | DEFINE_SNMP_STAT(struct dccp_mib, dccp_statistics) __read_mostly; |
43 | 43 | ||
44 | EXPORT_SYMBOL_GPL(dccp_statistics); | ||
45 | |||
44 | atomic_t dccp_orphan_count = ATOMIC_INIT(0); | 46 | atomic_t dccp_orphan_count = ATOMIC_INIT(0); |
45 | 47 | ||
48 | EXPORT_SYMBOL_GPL(dccp_orphan_count); | ||
49 | |||
46 | static struct net_protocol dccp_protocol = { | 50 | static struct net_protocol dccp_protocol = { |
47 | .handler = dccp_v4_rcv, | 51 | .handler = dccp_v4_rcv, |
48 | .err_handler = dccp_v4_err, | 52 | .err_handler = dccp_v4_err, |
@@ -149,6 +153,8 @@ int dccp_disconnect(struct sock *sk, int flags) | |||
149 | return err; | 153 | return err; |
150 | } | 154 | } |
151 | 155 | ||
156 | EXPORT_SYMBOL_GPL(dccp_disconnect); | ||
157 | |||
152 | /* | 158 | /* |
153 | * Wait for a DCCP event. | 159 | * Wait for a DCCP event. |
154 | * | 160 | * |
@@ -156,8 +162,8 @@ int dccp_disconnect(struct sock *sk, int flags) | |||
156 | * take care of normal races (between the test and the event) and we don't | 162 | * take care of normal races (between the test and the event) and we don't |
157 | * go look at any of the socket buffers directly. | 163 | * go look at any of the socket buffers directly. |
158 | */ | 164 | */ |
159 | static unsigned int dccp_poll(struct file *file, struct socket *sock, | 165 | unsigned int dccp_poll(struct file *file, struct socket *sock, |
160 | poll_table *wait) | 166 | poll_table *wait) |
161 | { | 167 | { |
162 | unsigned int mask; | 168 | unsigned int mask; |
163 | struct sock *sk = sock->sk; | 169 | struct sock *sk = sock->sk; |
@@ -205,12 +211,16 @@ static unsigned int dccp_poll(struct file *file, struct socket *sock, | |||
205 | return mask; | 211 | return mask; |
206 | } | 212 | } |
207 | 213 | ||
214 | EXPORT_SYMBOL_GPL(dccp_poll); | ||
215 | |||
208 | int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) | 216 | int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) |
209 | { | 217 | { |
210 | dccp_pr_debug("entry\n"); | 218 | dccp_pr_debug("entry\n"); |
211 | return -ENOIOCTLCMD; | 219 | return -ENOIOCTLCMD; |
212 | } | 220 | } |
213 | 221 | ||
222 | EXPORT_SYMBOL_GPL(dccp_ioctl); | ||
223 | |||
214 | static int dccp_setsockopt_service(struct sock *sk, const u32 service, | 224 | static int dccp_setsockopt_service(struct sock *sk, const u32 service, |
215 | char __user *optval, int optlen) | 225 | char __user *optval, int optlen) |
216 | { | 226 | { |
@@ -284,6 +294,8 @@ int dccp_setsockopt(struct sock *sk, int level, int optname, | |||
284 | return err; | 294 | return err; |
285 | } | 295 | } |
286 | 296 | ||
297 | EXPORT_SYMBOL_GPL(dccp_setsockopt); | ||
298 | |||
287 | static int dccp_getsockopt_service(struct sock *sk, int len, | 299 | static int dccp_getsockopt_service(struct sock *sk, int len, |
288 | u32 __user *optval, | 300 | u32 __user *optval, |
289 | int __user *optlen) | 301 | int __user *optlen) |
@@ -357,6 +369,8 @@ int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
357 | return 0; | 369 | return 0; |
358 | } | 370 | } |
359 | 371 | ||
372 | EXPORT_SYMBOL_GPL(dccp_getsockopt); | ||
373 | |||
360 | int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 374 | int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
361 | size_t len) | 375 | size_t len) |
362 | { | 376 | { |
@@ -413,6 +427,8 @@ out_discard: | |||
413 | goto out_release; | 427 | goto out_release; |
414 | } | 428 | } |
415 | 429 | ||
430 | EXPORT_SYMBOL_GPL(dccp_sendmsg); | ||
431 | |||
416 | int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 432 | int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
417 | size_t len, int nonblock, int flags, int *addr_len) | 433 | size_t len, int nonblock, int flags, int *addr_len) |
418 | { | 434 | { |
@@ -510,7 +526,9 @@ out: | |||
510 | return len; | 526 | return len; |
511 | } | 527 | } |
512 | 528 | ||
513 | static int inet_dccp_listen(struct socket *sock, int backlog) | 529 | EXPORT_SYMBOL_GPL(dccp_recvmsg); |
530 | |||
531 | int inet_dccp_listen(struct socket *sock, int backlog) | ||
514 | { | 532 | { |
515 | struct sock *sk = sock->sk; | 533 | struct sock *sk = sock->sk; |
516 | unsigned char old_state; | 534 | unsigned char old_state; |
@@ -546,6 +564,8 @@ out: | |||
546 | return err; | 564 | return err; |
547 | } | 565 | } |
548 | 566 | ||
567 | EXPORT_SYMBOL_GPL(inet_dccp_listen); | ||
568 | |||
549 | static const unsigned char dccp_new_state[] = { | 569 | static const unsigned char dccp_new_state[] = { |
550 | /* current state: new state: action: */ | 570 | /* current state: new state: action: */ |
551 | [0] = DCCP_CLOSED, | 571 | [0] = DCCP_CLOSED, |
@@ -651,11 +671,15 @@ adjudge_to_death: | |||
651 | sock_put(sk); | 671 | sock_put(sk); |
652 | } | 672 | } |
653 | 673 | ||
674 | EXPORT_SYMBOL_GPL(dccp_close); | ||
675 | |||
654 | void dccp_shutdown(struct sock *sk, int how) | 676 | void dccp_shutdown(struct sock *sk, int how) |
655 | { | 677 | { |
656 | dccp_pr_debug("entry\n"); | 678 | dccp_pr_debug("entry\n"); |
657 | } | 679 | } |
658 | 680 | ||
681 | EXPORT_SYMBOL_GPL(dccp_shutdown); | ||
682 | |||
659 | static struct proto_ops inet_dccp_ops = { | 683 | static struct proto_ops inet_dccp_ops = { |
660 | .family = PF_INET, | 684 | .family = PF_INET, |
661 | .owner = THIS_MODULE, | 685 | .owner = THIS_MODULE, |
@@ -763,6 +787,8 @@ MODULE_PARM_DESC(thash_entries, "Number of ehash buckets"); | |||
763 | int dccp_debug; | 787 | int dccp_debug; |
764 | module_param(dccp_debug, int, 0444); | 788 | module_param(dccp_debug, int, 0444); |
765 | MODULE_PARM_DESC(dccp_debug, "Enable debug messages"); | 789 | MODULE_PARM_DESC(dccp_debug, "Enable debug messages"); |
790 | |||
791 | EXPORT_SYMBOL_GPL(dccp_debug); | ||
766 | #endif | 792 | #endif |
767 | 793 | ||
768 | static int __init dccp_init(void) | 794 | static int __init dccp_init(void) |