diff options
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r-- | net/dccp/ipv4.c | 114 |
1 files changed, 74 insertions, 40 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index d3770aed3b15..42d9c878d4c3 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -29,7 +29,7 @@ | |||
29 | struct inet_hashinfo __cacheline_aligned dccp_hashinfo = { | 29 | struct inet_hashinfo __cacheline_aligned dccp_hashinfo = { |
30 | .lhash_lock = RW_LOCK_UNLOCKED, | 30 | .lhash_lock = RW_LOCK_UNLOCKED, |
31 | .lhash_users = ATOMIC_INIT(0), | 31 | .lhash_users = ATOMIC_INIT(0), |
32 | .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(dccp_hashinfo.lhash_wait), | 32 | .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(dccp_hashinfo.lhash_wait), |
33 | .portalloc_lock = SPIN_LOCK_UNLOCKED, | 33 | .portalloc_lock = SPIN_LOCK_UNLOCKED, |
34 | .port_rover = 1024 - 1, | 34 | .port_rover = 1024 - 1, |
35 | }; | 35 | }; |
@@ -61,7 +61,8 @@ static int __dccp_v4_check_established(struct sock *sk, const __u16 lport, | |||
61 | const int dif = sk->sk_bound_dev_if; | 61 | const int dif = sk->sk_bound_dev_if; |
62 | INET_ADDR_COOKIE(acookie, saddr, daddr) | 62 | INET_ADDR_COOKIE(acookie, saddr, daddr) |
63 | const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); | 63 | const __u32 ports = INET_COMBINED_PORTS(inet->dport, lport); |
64 | const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, dccp_hashinfo.ehash_size); | 64 | const int hash = inet_ehashfn(daddr, lport, saddr, inet->dport, |
65 | dccp_hashinfo.ehash_size); | ||
65 | struct inet_ehash_bucket *head = &dccp_hashinfo.ehash[hash]; | 66 | struct inet_ehash_bucket *head = &dccp_hashinfo.ehash[hash]; |
66 | const struct sock *sk2; | 67 | const struct sock *sk2; |
67 | const struct hlist_node *node; | 68 | const struct hlist_node *node; |
@@ -133,11 +134,12 @@ static int dccp_v4_hash_connect(struct sock *sk) | |||
133 | local_bh_disable(); | 134 | local_bh_disable(); |
134 | 135 | ||
135 | /* TODO. Actually it is not so bad idea to remove | 136 | /* TODO. Actually it is not so bad idea to remove |
136 | * dccp_hashinfo.portalloc_lock before next submission to Linus. | 137 | * dccp_hashinfo.portalloc_lock before next submission to |
138 | * Linus. | ||
137 | * As soon as we touch this place at all it is time to think. | 139 | * As soon as we touch this place at all it is time to think. |
138 | * | 140 | * |
139 | * Now it protects single _advisory_ variable dccp_hashinfo.port_rover, | 141 | * Now it protects single _advisory_ variable |
140 | * hence it is mostly useless. | 142 | * dccp_hashinfo.port_rover, hence it is mostly useless. |
141 | * Code will work nicely if we just delete it, but | 143 | * Code will work nicely if we just delete it, but |
142 | * I am afraid in contented case it will work not better or | 144 | * I am afraid in contented case it will work not better or |
143 | * even worse: another cpu just will hit the same bucket | 145 | * even worse: another cpu just will hit the same bucket |
@@ -152,7 +154,8 @@ static int dccp_v4_hash_connect(struct sock *sk) | |||
152 | rover++; | 154 | rover++; |
153 | if ((rover < low) || (rover > high)) | 155 | if ((rover < low) || (rover > high)) |
154 | rover = low; | 156 | rover = low; |
155 | head = &dccp_hashinfo.bhash[inet_bhashfn(rover, dccp_hashinfo.bhash_size)]; | 157 | head = &dccp_hashinfo.bhash[inet_bhashfn(rover, |
158 | dccp_hashinfo.bhash_size)]; | ||
156 | spin_lock(&head->lock); | 159 | spin_lock(&head->lock); |
157 | 160 | ||
158 | /* Does not bother with rcv_saddr checks, | 161 | /* Does not bother with rcv_saddr checks, |
@@ -172,7 +175,8 @@ static int dccp_v4_hash_connect(struct sock *sk) | |||
172 | } | 175 | } |
173 | } | 176 | } |
174 | 177 | ||
175 | tb = inet_bind_bucket_create(dccp_hashinfo.bind_bucket_cachep, head, rover); | 178 | tb = inet_bind_bucket_create(dccp_hashinfo.bind_bucket_cachep, |
179 | head, rover); | ||
176 | if (tb == NULL) { | 180 | if (tb == NULL) { |
177 | spin_unlock(&head->lock); | 181 | spin_unlock(&head->lock); |
178 | break; | 182 | break; |
@@ -211,7 +215,8 @@ ok: | |||
211 | goto out; | 215 | goto out; |
212 | } | 216 | } |
213 | 217 | ||
214 | head = &dccp_hashinfo.bhash[inet_bhashfn(snum, dccp_hashinfo.bhash_size)]; | 218 | head = &dccp_hashinfo.bhash[inet_bhashfn(snum, |
219 | dccp_hashinfo.bhash_size)]; | ||
215 | tb = inet_csk(sk)->icsk_bind_hash; | 220 | tb = inet_csk(sk)->icsk_bind_hash; |
216 | spin_lock_bh(&head->lock); | 221 | spin_lock_bh(&head->lock); |
217 | if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) { | 222 | if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) { |
@@ -313,7 +318,9 @@ static int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |||
313 | out: | 318 | out: |
314 | return err; | 319 | return err; |
315 | failure: | 320 | failure: |
316 | /* This unhashes the socket and releases the local port, if necessary. */ | 321 | /* |
322 | * This unhashes the socket and releases the local port, if necessary. | ||
323 | */ | ||
317 | dccp_set_state(sk, DCCP_CLOSED); | 324 | dccp_set_state(sk, DCCP_CLOSED); |
318 | ip_rt_put(rt); | 325 | ip_rt_put(rt); |
319 | sk->sk_route_caps = 0; | 326 | sk->sk_route_caps = 0; |
@@ -365,8 +372,9 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk, | |||
365 | /* | 372 | /* |
366 | * From: draft-ietf-dccp-spec-11.txt | 373 | * From: draft-ietf-dccp-spec-11.txt |
367 | * | 374 | * |
368 | * DCCP-Sync packets are the best choice for upward probing, | 375 | * DCCP-Sync packets are the best choice for upward |
369 | * since DCCP-Sync probes do not risk application data loss. | 376 | * probing, since DCCP-Sync probes do not risk application |
377 | * data loss. | ||
370 | */ | 378 | */ |
371 | dccp_send_sync(sk, dp->dccps_gsr); | 379 | dccp_send_sync(sk, dp->dccps_gsr); |
372 | } /* else let the usual retransmit timer handle it */ | 380 | } /* else let the usual retransmit timer handle it */ |
@@ -405,11 +413,13 @@ static void dccp_v4_ctl_send_ack(struct sk_buff *rxskb) | |||
405 | dh->dccph_x = 1; | 413 | dh->dccph_x = 1; |
406 | 414 | ||
407 | dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq); | 415 | dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq); |
408 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq); | 416 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), |
417 | DCCP_SKB_CB(rxskb)->dccpd_seq); | ||
409 | 418 | ||
410 | bh_lock_sock(dccp_ctl_socket->sk); | 419 | bh_lock_sock(dccp_ctl_socket->sk); |
411 | err = ip_build_and_send_pkt(skb, dccp_ctl_socket->sk, | 420 | err = ip_build_and_send_pkt(skb, dccp_ctl_socket->sk, |
412 | rxskb->nh.iph->daddr, rxskb->nh.iph->saddr, NULL); | 421 | rxskb->nh.iph->daddr, |
422 | rxskb->nh.iph->saddr, NULL); | ||
413 | bh_unlock_sock(dccp_ctl_socket->sk); | 423 | bh_unlock_sock(dccp_ctl_socket->sk); |
414 | 424 | ||
415 | if (err == NET_XMIT_CN || err == 0) { | 425 | if (err == NET_XMIT_CN || err == 0) { |
@@ -418,7 +428,8 @@ static void dccp_v4_ctl_send_ack(struct sk_buff *rxskb) | |||
418 | } | 428 | } |
419 | } | 429 | } |
420 | 430 | ||
421 | static void dccp_v4_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) | 431 | static void dccp_v4_reqsk_send_ack(struct sk_buff *skb, |
432 | struct request_sock *req) | ||
422 | { | 433 | { |
423 | dccp_v4_ctl_send_ack(skb); | 434 | dccp_v4_ctl_send_ack(skb); |
424 | } | 435 | } |
@@ -465,7 +476,8 @@ out: | |||
465 | void dccp_v4_err(struct sk_buff *skb, u32 info) | 476 | void dccp_v4_err(struct sk_buff *skb, u32 info) |
466 | { | 477 | { |
467 | const struct iphdr *iph = (struct iphdr *)skb->data; | 478 | const struct iphdr *iph = (struct iphdr *)skb->data; |
468 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + (iph->ihl << 2)); | 479 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + |
480 | (iph->ihl << 2)); | ||
469 | struct dccp_sock *dp; | 481 | struct dccp_sock *dp; |
470 | struct inet_sock *inet; | 482 | struct inet_sock *inet; |
471 | const int type = skb->h.icmph->type; | 483 | const int type = skb->h.icmph->type; |
@@ -605,7 +617,8 @@ out: | |||
605 | sock_put(sk); | 617 | sock_put(sk); |
606 | } | 618 | } |
607 | 619 | ||
608 | extern struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, enum dccp_reset_codes code); | 620 | extern struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, |
621 | enum dccp_reset_codes code); | ||
609 | 622 | ||
610 | int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) | 623 | int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) |
611 | { | 624 | { |
@@ -689,7 +702,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
689 | ireq->loc_addr = daddr; | 702 | ireq->loc_addr = daddr; |
690 | ireq->rmt_addr = saddr; | 703 | ireq->rmt_addr = saddr; |
691 | /* FIXME: Merge Aristeu's option parsing code when ready */ | 704 | /* FIXME: Merge Aristeu's option parsing code when ready */ |
692 | req->rcv_wnd = 100; /* Fake, option parsing will get the right value */ | 705 | req->rcv_wnd = 100; /* Fake, option parsing will get the |
706 | right value */ | ||
693 | ireq->opt = NULL; | 707 | ireq->opt = NULL; |
694 | 708 | ||
695 | /* | 709 | /* |
@@ -804,7 +818,8 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
804 | return sk; | 818 | return sk; |
805 | } | 819 | } |
806 | 820 | ||
807 | int dccp_v4_checksum(const struct sk_buff *skb, const u32 saddr, const u32 daddr) | 821 | int dccp_v4_checksum(const struct sk_buff *skb, const u32 saddr, |
822 | const u32 daddr) | ||
808 | { | 823 | { |
809 | const struct dccp_hdr* dh = dccp_hdr(skb); | 824 | const struct dccp_hdr* dh = dccp_hdr(skb); |
810 | int checksum_len; | 825 | int checksum_len; |
@@ -814,11 +829,13 @@ int dccp_v4_checksum(const struct sk_buff *skb, const u32 saddr, const u32 daddr | |||
814 | checksum_len = skb->len; | 829 | checksum_len = skb->len; |
815 | else { | 830 | else { |
816 | checksum_len = (dh->dccph_cscov + dh->dccph_x) * sizeof(u32); | 831 | checksum_len = (dh->dccph_cscov + dh->dccph_x) * sizeof(u32); |
817 | checksum_len = checksum_len < skb->len ? checksum_len : skb->len; | 832 | checksum_len = checksum_len < skb->len ? checksum_len : |
833 | skb->len; | ||
818 | } | 834 | } |
819 | 835 | ||
820 | tmp = csum_partial((unsigned char *)dh, checksum_len, 0); | 836 | tmp = csum_partial((unsigned char *)dh, checksum_len, 0); |
821 | return csum_tcpudp_magic(saddr, daddr, checksum_len, IPPROTO_DCCP, tmp); | 837 | return csum_tcpudp_magic(saddr, daddr, checksum_len, |
838 | IPPROTO_DCCP, tmp); | ||
822 | } | 839 | } |
823 | 840 | ||
824 | static int dccp_v4_verify_checksum(struct sk_buff *skb, | 841 | static int dccp_v4_verify_checksum(struct sk_buff *skb, |
@@ -832,10 +849,12 @@ static int dccp_v4_verify_checksum(struct sk_buff *skb, | |||
832 | checksum_len = skb->len; | 849 | checksum_len = skb->len; |
833 | else { | 850 | else { |
834 | checksum_len = (dh->dccph_cscov + dh->dccph_x) * sizeof(u32); | 851 | checksum_len = (dh->dccph_cscov + dh->dccph_x) * sizeof(u32); |
835 | checksum_len = checksum_len < skb->len ? checksum_len : skb->len; | 852 | checksum_len = checksum_len < skb->len ? checksum_len : |
853 | skb->len; | ||
836 | } | 854 | } |
837 | tmp = csum_partial((unsigned char *)dh, checksum_len, 0); | 855 | tmp = csum_partial((unsigned char *)dh, checksum_len, 0); |
838 | return csum_tcpudp_magic(saddr, daddr, checksum_len, IPPROTO_DCCP, tmp) == 0 ? 0 : -1; | 856 | return csum_tcpudp_magic(saddr, daddr, checksum_len, |
857 | IPPROTO_DCCP, tmp) == 0 ? 0 : -1; | ||
839 | } | 858 | } |
840 | 859 | ||
841 | static struct dst_entry* dccp_v4_route_skb(struct sock *sk, | 860 | static struct dst_entry* dccp_v4_route_skb(struct sock *sk, |
@@ -850,7 +869,9 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, | |||
850 | .proto = sk->sk_protocol, | 869 | .proto = sk->sk_protocol, |
851 | .uli_u = { .ports = | 870 | .uli_u = { .ports = |
852 | { .sport = dccp_hdr(skb)->dccph_dport, | 871 | { .sport = dccp_hdr(skb)->dccph_dport, |
853 | .dport = dccp_hdr(skb)->dccph_sport } } }; | 872 | .dport = dccp_hdr(skb)->dccph_sport } |
873 | } | ||
874 | }; | ||
854 | 875 | ||
855 | if (ip_route_output_flow(&rt, &fl, sk, 0)) { | 876 | if (ip_route_output_flow(&rt, &fl, sk, 0)) { |
856 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | 877 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); |
@@ -899,17 +920,20 @@ void dccp_v4_ctl_send_reset(struct sk_buff *rxskb) | |||
899 | dh->dccph_dport = rxdh->dccph_sport; | 920 | dh->dccph_dport = rxdh->dccph_sport; |
900 | dh->dccph_doff = dccp_hdr_reset_len / 4; | 921 | dh->dccph_doff = dccp_hdr_reset_len / 4; |
901 | dh->dccph_x = 1; | 922 | dh->dccph_x = 1; |
902 | dccp_hdr_reset(skb)->dccph_reset_code = DCCP_SKB_CB(rxskb)->dccpd_reset_code; | 923 | dccp_hdr_reset(skb)->dccph_reset_code = |
924 | DCCP_SKB_CB(rxskb)->dccpd_reset_code; | ||
903 | 925 | ||
904 | dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq); | 926 | dccp_hdr_set_seq(dh, DCCP_SKB_CB(rxskb)->dccpd_ack_seq); |
905 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq); | 927 | dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), |
928 | DCCP_SKB_CB(rxskb)->dccpd_seq); | ||
906 | 929 | ||
907 | dh->dccph_checksum = dccp_v4_checksum(skb, rxskb->nh.iph->saddr, | 930 | dh->dccph_checksum = dccp_v4_checksum(skb, rxskb->nh.iph->saddr, |
908 | rxskb->nh.iph->daddr); | 931 | rxskb->nh.iph->daddr); |
909 | 932 | ||
910 | bh_lock_sock(dccp_ctl_socket->sk); | 933 | bh_lock_sock(dccp_ctl_socket->sk); |
911 | err = ip_build_and_send_pkt(skb, dccp_ctl_socket->sk, | 934 | err = ip_build_and_send_pkt(skb, dccp_ctl_socket->sk, |
912 | rxskb->nh.iph->daddr, rxskb->nh.iph->saddr, NULL); | 935 | rxskb->nh.iph->daddr, |
936 | rxskb->nh.iph->saddr, NULL); | ||
913 | bh_unlock_sock(dccp_ctl_socket->sk); | 937 | bh_unlock_sock(dccp_ctl_socket->sk); |
914 | 938 | ||
915 | if (err == NET_XMIT_CN || err == 0) { | 939 | if (err == NET_XMIT_CN || err == 0) { |
@@ -933,7 +957,8 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
933 | /* | 957 | /* |
934 | * Step 3: Process LISTEN state | 958 | * Step 3: Process LISTEN state |
935 | * If S.state == LISTEN, | 959 | * If S.state == LISTEN, |
936 | * If P.type == Request or P contains a valid Init Cookie option, | 960 | * If P.type == Request or P contains a valid Init Cookie |
961 | * option, | ||
937 | * * Must scan the packet's options to check for an Init | 962 | * * Must scan the packet's options to check for an Init |
938 | * Cookie. Only the Init Cookie is processed here, | 963 | * Cookie. Only the Init Cookie is processed here, |
939 | * however; other options are processed in Step 8. This | 964 | * however; other options are processed in Step 8. This |
@@ -950,7 +975,8 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
950 | * Generate Reset(No Connection) unless P.type == Reset | 975 | * Generate Reset(No Connection) unless P.type == Reset |
951 | * Drop packet and return | 976 | * Drop packet and return |
952 | * | 977 | * |
953 | * NOTE: the check for the packet types is done in dccp_rcv_state_process | 978 | * NOTE: the check for the packet types is done in |
979 | * dccp_rcv_state_process | ||
954 | */ | 980 | */ |
955 | if (sk->sk_state == DCCP_LISTEN) { | 981 | if (sk->sk_state == DCCP_LISTEN) { |
956 | struct sock *nsk = dccp_v4_hnd_req(sk, skb); | 982 | struct sock *nsk = dccp_v4_hnd_req(sk, skb); |
@@ -1007,7 +1033,8 @@ static inline int dccp_invalid_packet(struct sk_buff *skb) | |||
1007 | } | 1033 | } |
1008 | 1034 | ||
1009 | if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) { | 1035 | if (!pskb_may_pull(skb, dh->dccph_doff * sizeof(u32))) { |
1010 | dccp_pr_debug("P.Data Offset(%u) too small 2\n", dh->dccph_doff); | 1036 | dccp_pr_debug("P.Data Offset(%u) too small 2\n", |
1037 | dh->dccph_doff); | ||
1011 | return 1; | 1038 | return 1; |
1012 | } | 1039 | } |
1013 | 1040 | ||
@@ -1021,8 +1048,8 @@ static inline int dccp_invalid_packet(struct sk_buff *skb) | |||
1021 | dh->dccph_type != DCCP_PKT_DATA && | 1048 | dh->dccph_type != DCCP_PKT_DATA && |
1022 | dh->dccph_type != DCCP_PKT_ACK && | 1049 | dh->dccph_type != DCCP_PKT_ACK && |
1023 | dh->dccph_type != DCCP_PKT_DATAACK) { | 1050 | dh->dccph_type != DCCP_PKT_DATAACK) { |
1024 | dccp_pr_debug("P.type (%s) not Data, Ack nor DataAck and P.X == 0\n", | 1051 | dccp_pr_debug("P.type (%s) not Data, Ack nor DataAck and " |
1025 | dccp_packet_name(dh->dccph_type)); | 1052 | "P.X == 0\n", dccp_packet_name(dh->dccph_type)); |
1026 | return 1; | 1053 | return 1; |
1027 | } | 1054 | } |
1028 | 1055 | ||
@@ -1055,10 +1082,11 @@ int dccp_v4_rcv(struct sk_buff *skb) | |||
1055 | * dccp_ackpkts_add, you'll get something like this on a session that | 1082 | * dccp_ackpkts_add, you'll get something like this on a session that |
1056 | * sends 10 DATA/DATAACK packets: | 1083 | * sends 10 DATA/DATAACK packets: |
1057 | * | 1084 | * |
1058 | * dccp_ackpkts_print: 281473596467422 |0,0|3,0|0,0|3,0|0,0|3,0|0,0|3,0|0,1| | 1085 | * ackpkts_print: 281473596467422 |0,0|3,0|0,0|3,0|0,0|3,0|0,0|3,0|0,1| |
1059 | * | 1086 | * |
1060 | * 0, 0 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == just this packet | 1087 | * 0, 0 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == just this packet |
1061 | * 0, 1 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == two adjacent packets with the same state | 1088 | * 0, 1 means: DCCP_ACKPKTS_STATE_RECEIVED, RLE == two adjacent packets |
1089 | * with the same state | ||
1062 | * 3, 0 means: DCCP_ACKPKTS_STATE_NOT_RECEIVED, RLE == just this packet | 1090 | * 3, 0 means: DCCP_ACKPKTS_STATE_NOT_RECEIVED, RLE == just this packet |
1063 | * | 1091 | * |
1064 | * So... | 1092 | * So... |
@@ -1072,10 +1100,12 @@ int dccp_v4_rcv(struct sk_buff *skb) | |||
1072 | * 281473596467416 was received | 1100 | * 281473596467416 was received |
1073 | * 281473596467415 was not received | 1101 | * 281473596467415 was not received |
1074 | * 281473596467414 was received | 1102 | * 281473596467414 was received |
1075 | * 281473596467413 was received (this one was the 3way handshake RESPONSE) | 1103 | * 281473596467413 was received (this one was the 3way handshake |
1104 | * RESPONSE) | ||
1076 | * | 1105 | * |
1077 | */ | 1106 | */ |
1078 | if (dh->dccph_type == DCCP_PKT_DATA || dh->dccph_type == DCCP_PKT_DATAACK) { | 1107 | if (dh->dccph_type == DCCP_PKT_DATA || |
1108 | dh->dccph_type == DCCP_PKT_DATAACK) { | ||
1079 | static int discard = 0; | 1109 | static int discard = 0; |
1080 | 1110 | ||
1081 | if (discard) { | 1111 | if (discard) { |
@@ -1170,7 +1200,8 @@ no_dccp_socket: | |||
1170 | * Drop packet and return | 1200 | * Drop packet and return |
1171 | */ | 1201 | */ |
1172 | if (dh->dccph_type != DCCP_PKT_RESET) { | 1202 | if (dh->dccph_type != DCCP_PKT_RESET) { |
1173 | DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; | 1203 | DCCP_SKB_CB(skb)->dccpd_reset_code = |
1204 | DCCP_RESET_CODE_NO_CONNECTION; | ||
1174 | dccp_v4_ctl_send_reset(skb); | 1205 | dccp_v4_ctl_send_reset(skb); |
1175 | } | 1206 | } |
1176 | 1207 | ||
@@ -1196,8 +1227,9 @@ static int dccp_v4_init_sock(struct sock *sk) | |||
1196 | dccp_options_init(&dp->dccps_options); | 1227 | dccp_options_init(&dp->dccps_options); |
1197 | 1228 | ||
1198 | if (dp->dccps_options.dccpo_send_ack_vector) { | 1229 | if (dp->dccps_options.dccpo_send_ack_vector) { |
1199 | dp->dccps_hc_rx_ackpkts = dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN, | 1230 | dp->dccps_hc_rx_ackpkts = |
1200 | GFP_KERNEL); | 1231 | dccp_ackpkts_alloc(DCCP_MAX_ACK_VECTOR_LEN, |
1232 | GFP_KERNEL); | ||
1201 | 1233 | ||
1202 | if (dp->dccps_hc_rx_ackpkts == NULL) | 1234 | if (dp->dccps_hc_rx_ackpkts == NULL) |
1203 | return -ENOMEM; | 1235 | return -ENOMEM; |
@@ -1211,8 +1243,10 @@ static int dccp_v4_init_sock(struct sock *sk) | |||
1211 | * setsockopt(CCIDs-I-want/accept). -acme | 1243 | * setsockopt(CCIDs-I-want/accept). -acme |
1212 | */ | 1244 | */ |
1213 | if (likely(!dccp_ctl_socket_init)) { | 1245 | if (likely(!dccp_ctl_socket_init)) { |
1214 | dp->dccps_hc_rx_ccid = ccid_init(dp->dccps_options.dccpo_ccid, sk); | 1246 | dp->dccps_hc_rx_ccid = ccid_init(dp->dccps_options.dccpo_ccid, |
1215 | dp->dccps_hc_tx_ccid = ccid_init(dp->dccps_options.dccpo_ccid, sk); | 1247 | sk); |
1248 | dp->dccps_hc_tx_ccid = ccid_init(dp->dccps_options.dccpo_ccid, | ||
1249 | sk); | ||
1216 | if (dp->dccps_hc_rx_ccid == NULL || | 1250 | if (dp->dccps_hc_rx_ccid == NULL || |
1217 | dp->dccps_hc_tx_ccid == NULL) { | 1251 | dp->dccps_hc_tx_ccid == NULL) { |
1218 | ccid_exit(dp->dccps_hc_rx_ccid, sk); | 1252 | ccid_exit(dp->dccps_hc_rx_ccid, sk); |