Commit a4bf3902427a128455b8de299ff0918072b2e974

Authored by Arnaldo Carvalho de Melo
Committed by David S. Miller
1 parent e6f507196c

[DCCP] minisock: Rename struct dccp_options to struct dccp_minisock

This will later be included in struct dccp_request_sock so that we can
have per connection feature negotiation state while in the 3way
handshake, when we clone the DCCP_ROLE_LISTEN socket (in
dccp_create_openreq_child) we'll just copy this state from
dreq_minisock to dccps_minisock.

Also the feature negotiation and option parsing code will mostly touch
dccps_minisock, which will simplify some stuff.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 8 changed files with 104 additions and 103 deletions Side-by-side Diff

include/linux/dccp.h
... ... @@ -328,21 +328,24 @@
328 328 #define DCCP_NDP_LIMIT 0xFFFFFF
329 329  
330 330 /**
331   - * struct dccp_options - option values for a DCCP connection
332   - * @dccpo_sequence_window - Sequence Window Feature (section 7.5.2)
333   - * @dccpo_ccid - Congestion Control Id (CCID) (section 10)
334   - * @dccpo_send_ack_vector - Send Ack Vector Feature (section 11.5)
335   - * @dccpo_send_ndp_count - Send NDP Count Feature (7.7.2)
  331 + * struct dccp_minisock - Minimal DCCP connection representation
  332 + *
  333 + * Will be used to pass the state from dccp_request_sock to dccp_sock.
  334 + *
  335 + * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
  336 + * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
  337 + * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
  338 + * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
336 339 */
337   -struct dccp_options {
338   - __u64 dccpo_sequence_window;
339   - __u8 dccpo_rx_ccid;
340   - __u8 dccpo_tx_ccid;
341   - __u8 dccpo_send_ack_vector;
342   - __u8 dccpo_send_ndp_count;
343   - __u8 dccpo_ack_ratio;
344   - struct list_head dccpo_pending;
345   - struct list_head dccpo_conf;
  340 +struct dccp_minisock {
  341 + __u64 dccpms_sequence_window;
  342 + __u8 dccpms_rx_ccid;
  343 + __u8 dccpms_tx_ccid;
  344 + __u8 dccpms_send_ack_vector;
  345 + __u8 dccpms_send_ndp_count;
  346 + __u8 dccpms_ack_ratio;
  347 + struct list_head dccpms_pending;
  348 + struct list_head dccpms_conf;
346 349 };
347 350  
348 351 struct dccp_opt_conf {
... ... @@ -360,8 +363,9 @@
360 363 struct dccp_opt_conf *dccpop_sc;
361 364 };
362 365  
363   -extern void __dccp_options_init(struct dccp_options *dccpo);
364   -extern void dccp_options_init(struct dccp_options *dccpo);
  366 +extern void __dccp_minisock_init(struct dccp_minisock *dmsk);
  367 +extern void dccp_minisock_init(struct dccp_minisock *dmsk);
  368 +
365 369 extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
366 370  
367 371 struct dccp_request_sock {
... ... @@ -457,7 +461,7 @@
457 461 __u16 dccps_r_ack_ratio;
458 462 unsigned long dccps_ndp_count;
459 463 __u32 dccps_mss_cache;
460   - struct dccp_options dccps_options;
  464 + struct dccp_minisock dccps_minisock;
461 465 struct dccp_ackvec *dccps_hc_rx_ackvec;
462 466 struct ccid *dccps_hc_rx_ccid;
463 467 struct ccid *dccps_hc_tx_ccid;
... ... @@ -471,6 +475,11 @@
471 475 static inline struct dccp_sock *dccp_sk(const struct sock *sk)
472 476 {
473 477 return (struct dccp_sock *)sk;
  478 +}
  479 +
  480 +static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
  481 +{
  482 + return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
474 483 }
475 484  
476 485 static inline int dccp_service_not_initialized(const struct sock *sk)
... ... @@ -303,14 +303,13 @@
303 303 static inline void dccp_update_gsr(struct sock *sk, u64 seq)
304 304 {
305 305 struct dccp_sock *dp = dccp_sk(sk);
  306 + const struct dccp_minisock *dmsk = dccp_msk(sk);
306 307  
307 308 dp->dccps_gsr = seq;
308 309 dccp_set_seqno(&dp->dccps_swl,
309   - (dp->dccps_gsr + 1 -
310   - (dp->dccps_options.dccpo_sequence_window / 4)));
  310 + dp->dccps_gsr + 1 - (dmsk->dccpms_sequence_window / 4));
311 311 dccp_set_seqno(&dp->dccps_swh,
312   - (dp->dccps_gsr +
313   - (3 * dp->dccps_options.dccpo_sequence_window) / 4));
  312 + dp->dccps_gsr + (3 * dmsk->dccpms_sequence_window) / 4);
314 313 }
315 314  
316 315 static inline void dccp_update_gss(struct sock *sk, u64 seq)
... ... @@ -320,7 +319,7 @@
320 319 dp->dccps_awh = dp->dccps_gss = seq;
321 320 dccp_set_seqno(&dp->dccps_awl,
322 321 (dp->dccps_gss -
323   - dp->dccps_options.dccpo_sequence_window + 1));
  322 + dccp_msk(sk)->dccpms_sequence_window + 1));
