aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ackvec.h7
-rw-r--r--net/dccp/ccid.c1
-rw-r--r--net/dccp/ccids/ccid3.c8
-rw-r--r--net/dccp/ccids/lib/loss_interval.c1
-rw-r--r--net/dccp/ccids/lib/packet_history.c3
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c2
-rw-r--r--net/dccp/dccp.h1
-rw-r--r--net/dccp/feat.c10
-rw-r--r--net/dccp/input.c1
-rw-r--r--net/dccp/ipv4.c24
-rw-r--r--net/dccp/ipv6.c61
-rw-r--r--net/dccp/options.c1
-rw-r--r--net/dccp/output.c1
13 files changed, 61 insertions, 60 deletions
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index e2ab0627a5ff..a269aa7f7923 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -50,7 +50,8 @@ static inline u8 dccp_ackvec_state(const u8 *cell)
50 return *cell & ~DCCPAV_MAX_RUNLEN; 50 return *cell & ~DCCPAV_MAX_RUNLEN;
51} 51}
52 52
53/** struct dccp_ackvec - Ack Vector main data structure 53/**
54 * struct dccp_ackvec - Ack Vector main data structure
54 * 55 *
55 * This implements a fixed-size circular buffer within an array and is largely 56 * This implements a fixed-size circular buffer within an array and is largely
56 * based on Appendix A of RFC 4340. 57 * based on Appendix A of RFC 4340.
@@ -76,7 +77,8 @@ struct dccp_ackvec {
76 struct list_head av_records; 77 struct list_head av_records;
77}; 78};
78 79
79/** struct dccp_ackvec_record - Records information about sent Ack Vectors 80/**
81 * struct dccp_ackvec_record - Records information about sent Ack Vectors
80 * 82 *
81 * These list entries define the additional information which the HC-Receiver 83 * These list entries define the additional information which the HC-Receiver
82 * keeps about recently-sent Ack Vectors; again refer to RFC 4340, Appendix A. 84 * keeps about recently-sent Ack Vectors; again refer to RFC 4340, Appendix A.
@@ -121,6 +123,7 @@ static inline bool dccp_ackvec_is_empty(const struct dccp_ackvec *av)
121 * @len: length of @vec 123 * @len: length of @vec
122 * @nonce: whether @vec had an ECN nonce of 0 or 1 124 * @nonce: whether @vec had an ECN nonce of 0 or 1
123 * @node: FIFO - arranged in descending order of ack_ackno 125 * @node: FIFO - arranged in descending order of ack_ackno
126 *
124 * This structure is used by CCIDs to access Ack Vectors in a received skb. 127 * This structure is used by CCIDs to access Ack Vectors in a received skb.
125 */ 128 */
126struct dccp_ackvec_parsed { 129struct dccp_ackvec_parsed {
diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c
index 48b585a5cba7..597557254ddb 100644
--- a/net/dccp/ccid.c
+++ b/net/dccp/ccid.c
@@ -46,6 +46,7 @@ bool ccid_support_check(u8 const *ccid_array, u8 array_len)
46 * ccid_get_builtin_ccids - Populate a list of built-in CCIDs 46 * ccid_get_builtin_ccids - Populate a list of built-in CCIDs
47 * @ccid_array: pointer to copy into 47 * @ccid_array: pointer to copy into
48 * @array_len: value to return length into 48 * @array_len: value to return length into
49 *
49 * This function allocates memory - caller must see that it is freed after use. 50 * This function allocates memory - caller must see that it is freed after use.
50 */ 51 */
51int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len) 52int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len)
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 8c67bedf85b0..d65e98798eca 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -113,6 +113,7 @@ static u32 ccid3_hc_tx_idle_rtt(struct ccid3_hc_tx_sock *hc, ktime_t now)
113/** 113/**
114 * ccid3_hc_tx_update_x - Update allowed sending rate X 114 * ccid3_hc_tx_update_x - Update allowed sending rate X
115 * @stamp: most recent time if available - can be left NULL. 115 * @stamp: most recent time if available - can be left NULL.
116 *
116 * This function tracks draft rfc3448bis, check there for latest details. 117 * This function tracks draft rfc3448bis, check there for latest details.
117 * 118 *
118 * Note: X and X_recv are both stored in units of 64 * bytes/second, to support 119 * Note: X and X_recv are both stored in units of 64 * bytes/second, to support
@@ -161,9 +162,11 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
161 } 162 }
162} 163}
163 164
164/* 165/**
165 * Track the mean packet size `s' (cf. RFC 4342, 5.3 and RFC 3448, 4.1) 166 * ccid3_hc_tx_update_s - Track the mean packet size `s'
166 * @len: DCCP packet payload size in bytes 167 * @len: DCCP packet payload size in bytes
168 *
169 * cf. RFC 4342, 5.3 and RFC 3448, 4.1
167 */ 170 */
168static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hc, int len) 171static inline void ccid3_hc_tx_update_s(struct ccid3_hc_tx_sock *hc, int len)
169{ 172{
@@ -270,6 +273,7 @@ out:
270/** 273/**
271 * ccid3_hc_tx_send_packet - Delay-based dequeueing of TX packets 274 * ccid3_hc_tx_send_packet - Delay-based dequeueing of TX packets
272 * @skb: next packet candidate to send on @sk 275 * @skb: next packet candidate to send on @sk
276 *
273 * This function uses the convention of ccid_packet_dequeue_eval() and 277 * This function uses the convention of ccid_packet_dequeue_eval() and
274 * returns a millisecond-delay value between 0 and t_mbi = 64000 msec. 278 * returns a millisecond-delay value between 0 and t_mbi = 64000 msec.
275 */ 279 */
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 497723c4d4bb..57f9fd78c4df 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -133,6 +133,7 @@ static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur,
133 * @rh: Receive history containing a fresh loss event 133 * @rh: Receive history containing a fresh loss event
134 * @calc_first_li: Caller-dependent routine to compute length of first interval 134 * @calc_first_li: Caller-dependent routine to compute length of first interval
135 * @sk: Used by @calc_first_li in caller-specific way (subtyping) 135 * @sk: Used by @calc_first_li in caller-specific way (subtyping)
136 *
136 * Updates I_mean and returns 1 if a new interval has in fact been added to @lh. 137 * Updates I_mean and returns 1 if a new interval has in fact been added to @lh.
137 */ 138 */
138int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh, 139int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh,
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c
index de8fe294bf0b..08df7a3acb3d 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -315,6 +315,7 @@ static void __three_after_loss(struct tfrc_rx_hist *h)
315 * @ndp: The NDP count belonging to @skb 315 * @ndp: The NDP count belonging to @skb
316 * @calc_first_li: Caller-dependent computation of first loss interval in @lh 316 * @calc_first_li: Caller-dependent computation of first loss interval in @lh
317 * @sk: Used by @calc_first_li (see tfrc_lh_interval_add) 317 * @sk: Used by @calc_first_li (see tfrc_lh_interval_add)
318 *
318 * Chooses action according to pending loss, updates LI database when a new 319 * Chooses action according to pending loss, updates LI database when a new
319 * loss was detected, and does required post-processing. Returns 1 when caller 320 * loss was detected, and does required post-processing. Returns 1 when caller
320 * should send feedback, 0 otherwise. 321 * should send feedback, 0 otherwise.
@@ -387,7 +388,7 @@ static inline struct tfrc_rx_hist_entry *
387} 388}
388 389
389/** 390/**
390 * tfrc_rx_hist_rtt_prev_s: previously suitable (wrt rtt_last_s) RTT-sampling entry 391 * tfrc_rx_hist_rtt_prev_s - previously suitable (wrt rtt_last_s) RTT-sampling entry
391 */ 392 */
392static inline struct tfrc_rx_hist_entry * 393static inline struct tfrc_rx_hist_entry *
393 tfrc_rx_hist_rtt_prev_s(const struct tfrc_rx_hist *h) 394 tfrc_rx_hist_rtt_prev_s(const struct tfrc_rx_hist *h)
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index a052a4377e26..88ef98285bec 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -611,6 +611,7 @@ static inline u32 tfrc_binsearch(u32 fval, u8 small)
611 * @s: packet size in bytes 611 * @s: packet size in bytes
612 * @R: RTT scaled by 1000000 (i.e., microseconds) 612 * @R: RTT scaled by 1000000 (i.e., microseconds)
613 * @p: loss ratio estimate scaled by 1000000 613 * @p: loss ratio estimate scaled by 1000000
614 *
614 * Returns X_calc in bytes per second (not scaled). 615 * Returns X_calc in bytes per second (not scaled).
615 */ 616 */
616u32 tfrc_calc_x(u16 s, u32 R, u32 p) 617u32 tfrc_calc_x(u16 s, u32 R, u32 p)
@@ -659,6 +660,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
659/** 660/**
660 * tfrc_calc_x_reverse_lookup - try to find p given f(p) 661 * tfrc_calc_x_reverse_lookup - try to find p given f(p)
661 * @fvalue: function value to match, scaled by 1000000 662 * @fvalue: function value to match, scaled by 1000000
663 *
662 * Returns closest match for p, also scaled by 1000000 664 * Returns closest match for p, also scaled by 1000000
663 */ 665 */
664u32 tfrc_calc_x_reverse_lookup(u32 fvalue) 666u32 tfrc_calc_x_reverse_lookup(u32 fvalue)
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 9040be049d8c..708e75bf623d 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -352,6 +352,7 @@ static inline int dccp_bad_service_code(const struct sock *sk,
352 * @dccpd_opt_len: total length of all options (5.8) in the packet 352 * @dccpd_opt_len: total length of all options (5.8) in the packet
353 * @dccpd_seq: sequence number 353 * @dccpd_seq: sequence number
354 * @dccpd_ack_seq: acknowledgment number subheader field value 354 * @dccpd_ack_seq: acknowledgment number subheader field value
355 *
355 * This is used for transmission as well as for reception. 356 * This is used for transmission as well as for reception.
356 */ 357 */
357struct dccp_skb_cb { 358struct dccp_skb_cb {
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index 78a2ad70e1b0..9733ddbc96cb 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -350,6 +350,7 @@ static int __dccp_feat_activate(struct sock *sk, const int idx,
350 * @feat_num: feature to activate, one of %dccp_feature_numbers 350 * @feat_num: feature to activate, one of %dccp_feature_numbers
351 * @local: whether local (1) or remote (0) @feat_num is meant 351 * @local: whether local (1) or remote (0) @feat_num is meant
352 * @fval: the value (SP or NN) to activate, or NULL to use the default value 352 * @fval: the value (SP or NN) to activate, or NULL to use the default value
353 *
353 * For general use this function is preferable over __dccp_feat_activate(). 354 * For general use this function is preferable over __dccp_feat_activate().
354 */ 355 */
355static int dccp_feat_activate(struct sock *sk, u8 feat_num, bool local, 356static int dccp_feat_activate(struct sock *sk, u8 feat_num, bool local,
@@ -446,6 +447,7 @@ static struct dccp_feat_entry *dccp_feat_list_lookup(struct list_head *fn_list,
446 * @head: list to add to 447 * @head: list to add to
447 * @feat: feature number 448 * @feat: feature number
448 * @local: whether the local (1) or remote feature with number @feat is meant 449 * @local: whether the local (1) or remote feature with number @feat is meant
450 *
449 * This is the only constructor and serves to ensure the above invariants. 451 * This is the only constructor and serves to ensure the above invariants.
450 */ 452 */
451static struct dccp_feat_entry * 453static struct dccp_feat_entry *
@@ -504,6 +506,7 @@ static int dccp_feat_push_change(struct list_head *fn_list, u8 feat, u8 local,
504 * @feat: one of %dccp_feature_numbers 506 * @feat: one of %dccp_feature_numbers
505 * @local: whether local (1) or remote (0) @feat_num is being confirmed 507 * @local: whether local (1) or remote (0) @feat_num is being confirmed
506 * @fval: pointer to NN/SP value to be inserted or NULL 508 * @fval: pointer to NN/SP value to be inserted or NULL
509 *
507 * Returns 0 on success, a Reset code for further processing otherwise. 510 * Returns 0 on success, a Reset code for further processing otherwise.
508 */ 511 */
509static int dccp_feat_push_confirm(struct list_head *fn_list, u8 feat, u8 local, 512static int dccp_feat_push_confirm(struct list_head *fn_list, u8 feat, u8 local,
@@ -691,6 +694,7 @@ int dccp_feat_insert_opts(struct dccp_sock *dp, struct dccp_request_sock *dreq,
691 * @feat: an NN feature from %dccp_feature_numbers 694 * @feat: an NN feature from %dccp_feature_numbers
692 * @mandatory: use Mandatory option if 1 695 * @mandatory: use Mandatory option if 1
693 * @nn_val: value to register (restricted to 4 bytes) 696 * @nn_val: value to register (restricted to 4 bytes)
697 *
694 * Note that NN features are local by definition (RFC 4340, 6.3.2). 698 * Note that NN features are local by definition (RFC 4340, 6.3.2).
695 */ 699 */
696static int __feat_register_nn(struct list_head *fn, u8 feat, 700static int __feat_register_nn(struct list_head *fn, u8 feat,
@@ -760,6 +764,7 @@ int dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local,
760 * dccp_feat_nn_get - Query current/pending value of NN feature 764 * dccp_feat_nn_get - Query current/pending value of NN feature
761 * @sk: DCCP socket of an established connection 765 * @sk: DCCP socket of an established connection
762 * @feat: NN feature number from %dccp_feature_numbers 766 * @feat: NN feature number from %dccp_feature_numbers
767 *
763 * For a known NN feature, returns value currently being negotiated, or 768 * For a known NN feature, returns value currently being negotiated, or
764 * current (confirmed) value if no negotiation is going on. 769 * current (confirmed) value if no negotiation is going on.
765 */ 770 */
@@ -790,6 +795,7 @@ EXPORT_SYMBOL_GPL(dccp_feat_nn_get);
790 * @sk: DCCP socket of an established connection 795 * @sk: DCCP socket of an established connection
791 * @feat: NN feature number from %dccp_feature_numbers 796 * @feat: NN feature number from %dccp_feature_numbers
792 * @nn_val: the new value to use 797 * @nn_val: the new value to use
798 *
793 * This function is used to communicate NN updates out-of-band. 799 * This function is used to communicate NN updates out-of-band.
794 */ 800 */
795int dccp_feat_signal_nn_change(struct sock *sk, u8 feat, u64 nn_val) 801int dccp_feat_signal_nn_change(struct sock *sk, u8 feat, u64 nn_val)
@@ -930,6 +936,7 @@ static const struct ccid_dependency *dccp_feat_ccid_deps(u8 ccid, bool is_local)
930 * @fn: feature-negotiation list to update 936 * @fn: feature-negotiation list to update
931 * @id: CCID number to track 937 * @id: CCID number to track
932 * @is_local: whether TX CCID (1) or RX CCID (0) is meant 938 * @is_local: whether TX CCID (1) or RX CCID (0) is meant
939 *
933 * This function needs to be called after registering all other features. 940 * This function needs to be called after registering all other features.
934 */ 941 */
935static int dccp_feat_propagate_ccid(struct list_head *fn, u8 id, bool is_local) 942static int dccp_feat_propagate_ccid(struct list_head *fn, u8 id, bool is_local)
@@ -953,6 +960,7 @@ static int dccp_feat_propagate_ccid(struct list_head *fn, u8 id, bool is_local)
953/** 960/**
954 * dccp_feat_finalise_settings - Finalise settings before starting negotiation 961 * dccp_feat_finalise_settings - Finalise settings before starting negotiation
955 * @dp: client or listening socket (settings will be inherited) 962 * @dp: client or listening socket (settings will be inherited)
963 *
956 * This is called after all registrations (socket initialisation, sysctls, and 964 * This is called after all registrations (socket initialisation, sysctls, and
957 * sockopt calls), and before sending the first packet containing Change options 965 * sockopt calls), and before sending the first packet containing Change options
958 * (ie. client-Request or server-Response), to ensure internal consistency. 966 * (ie. client-Request or server-Response), to ensure internal consistency.
@@ -1284,6 +1292,7 @@ confirmation_failed:
1284 * @feat: NN number, one of %dccp_feature_numbers 1292 * @feat: NN number, one of %dccp_feature_numbers
1285 * @val: NN value 1293 * @val: NN value
1286 * @len: length of @val in bytes 1294 * @len: length of @val in bytes
1295 *
1287 * This function combines the functionality of change_recv/confirm_recv, with 1296 * This function combines the functionality of change_recv/confirm_recv, with
1288 * the following differences (reset codes are the same): 1297 * the following differences (reset codes are the same):
1289 * - cleanup after receiving the Confirm; 1298 * - cleanup after receiving the Confirm;
@@ -1379,6 +1388,7 @@ fast_path_failed:
1379 * @feat: one of %dccp_feature_numbers 1388 * @feat: one of %dccp_feature_numbers
1380 * @val: value contents of @opt 1389 * @val: value contents of @opt
1381 * @len: length of @val in bytes 1390 * @len: length of @val in bytes
1391 *
1382 * Returns 0 on success, a Reset code for ending the connection otherwise. 1392 * Returns 0 on success, a Reset code for ending the connection otherwise.
1383 */ 1393 */
1384int dccp_feat_parse_options(struct sock *sk, struct dccp_request_sock *dreq, 1394int dccp_feat_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
diff --git a/net/dccp/input.c b/net/dccp/input.c
index bc93a333931e..14cdafad7a90 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -710,6 +710,7 @@ EXPORT_SYMBOL_GPL(dccp_rcv_state_process);
710/** 710/**
711 * dccp_sample_rtt - Validate and finalise computation of RTT sample 711 * dccp_sample_rtt - Validate and finalise computation of RTT sample
712 * @delta: number of microseconds between packet and acknowledgment 712 * @delta: number of microseconds between packet and acknowledgment
713 *
713 * The routine is kept generic to work in different contexts. It should be 714 * The routine is kept generic to work in different contexts. It should be
714 * called immediately when the ACK used for the RTT sample arrives. 715 * called immediately when the ACK used for the RTT sample arrives.
715 */ 716 */
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 07f5579ca756..176ecdba4a22 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -161,17 +161,10 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
161 if (sk->sk_state == DCCP_LISTEN) 161 if (sk->sk_state == DCCP_LISTEN)
162 return; 162 return;
163 163
164 /* We don't check in the destentry if pmtu discovery is forbidden 164 dst = inet_csk_update_pmtu(sk, mtu);
165 * on this route. We just assume that no packet_to_big packets 165 if (!dst)
166 * are send back when pmtu discovery is not active.
167 * There is a small race when the user changes this flag in the
168 * route, but I think that's acceptable.
169 */
170 if ((dst = __sk_dst_check(sk, 0)) == NULL)
171 return; 166 return;
172 167
173 dst->ops->update_pmtu(dst, mtu);
174
175 /* Something is about to be wrong... Remember soft error 168 /* Something is about to be wrong... Remember soft error
176 * for the case, if this connection will not able to recover. 169 * for the case, if this connection will not able to recover.
177 */ 170 */
@@ -195,6 +188,14 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
195 } /* else let the usual retransmit timer handle it */ 188 } /* else let the usual retransmit timer handle it */
196} 189}
197 190
191static void dccp_do_redirect(struct sk_buff *skb, struct sock *sk)
192{
193 struct dst_entry *dst = __sk_dst_check(sk, 0);
194
195 if (dst)
196 dst->ops->redirect(dst, sk, skb);
197}
198
198/* 199/*
199 * This routine is called by the ICMP module when it gets some sort of error 200 * This routine is called by the ICMP module when it gets some sort of error
200 * condition. If err < 0 then the socket should be closed and the error 201 * condition. If err < 0 then the socket should be closed and the error
@@ -259,6 +260,9 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
259 } 260 }
260 261
261 switch (type) { 262 switch (type) {
263 case ICMP_REDIRECT:
264 dccp_do_redirect(skb, sk);
265 goto out;
262 case ICMP_SOURCE_QUENCH: 266 case ICMP_SOURCE_QUENCH:
263 /* Just silently ignore these. */ 267 /* Just silently ignore these. */
264 goto out; 268 goto out;
@@ -477,7 +481,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
477 struct rtable *rt; 481 struct rtable *rt;
478 const struct iphdr *iph = ip_hdr(skb); 482 const struct iphdr *iph = ip_hdr(skb);
479 struct flowi4 fl4 = { 483 struct flowi4 fl4 = {
480 .flowi4_oif = skb_rtable(skb)->rt_iif, 484 .flowi4_oif = inet_iif(skb),
481 .daddr = iph->saddr, 485 .daddr = iph->saddr,
482 .saddr = iph->daddr, 486 .saddr = iph->daddr,
483 .flowi4_tos = RT_CONN_FLAGS(sk), 487 .flowi4_tos = RT_CONN_FLAGS(sk),
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index fa9512d86f3b..56840b249f3b 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -130,6 +130,13 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
130 130
131 np = inet6_sk(sk); 131 np = inet6_sk(sk);
132 132
133 if (type == NDISC_REDIRECT) {
134 struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
135
136 if (dst)
137 dst->ops->redirect(dst, sk, skb);
138 }
139
133 if (type == ICMPV6_PKT_TOOBIG) { 140 if (type == ICMPV6_PKT_TOOBIG) {
134 struct dst_entry *dst = NULL; 141 struct dst_entry *dst = NULL;
135 142
@@ -138,37 +145,12 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
138 if ((1 << sk->sk_state) & (DCCPF_LISTEN | DCCPF_CLOSED)) 145 if ((1 << sk->sk_state) & (DCCPF_LISTEN | DCCPF_CLOSED))
139 goto out; 146 goto out;
140 147
141 /* icmp should have updated the destination cache entry */ 148 dst = inet6_csk_update_pmtu(sk, ntohl(info));
142 dst = __sk_dst_check(sk, np->dst_cookie); 149 if (!dst)
143 if (dst == NULL) { 150 goto out;
144 struct inet_sock *inet = inet_sk(sk);
145 struct flowi6 fl6;
146
147 /* BUGGG_FUTURE: Again, it is not clear how
148 to handle rthdr case. Ignore this complexity
149 for now.
150 */
151 memset(&fl6, 0, sizeof(fl6));
152 fl6.flowi6_proto = IPPROTO_DCCP;
153 fl6.daddr = np->daddr;
154 fl6.saddr = np->saddr;
155 fl6.flowi6_oif = sk->sk_bound_dev_if;
156 fl6.fl6_dport = inet->inet_dport;
157 fl6.fl6_sport = inet->inet_sport;
158 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
159
160 dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
161 if (IS_ERR(dst)) {
162 sk->sk_err_soft = -PTR_ERR(dst);
163 goto out;
164 }
165 } else
166 dst_hold(dst);
167 151
168 if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) { 152 if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst))
169 dccp_sync_mss(sk, dst_mtu(dst)); 153 dccp_sync_mss(sk, dst_mtu(dst));
170 } /* else let the usual retransmit timer handle it */
171 dst_release(dst);
172 goto out; 154 goto out;
173 } 155 }
174 156
@@ -237,7 +219,6 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
237 struct inet6_request_sock *ireq6 = inet6_rsk(req); 219 struct inet6_request_sock *ireq6 = inet6_rsk(req);
238 struct ipv6_pinfo *np = inet6_sk(sk); 220 struct ipv6_pinfo *np = inet6_sk(sk);
239 struct sk_buff *skb; 221 struct sk_buff *skb;
240 struct ipv6_txoptions *opt = NULL;
241 struct in6_addr *final_p, final; 222 struct in6_addr *final_p, final;
242 struct flowi6 fl6; 223 struct flowi6 fl6;
243 int err = -1; 224 int err = -1;
@@ -253,9 +234,8 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
253 fl6.fl6_sport = inet_rsk(req)->loc_port; 234 fl6.fl6_sport = inet_rsk(req)->loc_port;
254 security_req_classify_flow(req, flowi6_to_flowi(&fl6)); 235 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
255 236
256 opt = np->opt;
257 237
258 final_p = fl6_update_dst(&fl6, opt, &final); 238 final_p = fl6_update_dst(&fl6, np->opt, &final);
259 239
260 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); 240 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
261 if (IS_ERR(dst)) { 241 if (IS_ERR(dst)) {
@@ -272,13 +252,11 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req,
272 &ireq6->loc_addr, 252 &ireq6->loc_addr,
273 &ireq6->rmt_addr); 253 &ireq6->rmt_addr);
274 fl6.daddr = ireq6->rmt_addr; 254 fl6.daddr = ireq6->rmt_addr;
275 err = ip6_xmit(sk, skb, &fl6, opt, np->tclass); 255 err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
276 err = net_xmit_eval(err); 256 err = net_xmit_eval(err);
277 } 257 }
278 258
279done: 259done:
280 if (opt != NULL && opt != np->opt)
281 sock_kfree_s(sk, opt, opt->tot_len);
282 dst_release(dst); 260 dst_release(dst);
283 return err; 261 return err;
284} 262}
@@ -473,7 +451,6 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
473 struct inet_sock *newinet; 451 struct inet_sock *newinet;
474 struct dccp6_sock *newdp6; 452 struct dccp6_sock *newdp6;
475 struct sock *newsk; 453 struct sock *newsk;
476 struct ipv6_txoptions *opt;
477 454
478 if (skb->protocol == htons(ETH_P_IP)) { 455 if (skb->protocol == htons(ETH_P_IP)) {
479 /* 456 /*
@@ -518,7 +495,6 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
518 return newsk; 495 return newsk;
519 } 496 }
520 497
521 opt = np->opt;
522 498
523 if (sk_acceptq_is_full(sk)) 499 if (sk_acceptq_is_full(sk))
524 goto out_overflow; 500 goto out_overflow;
@@ -530,7 +506,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
530 memset(&fl6, 0, sizeof(fl6)); 506 memset(&fl6, 0, sizeof(fl6));
531 fl6.flowi6_proto = IPPROTO_DCCP; 507 fl6.flowi6_proto = IPPROTO_DCCP;
532 fl6.daddr = ireq6->rmt_addr; 508 fl6.daddr = ireq6->rmt_addr;
533 final_p = fl6_update_dst(&fl6, opt, &final); 509 final_p = fl6_update_dst(&fl6, np->opt, &final);
534 fl6.saddr = ireq6->loc_addr; 510 fl6.saddr = ireq6->loc_addr;
535 fl6.flowi6_oif = sk->sk_bound_dev_if; 511 fl6.flowi6_oif = sk->sk_bound_dev_if;
536 fl6.fl6_dport = inet_rsk(req)->rmt_port; 512 fl6.fl6_dport = inet_rsk(req)->rmt_port;
@@ -595,11 +571,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
595 * Yes, keeping reference count would be much more clever, but we make 571 * Yes, keeping reference count would be much more clever, but we make
596 * one more one thing there: reattach optmem to newsk. 572 * one more one thing there: reattach optmem to newsk.
597 */ 573 */
598 if (opt != NULL) { 574 if (np->opt != NULL)
599 newnp->opt = ipv6_dup_options(newsk, opt); 575 newnp->opt = ipv6_dup_options(newsk, np->opt);
600 if (opt != np->opt)
601 sock_kfree_s(sk, opt, opt->tot_len);
602 }
603 576
604 inet_csk(newsk)->icsk_ext_hdr_len = 0; 577 inet_csk(newsk)->icsk_ext_hdr_len = 0;
605 if (newnp->opt != NULL) 578 if (newnp->opt != NULL)
@@ -625,8 +598,6 @@ out_nonewsk:
625 dst_release(dst); 598 dst_release(dst);
626out: 599out:
627 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); 600 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
628 if (opt != NULL && opt != np->opt)
629 sock_kfree_s(sk, opt, opt->tot_len);
630 return NULL; 601 return NULL;
631} 602}
632 603
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 68fa6b7a3e01..a58e0b634050 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -527,6 +527,7 @@ int dccp_insert_option_mandatory(struct sk_buff *skb)
527 * @val: NN value or SP array (preferred element first) to copy 527 * @val: NN value or SP array (preferred element first) to copy
528 * @len: true length of @val in bytes (excluding first element repetition) 528 * @len: true length of @val in bytes (excluding first element repetition)
529 * @repeat_first: whether to copy the first element of @val twice 529 * @repeat_first: whether to copy the first element of @val twice
530 *
530 * The last argument is used to construct Confirm options, where the preferred 531 * The last argument is used to construct Confirm options, where the preferred
531 * value and the preference list appear separately (RFC 4340, 6.3.1). Preference 532 * value and the preference list appear separately (RFC 4340, 6.3.1). Preference
532 * lists are kept such that the preferred entry is always first, so we only need 533 * lists are kept such that the preferred entry is always first, so we only need
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 787367308797..d17fc90a74b6 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -214,6 +214,7 @@ void dccp_write_space(struct sock *sk)
214 * dccp_wait_for_ccid - Await CCID send permission 214 * dccp_wait_for_ccid - Await CCID send permission
215 * @sk: socket to wait for 215 * @sk: socket to wait for
216 * @delay: timeout in jiffies 216 * @delay: timeout in jiffies
217 *
217 * This is used by CCIDs which need to delay the send time in process context. 218 * This is used by CCIDs which need to delay the send time in process context.
218 */ 219 */
219static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay) 220static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay)