dccp: remove unused function argument
[linux-2.6.git] / net / dccp / options.c
index 86c7a20..4973bad 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;
@@ -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;
@@ -322,12 +296,11 @@ static inline u8 dccp_ndp_len(const u64 ndp)
 {
        if (likely(ndp <= 0xFF))
                return 1;
-       return likely(ndp <= USHORT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6);
+       return likely(ndp <= USHRT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6);
 }
 
-int dccp_insert_option(struct sock *sk, struct sk_buff *skb,
-                       const unsigned char option,
-                       const void *value, const unsigned char len)
+int dccp_insert_option(struct sk_buff *skb, const unsigned char option,
+                      const void *value, const unsigned char len)
 {
        unsigned char *to;
 
@@ -380,8 +353,7 @@ static inline int dccp_elapsed_time_len(const u32 elapsed_time)
        return elapsed_time == 0 ? 0 : elapsed_time <= 0xFFFF ? 2 : 4;
 }
 
-int dccp_insert_option_elapsed_time(struct sock *sk, struct sk_buff *skb,
-                                   u32 elapsed_time)
+int dccp_insert_option_elapsed_time(struct sk_buff *skb, u32 elapsed_time)
 {
        const int elapsed_time_len = dccp_elapsed_time_len(elapsed_time);
        const int len = 2 + elapsed_time_len;
@@ -412,13 +384,13 @@ int dccp_insert_option_elapsed_time(struct sock *sk, struct sk_buff *skb,
 
 EXPORT_SYMBOL_GPL(dccp_insert_option_elapsed_time);
 
-int dccp_insert_option_timestamp(struct sock *sk, struct sk_buff *skb)
+int dccp_insert_option_timestamp(struct sk_buff *skb)
 {
        __be32 now = htonl(dccp_timestamp());
        /* yes this will overflow but that is the point as we want a
         * 10 usec 32 bit timer which mean it wraps every 11.9 hours */
 
-       return dccp_insert_option(sk, skb, DCCPO_TIMESTAMP, &now, sizeof(now));
+       return dccp_insert_option(skb, DCCPO_TIMESTAMP, &now, sizeof(now));
 }
 
 EXPORT_SYMBOL_GPL(dccp_insert_option_timestamp);
@@ -524,10 +496,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 +514,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) {
@@ -565,10 +531,10 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
                         * Obtain RTT sample from Request/Response exchange.
                         * This is currently used in CCID 3 initialisation.
                         */
-                       if (dccp_insert_option_timestamp(sk, skb))
+                       if (dccp_insert_option_timestamp(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;