feat.c (ac75773c2742d82cbcb078708df406e9017224b7) feat.c (f74e91b6cca5889e667193c7e794186db73c2000)
1/*
2 * net/dccp/feat.c
3 *
4 * An implementation of the DCCP protocol
5 * Andrea Bittau <a.bittau@cs.ucl.ac.uk>
6 *
7 * ASSUMPTIONS
8 * -----------
1/*
2 * net/dccp/feat.c
3 *
4 * An implementation of the DCCP protocol
5 * Andrea Bittau <a.bittau@cs.ucl.ac.uk>
6 *
7 * ASSUMPTIONS
8 * -----------
9 * o Feature negotiation is coordinated with connection setup (as in TCP), wild
10 * changes of parameters of an established connection are not supported.
9 * o All currently known SP features have 1-byte quantities. If in the future
10 * extensions of RFCs 4340..42 define features with item lengths larger than
11 * one byte, a feature-specific extension of the code will be required.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.

--- 520 unchanged lines hidden (view full) ---

537 if (sk->sk_state == DCCP_OPEN)
538 dccp_send_ack(sk);
539}
540
541int dccp_feat_change_recv(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len)
542{
543 int rc;
544
11 * o All currently known SP features have 1-byte quantities. If in the future
12 * extensions of RFCs 4340..42 define features with item lengths larger than
13 * one byte, a feature-specific extension of the code will be required.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.

--- 520 unchanged lines hidden (view full) ---

539 if (sk->sk_state == DCCP_OPEN)
540 dccp_send_ack(sk);
541}
542
543int dccp_feat_change_recv(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len)
544{
545 int rc;
546
547 /* Ignore Change requests other than during connection setup */
548 if (sk->sk_state != DCCP_LISTEN && sk->sk_state != DCCP_REQUESTING)
549 return 0;
545 dccp_feat_debug(type, feature, *val);
546
547 /* figure out if it's SP or NN feature */
548 switch (feature) {
549 /* deal with SP features */
550 case DCCPF_CCID:
551 rc = dccp_feat_sp(sk, type, feature, val, len);
552 break;

--- 33 unchanged lines hidden (view full) ---

586 u8 *val, u8 len)
587{
588 u8 t;
589 struct dccp_opt_pend *opt;
590 struct dccp_minisock *dmsk = dccp_msk(sk);
591 int found = 0;
592 int all_confirmed = 1;
593
550 dccp_feat_debug(type, feature, *val);
551
552 /* figure out if it's SP or NN feature */
553 switch (feature) {
554 /* deal with SP features */
555 case DCCPF_CCID:
556 rc = dccp_feat_sp(sk, type, feature, val, len);
557 break;

--- 33 unchanged lines hidden (view full) ---

591 u8 *val, u8 len)
592{
593 u8 t;
594 struct dccp_opt_pend *opt;
595 struct dccp_minisock *dmsk = dccp_msk(sk);
596 int found = 0;
597 int all_confirmed = 1;
598
599 /* Ignore Confirm options other than during connection setup */
600 if (sk->sk_state != DCCP_LISTEN && sk->sk_state != DCCP_REQUESTING)
601 return 0;
594 dccp_feat_debug(type, feature, *val);
595
596 /* locate our change request */
597 switch (type) {
598 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break;
599 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break;
600 default: DCCP_WARN("invalid type %d\n", type);
601 return 1;

--- 18 unchanged lines hidden (view full) ---

620 /* XXX check the return value of dccp_feat_update */
621 break;
622 }
623
624 if (!opt->dccpop_conf)
625 all_confirmed = 0;
626 }
627
602 dccp_feat_debug(type, feature, *val);
603
604 /* locate our change request */
605 switch (type) {
606 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break;
607 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break;
608 default: DCCP_WARN("invalid type %d\n", type);
609 return 1;

--- 18 unchanged lines hidden (view full) ---

628 /* XXX check the return value of dccp_feat_update */
629 break;
630 }
631
632 if (!opt->dccpop_conf)
633 all_confirmed = 0;
634 }
635
628 /* fix re-transmit timer */
629 /* XXX gotta make sure that no option negotiation occurs during
630 * connection shutdown. Consider that the CLOSEREQ is sent and timer is
631 * on. if all options are confirmed it might kill timer which should
632 * remain alive until close is received.
633 */
634 if (all_confirmed) {
635 dccp_pr_debug("clear feat negotiation timer %p\n", sk);
636 inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
637 }
638
639 if (!found)
640 dccp_pr_debug("%s(%d, ...) never requested\n",
641 dccp_feat_typename(type), feature);
642 return 0;
643}
644
645EXPORT_SYMBOL_GPL(dccp_feat_confirm_recv);
646

--- 170 unchanged lines hidden ---
636 if (!found)
637 dccp_pr_debug("%s(%d, ...) never requested\n",
638 dccp_feat_typename(type), feature);
639 return 0;
640}
641
642EXPORT_SYMBOL_GPL(dccp_feat_confirm_recv);
643

--- 170 unchanged lines hidden ---