324 323 }
325 324  
326 325 static inline int dccp_ack_pending(const struct sock *sk)
... ... @@ -328,7 +327,7 @@
328 327 const struct dccp_sock *dp = dccp_sk(sk);
329 328 return dp->dccps_timestamp_echo != 0 ||
330 329 #ifdef CONFIG_IP_DCCP_ACKVEC
331   - (dp->dccps_options.dccpo_send_ack_vector &&
  330 + (dccp_msk(sk)->dccpms_send_ack_vector &&
332 331 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec)) ||
333 332 #endif
334 333 inet_csk_ack_scheduled(sk);
... ... @@ -30,7 +30,7 @@
30 30 info->tcpi_backoff = icsk->icsk_backoff;
31 31 info->tcpi_pmtu = icsk->icsk_pmtu_cookie;
32 32  
33   - if (dp->dccps_options.dccpo_send_ack_vector)
  33 + if (dccp_msk(sk)->dccpms_send_ack_vector)
34 34 info->tcpi_options |= TCPI_OPT_SACK;
35 35  
36 36 ccid_hc_rx_get_info(dp->dccps_hc_rx_ccid, sk, info);
... ... @@ -22,7 +22,7 @@
22 22 int dccp_feat_change(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len,
23 23 gfp_t gfp)
24 24 {
25   - struct dccp_sock *dp = dccp_sk(sk);
  25 + struct dccp_minisock *dmsk = dccp_msk(sk);
26 26 struct dccp_opt_pend *opt;
27 27  
28 28 dccp_pr_debug("feat change type=%d feat=%d\n", type, feature);
... ... @@ -30,8 +30,7 @@
30 30 /* XXX sanity check feat change request */
31 31  
32 32 /* check if that feature is already being negotiated */
33   - list_for_each_entry(opt, &dp->dccps_options.dccpo_pending,
34   - dccpop_node) {
  33 + list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) {
35 34 /* ok we found a negotiation for this option already */
36 35 if (opt->dccpop_feat == feature && opt->dccpop_type == type) {
37 36 dccp_pr_debug("Replacing old\n");
... ... @@ -59,7 +58,7 @@
59 58  
60 59 BUG_ON(opt->dccpop_val == NULL);
61 60  
62   - list_add_tail(&opt->dccpop_node, &dp->dccps_options.dccpo_pending);
  61 + list_add_tail(&opt->dccpop_node, &dmsk->dccpms_pending);
63 62 return 0;
64 63 }
65 64  
66 65  
... ... @@ -68,10 +67,10 @@
68 67 static int dccp_feat_update_ccid(struct sock *sk, u8 type, u8 new_ccid_nr)
69 68 {
70 69 struct dccp_sock *dp = dccp_sk(sk);
  70 + struct dccp_minisock *dmsk = dccp_msk(sk);
71 71 /* figure out if we are changing our CCID or the peer's */
72 72 const int rx = type == DCCPO_CHANGE_R;
73   - const u8 ccid_nr = rx ? dp->dccps_options.dccpo_rx_ccid :
74   - dp->dccps_options.dccpo_tx_ccid;
  73 + const u8 ccid_nr = rx ? dmsk->dccpms_rx_ccid : dmsk->dccpms_tx_ccid;
75 74 struct ccid *new_ccid;
76 75  
77 76 /* Check if nothing is being changed. */
78 77  
... ... @@ -85,11 +84,11 @@
85 84 if (rx) {
86 85 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
87 86 dp->dccps_hc_rx_ccid = new_ccid;
88   - dp->dccps_options.dccpo_rx_ccid = new_ccid_nr;
  87 + dmsk->dccpms_rx_ccid = new_ccid_nr;
89 88 } else {
90 89 ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
91 90 dp->dccps_hc_tx_ccid = new_ccid;
92   - dp->dccps_options.dccpo_tx_ccid = new_ccid_nr;
  91 + dmsk->dccpms_tx_ccid = new_ccid_nr;
93 92 }
94 93  
95 94 return 0;
96 95  
... ... @@ -159,9 +158,9 @@
159 158 case DCCPF_CCID:
160 159 /* XXX did i get this right? =P */
161 160 if (opt->dccpop_type == DCCPO_CHANGE_L)
162   - res = &dp->dccps_options.dccpo_tx_ccid;
  161 + res = &dccp_msk(sk)->dccpms_tx_ccid;
163 162 else
164   - res = &dp->dccps_options.dccpo_rx_ccid;
  163 + res = &dccp_msk(sk)->dccpms_rx_ccid;
165 164 break;
166 165  
167 166 default:
... ... @@ -226,7 +225,7 @@
226 225  
227 226 static int dccp_feat_sp(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len)
228 227 {
229   - struct dccp_sock *dp = dccp_sk(sk);
  228 + struct dccp_minisock *dmsk = dccp_msk(sk);
230 229 struct dccp_opt_pend *opt;
231 230 int rc = 1;
232 231 u8 t;
... ... @@ -242,8 +241,7 @@
242 241 t = DCCPO_CHANGE_L;
243 242  
244 243 /* find our preference list for this feature */
245   - list_for_each_entry(opt, &dp->dccps_options.dccpo_pending,
246   - dccpop_node) {
  244 + list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) {
247 245 if (opt->dccpop_type != t || opt->dccpop_feat != feature)
248 246 continue;
249 247  
... ... @@ -265,7 +263,7 @@
265 263 static int dccp_feat_nn(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len)
266 264 {
267 265 struct dccp_opt_pend *opt;
268   - struct dccp_sock *dp = dccp_sk(sk);
  266 + struct dccp_minisock *dmsk = dccp_msk(sk);
269 267 u8 *copy;
270 268 int rc;
271 269  
272 270  
... ... @@ -304,14 +302,14 @@
304 302 }
305 303  
306 304 dccp_pr_debug("Confirming NN feature %d (val=%d)\n", feature, *copy);
307   - list_add_tail(&opt->dccpop_node, &dp->dccps_options.dccpo_conf);
  305 + list_add_tail(&opt->dccpop_node, &dmsk->dccpms_conf);
308 306  
309 307 return 0;
310 308 }
311 309  
312 310 static void dccp_feat_empty_confirm(struct sock *sk, u8 type, u8 feature)
313 311 {
314   - struct dccp_sock *dp = dccp_sk(sk);
  312 + struct dccp_minisock *dmsk = dccp_msk(sk);
315 313 /* XXX check if other confirms for that are queued and recycle slot */
316 314 struct dccp_opt_pend *opt = kzalloc(sizeof(*opt), GFP_ATOMIC);
317 315  
318 316  
319 317  
320 318  
... ... @@ -330,20 +328,19 @@
330 328  
331 329 /* change feature */
332 330 dccp_pr_debug("Empty confirm feature %d type %d\n", feature, type);
333   - list_add_tail(&opt->dccpop_node, &dp->dccps_options.dccpo_conf);
  331 + list_add_tail(&opt->dccpop_node, &dmsk->dccpms_conf);
334 332 }
335 333  
336 334 static void dccp_feat_flush_confirm(struct sock *sk)
337 335 {
338   - struct dccp_sock *dp = dccp_sk(sk);
  336 + struct dccp_minisock *dmsk = dccp_msk(sk);
339 337 /* Check if there is anything to confirm in the first place */
340   - int yes = !list_empty(&dp->dccps_options.dccpo_conf);
  338 + int yes = !list_empty(&dmsk->dccpms_conf);
341 339  
342 340 if (!yes) {
343 341 struct dccp_opt_pend *opt;
344 342  
345   - list_for_each_entry(opt, &dp->dccps_options.dccpo_pending,
346   - dccpop_node) {
  343 + list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) {
347 344 if (opt->dccpop_conf) {
348 345 yes = 1;
349 346 break;
... ... @@ -407,7 +404,7 @@
407 404 {
408 405 u8 t;
409 406 struct dccp_opt_pend *opt;
410   - struct dccp_sock *dp = dccp_sk(sk);
  407 + struct dccp_minisock *dmsk = dccp_msk(sk);
411 408 int rc = 1;
412 409 int all_confirmed = 1;
413 410  
... ... @@ -418,8 +415,7 @@
418 415 /* locate our change request */
419 416 t = type == DCCPO_CONFIRM_L ? DCCPO_CHANGE_R : DCCPO_CHANGE_L;
420 417  
421   - list_for_each_entry(opt, &dp->dccps_options.dccpo_pending,
422   - dccpop_node) {
  418 + list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) {
423 419 if (!opt->dccpop_conf && opt->dccpop_type == t &&
424 420 opt->dccpop_feat == feature) {
425 421 /* we found it */
426 422  
... ... @@ -462,10 +458,10 @@
462 458  
463 459 void dccp_feat_clean(struct sock *sk)
464 460 {
465   - struct dccp_sock *dp = dccp_sk(sk);
  461 + struct dccp_minisock *dmsk = dccp_msk(sk);
466 462 struct dccp_opt_pend *opt, *next;
467 463  
468   - list_for_each_entry_safe(opt, next, &dp->dccps_options.dccpo_pending,
  464 + list_for_each_entry_safe(opt, next, &dmsk->dccpms_pending,
469 465 dccpop_node) {
470 466 BUG_ON(opt->dccpop_val == NULL);
471 467 kfree(opt->dccpop_val);
472 468  
473 469  
... ... @@ -478,16 +474,15 @@
478 474  
479 475 kfree(opt);
480 476 }
481   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_pending);
  477 + INIT_LIST_HEAD(&dmsk->dccpms_pending);
482 478  
483   - list_for_each_entry_safe(opt, next, &dp->dccps_options.dccpo_conf,
484   - dccpop_node) {
  479 + list_for_each_entry_safe(opt, next, &dmsk->dccpms_conf, dccpop_node) {
485 480 BUG_ON(opt == NULL);
486 481 if (opt->dccpop_val != NULL)
487 482 kfree(opt->dccpop_val);
488 483 kfree(opt);
489 484 }
490   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_conf);
  485 + INIT_LIST_HEAD(&dmsk->dccpms_conf);
491 486 }
492 487  
493 488 EXPORT_SYMBOL_GPL(dccp_feat_clean);
494 489  
495 490  
... ... @@ -498,16 +493,15 @@
498 493 */
499 494 int dccp_feat_clone(struct sock *oldsk, struct sock *newsk)
500 495 {
501   - struct dccp_sock *olddp = dccp_sk(oldsk);
502   - struct dccp_sock *newdp = dccp_sk(newsk);
  496 + struct dccp_minisock *olddmsk = dccp_msk(oldsk);
  497 + struct dccp_minisock *newdmsk = dccp_msk(newsk);
503 498 struct dccp_opt_pend *opt;
504 499 int rc = 0;
505 500  
506   - INIT_LIST_HEAD(&newdp->dccps_options.dccpo_pending);
507   - INIT_LIST_HEAD(&newdp->dccps_options.dccpo_conf);
  501 + INIT_LIST_HEAD(&newdmsk->dccpms_pending);
  502 + INIT_LIST_HEAD(&newdmsk->dccpms_conf);
508 503  
509   - list_for_each_entry(opt, &olddp->dccps_options.dccpo_pending,
510   - dccpop_node) {
  504 + list_for_each_entry(opt, &olddmsk->dccpms_pending, dccpop_node) {
511 505 struct dccp_opt_pend *newopt;
512 506 /* copy the value of the option */
513 507 u8 *val = kmalloc(opt->dccpop_len, GFP_ATOMIC);
... ... @@ -525,8 +519,7 @@
525 519 /* insert the option */
526 520 memcpy(newopt, opt, sizeof(*newopt));
527 521 newopt->dccpop_val = val;
528   - list_add_tail(&newopt->dccpop_node,
529   - &newdp->dccps_options.dccpo_pending);
  522 + list_add_tail(&newopt->dccpop_node, &newdmsk->dccpms_pending);
530 523  
531 524 /* XXX what happens with backlogs and multiple connections at
532 525 * once...
533 526  
534 527  
535 528  
536 529  
... ... @@ -567,27 +560,27 @@
567 560  
568 561 int dccp_feat_init(struct sock *sk)
569 562 {
570   - struct dccp_sock *dp = dccp_sk(sk);
  563 + struct dccp_minisock *dmsk = dccp_msk(sk);
571 564 int rc;
572 565  
573   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_pending);
574   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_conf);
  566 + INIT_LIST_HEAD(&dmsk->dccpms_pending);
  567 + INIT_LIST_HEAD(&dmsk->dccpms_conf);
575 568  
576 569 /* CCID L */
577 570 rc = __dccp_feat_init(sk, DCCPO_CHANGE_L, DCCPF_CCID,
578   - &dp->dccps_options.dccpo_tx_ccid, 1);
  571 + &dmsk->dccpms_tx_ccid, 1);
579 572 if (rc)
580 573 goto out;
581 574  
582 575 /* CCID R */
583 576 rc = __dccp_feat_init(sk, DCCPO_CHANGE_R, DCCPF_CCID,
584   - &dp->dccps_options.dccpo_rx_ccid, 1);
  577 + &dmsk->dccpms_rx_ccid, 1);
585 578 if (rc)
586 579 goto out;
587 580  
588 581 /* Ack ratio */
589 582 rc = __dccp_feat_init(sk, DCCPO_CHANGE_L, DCCPF_ACK_RATIO,
590   - &dp->dccps_options.dccpo_ack_ratio, 1);
  583 + &dmsk->dccpms_ack_ratio, 1);
591 584 out:
592 585 return rc;
593 586 }
... ... @@ -60,7 +60,7 @@
60 60 {
61 61 struct dccp_sock *dp = dccp_sk(sk);
62 62  
63   - if (dp->dccps_options.dccpo_send_ack_vector)
  63 + if (dccp_msk(sk)->dccpms_send_ack_vector)
64 64 dccp_ackvec_check_rcv_ackno(dp->dccps_hc_rx_ackvec, sk,
65 65 DCCP_SKB_CB(skb)->dccpd_ack_seq);
66 66 }
... ... @@ -246,7 +246,7 @@
246 246 if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
247 247 dccp_event_ack_recv(sk, skb);
248 248  
249   - if (dp->dccps_options.dccpo_send_ack_vector &&
  249 + if (dccp_msk(sk)->dccpms_send_ack_vector &&
250 250 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
251 251 DCCP_SKB_CB(skb)->dccpd_seq,
252 252 DCCP_ACKVEC_STATE_RECEIVED))
... ... @@ -302,7 +302,7 @@
302 302 if (dccp_parse_options(sk, skb))
303 303 goto out_invalid_packet;
304 304  
305   - if (dp->dccps_options.dccpo_send_ack_vector &&
  305 + if (dccp_msk(sk)->dccpms_send_ack_vector &&
306 306 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
307 307 DCCP_SKB_CB(skb)->dccpd_seq,
308 308 DCCP_ACKVEC_STATE_RECEIVED))
... ... @@ -486,7 +486,7 @@
486 486 if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
487 487 dccp_event_ack_recv(sk, skb);
488 488  
489   - if (dp->dccps_options.dccpo_send_ack_vector &&
  489 + if (dccp_msk(sk)->dccpms_send_ack_vector &&
490 490 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
491 491 DCCP_SKB_CB(skb)->dccpd_seq,
492 492 DCCP_ACKVEC_STATE_RECEIVED))
net/dccp/minisocks.c
... ... @@ -107,6 +107,7 @@
107 107 const struct dccp_request_sock *dreq = dccp_rsk(req);
108 108 struct inet_connection_sock *newicsk = inet_csk(sk);
109 109 struct dccp_sock *newdp = dccp_sk(newsk);
  110 + struct dccp_minisock *newdmsk = dccp_msk(newsk);
110 111  
111 112 newdp->dccps_role = DCCP_ROLE_SERVER;
112 113 newdp->dccps_hc_rx_ackvec = NULL;
... ... @@ -118,7 +119,7 @@
118 119 if (dccp_feat_clone(sk, newsk))
119 120 goto out_free;
120 121  
121   - if (newdp->dccps_options.dccpo_send_ack_vector) {
  122 + if (newdmsk->dccpms_send_ack_vector) {
122 123 newdp->dccps_hc_rx_ackvec =
123 124 dccp_ackvec_alloc(GFP_ATOMIC);
124 125 if (unlikely(newdp->dccps_hc_rx_ackvec == NULL))
125 126  
... ... @@ -126,10 +127,10 @@
126 127 }
127 128  
128 129 newdp->dccps_hc_rx_ccid =
129   - ccid_hc_rx_new(newdp->dccps_options.dccpo_rx_ccid,
  130 + ccid_hc_rx_new(newdmsk->dccpms_rx_ccid,
130 131 newsk, GFP_ATOMIC);
131 132 newdp->dccps_hc_tx_ccid =
132   - ccid_hc_tx_new(newdp->dccps_options.dccpo_tx_ccid,
  133 + ccid_hc_tx_new(newdmsk->dccpms_tx_ccid,
133 134 newsk, GFP_ATOMIC);
134 135 if (unlikely(newdp->dccps_hc_rx_ccid == NULL ||
135 136 newdp->dccps_hc_tx_ccid == NULL)) {
... ... @@ -153,7 +154,7 @@
153 154 */
154 155  
155 156 /* See dccp_v4_conn_request */
156   - newdp->dccps_options.dccpo_sequence_window = req->rcv_wnd;
  157 + newdmsk->dccpms_sequence_window = req->rcv_wnd;
157 158  
158 159 newdp->dccps_gar = newdp->dccps_isr = dreq->dreq_isr;
159 160 dccp_update_gsr(newsk, dreq->dreq_isr);
... ... @@ -30,14 +30,14 @@
30 30 int dccp_feat_default_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR;
31 31 int dccp_feat_default_send_ndp_count = DCCPF_INITIAL_SEND_NDP_COUNT;
32 32  
33   -void dccp_options_init(struct dccp_options *dccpo)
  33 +void dccp_minisock_init(struct dccp_minisock *dmsk)
34 34 {
35   - dccpo->dccpo_sequence_window = dccp_feat_default_sequence_window;
36   - dccpo->dccpo_rx_ccid = dccp_feat_default_rx_ccid;
37   - dccpo->dccpo_tx_ccid = dccp_feat_default_tx_ccid;
38   - dccpo->dccpo_ack_ratio = dccp_feat_default_ack_ratio;
39   - dccpo->dccpo_send_ack_vector = dccp_feat_default_send_ack_vector;
40   - dccpo->dccpo_send_ndp_count = dccp_feat_default_send_ndp_count;
  35 + dmsk->dccpms_sequence_window = dccp_feat_default_sequence_window;
  36 + dmsk->dccpms_rx_ccid = dccp_feat_default_rx_ccid;
  37 + dmsk->dccpms_tx_ccid = dccp_feat_default_tx_ccid;
  38 + dmsk->dccpms_ack_ratio = dccp_feat_default_ack_ratio;
  39 + dmsk->dccpms_send_ack_vector = dccp_feat_default_send_ack_vector;
  40 + dmsk->dccpms_send_ndp_count = dccp_feat_default_send_ndp_count;
41 41 }
42 42  
43 43 static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len)
... ... @@ -151,7 +151,7 @@
151 151 if (pkt_type == DCCP_PKT_DATA)
152 152 break;
153 153  
154   - if (dp->dccps_options.dccpo_send_ack_vector &&
  154 + if (dccp_msk(sk)->dccpms_send_ack_vector &&
155 155 dccp_ackvec_parse(sk, skb, opt, value, len))
156 156 goto out_invalid_option;
157 157 break;
158 158  
... ... @@ -472,12 +472,12 @@
472 472 static int dccp_insert_options_feat(struct sock *sk, struct sk_buff *skb)
473 473 {
474 474 struct dccp_sock *dp = dccp_sk(sk);
  475 + struct dccp_minisock *dmsk = dccp_msk(sk);
475 476 struct dccp_opt_pend *opt, *next;
476 477 int change = 0;
477 478  
478 479 /* confirm any options [NN opts] */
479   - list_for_each_entry_safe(opt, next, &dp->dccps_options.dccpo_conf,
480   - dccpop_node) {
  480 + list_for_each_entry_safe(opt, next, &dmsk->dccpms_conf, dccpop_node) {
481 481 dccp_insert_feat_opt(skb, opt->dccpop_type,
482 482 opt->dccpop_feat, opt->dccpop_val,
483 483 opt->dccpop_len);
484 484  
... ... @@ -486,11 +486,10 @@
486 486 kfree(opt->dccpop_val);
487 487 kfree(opt);
488 488 }
489   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_conf);
  489 + INIT_LIST_HEAD(&dmsk->dccpms_conf);
490 490  
491 491 /* see which features we need to send */
492   - list_for_each_entry(opt, &dp->dccps_options.dccpo_pending,
493   - dccpop_node) {
  492 + list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) {
494 493 /* see if we need to send any confirm */
495 494 if (opt->dccpop_sc) {
496 495 dccp_insert_feat_opt(skb, opt->dccpop_type + 1,
497 496  
498 497  
... ... @@ -536,15 +535,16 @@
536 535 int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
537 536 {
538 537 struct dccp_sock *dp = dccp_sk(sk);
  538 + struct dccp_minisock *dmsk = dccp_msk(sk);
539 539  
540 540 DCCP_SKB_CB(skb)->dccpd_opt_len = 0;
541 541  
542   - if (dp->dccps_options.dccpo_send_ndp_count &&
  542 + if (dmsk->dccpms_send_ndp_count &&
543 543 dccp_insert_option_ndp(sk, skb))
544 544 return -1;
545 545  
546 546 if (!dccp_packet_without_ack(skb)) {
547   - if (dp->dccps_options.dccpo_send_ack_vector &&
  547 + if (dmsk->dccpms_send_ack_vector &&
548 548 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec) &&
549 549 dccp_insert_option_ackvec(sk, skb))
550 550 return -1;
... ... @@ -166,9 +166,10 @@
166 166 int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
167 167 {
168 168 struct dccp_sock *dp = dccp_sk(sk);
  169 + struct dccp_minisock *dmsk = dccp_msk(sk);
169 170 struct inet_connection_sock *icsk = inet_csk(sk);
170 171  
171   - dccp_options_init(&dp->dccps_options);
  172 + dccp_minisock_init(&dp->dccps_minisock);
172 173 do_gettimeofday(&dp->dccps_epoch);
173 174  
174 175 /*
175 176  
176 177  
... ... @@ -184,22 +185,20 @@
184 185 if (rc)
185 186 return rc;
186 187  
187   - if (dp->dccps_options.dccpo_send_ack_vector) {
  188 + if (dmsk->dccpms_send_ack_vector) {
188 189 dp->dccps_hc_rx_ackvec = dccp_ackvec_alloc(GFP_KERNEL);
189 190 if (dp->dccps_hc_rx_ackvec == NULL)
190 191 return -ENOMEM;
191 192 }
192   - dp->dccps_hc_rx_ccid =
193   - ccid_hc_rx_new(dp->dccps_options.dccpo_rx_ccid,
194   - sk, GFP_KERNEL);
195   - dp->dccps_hc_tx_ccid =
196   - ccid_hc_tx_new(dp->dccps_options.dccpo_tx_ccid,
197   - sk, GFP_KERNEL);
  193 + dp->dccps_hc_rx_ccid = ccid_hc_rx_new(dmsk->dccpms_rx_ccid,
  194 + sk, GFP_KERNEL);
  195 + dp->dccps_hc_tx_ccid = ccid_hc_tx_new(dmsk->dccpms_tx_ccid,
  196 + sk, GFP_KERNEL);
198 197 if (unlikely(dp->dccps_hc_rx_ccid == NULL ||
199 198 dp->dccps_hc_tx_ccid == NULL)) {
200 199 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
201 200 ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
202   - if (dp->dccps_options.dccpo_send_ack_vector) {
  201 + if (dmsk->dccpms_send_ack_vector) {
203 202 dccp_ackvec_free(dp->dccps_hc_rx_ackvec);
204 203 dp->dccps_hc_rx_ackvec = NULL;
205 204 }
... ... @@ -208,8 +207,8 @@
208 207 }
209 208 } else {
210 209 /* control socket doesn't need feat nego */
211   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_pending);
212   - INIT_LIST_HEAD(&dp->dccps_options.dccpo_conf);
  210 + INIT_LIST_HEAD(&dmsk->dccpms_pending);
  211 + INIT_LIST_HEAD(&dmsk->dccpms_conf);
213 212 }
214 213  
215 214 dccp_init_xmit_timers(sk);
... ... @@ -247,7 +246,7 @@
247 246 kfree(dp->dccps_service_list);
248 247 dp->dccps_service_list = NULL;
249 248  
250   - if (dp->dccps_options.dccpo_send_ack_vector) {
  249 + if (dccp_msk(sk)->dccpms_send_ack_vector) {
251 250 dccp_ackvec_free(dp->dccps_hc_rx_ackvec);
252 251 dp->dccps_hc_rx_ackvec = NULL;
253 252 }