tcp: Remove check in __tcp_push_pending_frames
[safe/jmp/linux-2.6] / net / dccp / options.c
index 0e27711..1b08cae 100644 (file)
 #include "dccp.h"
 #include "feat.h"
 
-int sysctl_dccp_feat_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW;
-int sysctl_dccp_feat_rx_ccid         = DCCPF_INITIAL_CCID;
-int sysctl_dccp_feat_tx_ccid         = DCCPF_INITIAL_CCID;
-int sysctl_dccp_feat_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR;
-int sysctl_dccp_feat_send_ndp_count  = DCCPF_INITIAL_SEND_NDP_COUNT;
-
 u64 dccp_decode_value_var(const u8 *bf, const u8 len)
 {
        u64 value = 0;
@@ -67,7 +61,7 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
                                        (dh->dccph_doff * 4);
        struct dccp_options_received *opt_recv = &dp->dccps_options_received;
        unsigned char opt, len;
-       unsigned char *value;
+       unsigned char *uninitialized_var(value);
        u32 elapsed_time;
        __be32 opt_val;
        int rc;
@@ -134,41 +128,19 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
                        dccp_pr_debug("%s opt: NDP count=%llu\n", dccp_role(sk),
                                      (unsigned long long)opt_recv->dccpor_ndp);
                        break;
-               case DCCPO_CHANGE_L:
-                       /* fall through */
-               case DCCPO_CHANGE_R:
-                       if (pkt_type == DCCP_PKT_DATA)
-                               break;
-                       if (len < 2)
-                               goto out_invalid_option;
-                       rc = dccp_feat_change_recv(sk, opt, *value, value + 1,
-                                                  len - 1);
-                       /*
-                        * When there is a change error, change_recv is
-                        * responsible for dealing with it.  i.e. reply with an
-                        * empty confirm.
-                        * If the change was mandatory, then we need to die.
-                        */
-                       if (rc && mandatory)
-                               goto out_invalid_option;
-                       break;
-               case DCCPO_CONFIRM_L:
-                       /* fall through */
-               case DCCPO_CONFIRM_R:
-                       if (pkt_type == DCCP_PKT_DATA)
+               case DCCPO_CHANGE_L ... DCCPO_CONFIRM_R:
+                       if (pkt_type == DCCP_PKT_DATA)      /* RFC 4340, 6 */
                                break;
-                       if (len < 2)    /* FIXME this disallows empty confirm */
-                               goto out_invalid_option;
-                       if (dccp_feat_confirm_recv(sk, opt, *value,
-                                                  value + 1, len - 1))
-                               goto out_invalid_option;
+                       rc = dccp_feat_parse_options(sk, dreq, mandatory, opt,
+                                                   *value, value + 1, len - 1);
+                       if (rc)
+                               goto out_featneg_failed;
                        break;
                case DCCPO_ACK_VECTOR_0:
                case DCCPO_ACK_VECTOR_1:
                        if (dccp_packet_without_ack(skb))   /* RFC 4340, 11.4 */
                                break;
-
-                       if (dccp_msk(sk)->dccpms_send_ack_vector &&
+                       if (dp->dccps_hc_rx_ackvec != NULL &&
                            dccp_ackvec_parse(sk, skb, &ackno, opt, value, len))
                                goto out_invalid_option;
                        break;
@@ -292,8 +264,10 @@ out_nonsensical_length:
 
 out_invalid_option:
        DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT);
-       DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR;
-       DCCP_WARN("DCCP(%p): invalid option %d, len=%d", sk, opt, len);
+       rc = DCCP_RESET_CODE_OPTION_ERROR;
+out_featneg_failed:
+       DCCP_WARN("DCCP(%p): Option %d (len=%d) error=%u\n", sk, opt, len, rc);
+       DCCP_SKB_CB(skb)->dccpd_reset_code = rc;
        DCCP_SKB_CB(skb)->dccpd_reset_data[0] = opt;
        DCCP_SKB_CB(skb)->dccpd_reset_data[1] = len > 0 ? value[0] : 0;
        DCCP_SKB_CB(skb)->dccpd_reset_data[2] = len > 1 ? value[1] : 0;
@@ -524,10 +498,6 @@ int dccp_insert_fn_opt(struct sk_buff *skb, u8 type, u8 feat,
                *to++ = *val;
        if (len)
                memcpy(to, val, len);
-
-       dccp_pr_debug("%s(%s (%d), ...), length %d\n",
-                     dccp_feat_typename(type),
-                     dccp_feat_name(feat), feat, len);
        return 0;
 }
 
@@ -546,12 +516,10 @@ static void dccp_insert_option_padding(struct sk_buff *skb)
 int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
 {
        struct dccp_sock *dp = dccp_sk(sk);
-       struct dccp_minisock *dmsk = dccp_msk(sk);
 
        DCCP_SKB_CB(skb)->dccpd_opt_len = 0;
 
-       if (dmsk->dccpms_send_ndp_count &&
-           dccp_insert_option_ndp(sk, skb))
+       if (dp->dccps_send_ndp_count && dccp_insert_option_ndp(sk, skb))
                return -1;
 
        if (DCCP_SKB_CB(skb)->dccpd_type != DCCP_PKT_DATA) {
@@ -568,7 +536,7 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
                        if (dccp_insert_option_timestamp(sk, skb))
                                return -1;
 
-               } else if (dmsk->dccpms_send_ack_vector &&
+               } else if (dp->dccps_hc_rx_ackvec != NULL &&
                           dccp_ackvec_pending(dp->dccps_hc_rx_ackvec) &&
                           dccp_insert_option_ackvec(sk, skb)) {
                                return -1;