diff options
Diffstat (limited to 'net/dccp/options.c')
-rw-r--r-- | net/dccp/options.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c index fb0db1f7cd7b..f398b43bc055 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
@@ -22,23 +22,23 @@ | |||
22 | #include "dccp.h" | 22 | #include "dccp.h" |
23 | #include "feat.h" | 23 | #include "feat.h" |
24 | 24 | ||
25 | int dccp_feat_default_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW; | 25 | int sysctl_dccp_feat_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW; |
26 | int dccp_feat_default_rx_ccid = DCCPF_INITIAL_CCID; | 26 | int sysctl_dccp_feat_rx_ccid = DCCPF_INITIAL_CCID; |
27 | int dccp_feat_default_tx_ccid = DCCPF_INITIAL_CCID; | 27 | int sysctl_dccp_feat_tx_ccid = DCCPF_INITIAL_CCID; |
28 | int dccp_feat_default_ack_ratio = DCCPF_INITIAL_ACK_RATIO; | 28 | int sysctl_dccp_feat_ack_ratio = DCCPF_INITIAL_ACK_RATIO; |
29 | int dccp_feat_default_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR; | 29 | int sysctl_dccp_feat_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR; |
30 | int dccp_feat_default_send_ndp_count = DCCPF_INITIAL_SEND_NDP_COUNT; | 30 | int sysctl_dccp_feat_send_ndp_count = DCCPF_INITIAL_SEND_NDP_COUNT; |
31 | 31 | ||
32 | EXPORT_SYMBOL_GPL(dccp_feat_default_sequence_window); | 32 | EXPORT_SYMBOL_GPL(sysctl_dccp_feat_sequence_window); |
33 | 33 | ||
34 | void dccp_minisock_init(struct dccp_minisock *dmsk) | 34 | void dccp_minisock_init(struct dccp_minisock *dmsk) |
35 | { | 35 | { |
36 | dmsk->dccpms_sequence_window = dccp_feat_default_sequence_window; | 36 | dmsk->dccpms_sequence_window = sysctl_dccp_feat_sequence_window; |
37 | dmsk->dccpms_rx_ccid = dccp_feat_default_rx_ccid; | 37 | dmsk->dccpms_rx_ccid = sysctl_dccp_feat_rx_ccid; |
38 | dmsk->dccpms_tx_ccid = dccp_feat_default_tx_ccid; | 38 | dmsk->dccpms_tx_ccid = sysctl_dccp_feat_tx_ccid; |
39 | dmsk->dccpms_ack_ratio = dccp_feat_default_ack_ratio; | 39 | dmsk->dccpms_ack_ratio = sysctl_dccp_feat_ack_ratio; |
40 | dmsk->dccpms_send_ack_vector = dccp_feat_default_send_ack_vector; | 40 | dmsk->dccpms_send_ack_vector = sysctl_dccp_feat_send_ack_vector; |
41 | dmsk->dccpms_send_ndp_count = dccp_feat_default_send_ndp_count; | 41 | dmsk->dccpms_send_ndp_count = sysctl_dccp_feat_send_ndp_count; |
42 | } | 42 | } |
43 | 43 | ||
44 | static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len) | 44 | static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len) |
@@ -60,12 +60,9 @@ static u32 dccp_decode_value_var(const unsigned char *bf, const u8 len) | |||
60 | int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | 60 | int dccp_parse_options(struct sock *sk, struct sk_buff *skb) |
61 | { | 61 | { |
62 | struct dccp_sock *dp = dccp_sk(sk); | 62 | struct dccp_sock *dp = dccp_sk(sk); |
63 | #ifdef CONFIG_IP_DCCP_DEBUG | ||
64 | const char *debug_prefix = dp->dccps_role == DCCP_ROLE_CLIENT ? | ||
65 | "CLIENT rx opt: " : "server rx opt: "; | ||
66 | #endif | ||
67 | const struct dccp_hdr *dh = dccp_hdr(skb); | 63 | const struct dccp_hdr *dh = dccp_hdr(skb); |
68 | const u8 pkt_type = DCCP_SKB_CB(skb)->dccpd_type; | 64 | const u8 pkt_type = DCCP_SKB_CB(skb)->dccpd_type; |
65 | u64 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq; | ||
69 | unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb); | 66 | unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb); |
70 | unsigned char *opt_ptr = options; | 67 | unsigned char *opt_ptr = options; |
71 | const unsigned char *opt_end = (unsigned char *)dh + | 68 | const unsigned char *opt_end = (unsigned char *)dh + |
@@ -119,7 +116,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
119 | goto out_invalid_option; | 116 | goto out_invalid_option; |
120 | 117 | ||
121 | opt_recv->dccpor_ndp = dccp_decode_value_var(value, len); | 118 | opt_recv->dccpor_ndp = dccp_decode_value_var(value, len); |
122 | dccp_pr_debug("%sNDP count=%d\n", debug_prefix, | 119 | dccp_pr_debug("%s rx opt: NDP count=%d\n", dccp_role(sk), |
123 | opt_recv->dccpor_ndp); | 120 | opt_recv->dccpor_ndp); |
124 | break; | 121 | break; |
125 | case DCCPO_CHANGE_L: | 122 | case DCCPO_CHANGE_L: |
@@ -153,7 +150,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
153 | break; | 150 | break; |
154 | 151 | ||
155 | if (dccp_msk(sk)->dccpms_send_ack_vector && | 152 | if (dccp_msk(sk)->dccpms_send_ack_vector && |
156 | dccp_ackvec_parse(sk, skb, opt, value, len)) | 153 | dccp_ackvec_parse(sk, skb, &ackno, opt, value, len)) |
157 | goto out_invalid_option; | 154 | goto out_invalid_option; |
158 | break; | 155 | break; |
159 | case DCCPO_TIMESTAMP: | 156 | case DCCPO_TIMESTAMP: |
@@ -165,8 +162,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
165 | dp->dccps_timestamp_echo = opt_recv->dccpor_timestamp; | 162 | dp->dccps_timestamp_echo = opt_recv->dccpor_timestamp; |
166 | dccp_timestamp(sk, &dp->dccps_timestamp_time); | 163 | dccp_timestamp(sk, &dp->dccps_timestamp_time); |
167 | 164 | ||
168 | dccp_pr_debug("%sTIMESTAMP=%u, ackno=%llu\n", | 165 | dccp_pr_debug("%s rx opt: TIMESTAMP=%u, ackno=%llu\n", |
169 | debug_prefix, opt_recv->dccpor_timestamp, | 166 | dccp_role(sk), opt_recv->dccpor_timestamp, |
170 | (unsigned long long) | 167 | (unsigned long long) |
171 | DCCP_SKB_CB(skb)->dccpd_ack_seq); | 168 | DCCP_SKB_CB(skb)->dccpd_ack_seq); |
172 | break; | 169 | break; |
@@ -176,8 +173,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
176 | 173 | ||
177 | opt_recv->dccpor_timestamp_echo = ntohl(*(__be32 *)value); | 174 | opt_recv->dccpor_timestamp_echo = ntohl(*(__be32 *)value); |
178 | 175 | ||
179 | dccp_pr_debug("%sTIMESTAMP_ECHO=%u, len=%d, ackno=%llu, ", | 176 | dccp_pr_debug("%s rx opt: TIMESTAMP_ECHO=%u, len=%d, " |
180 | debug_prefix, | 177 | "ackno=%llu, ", dccp_role(sk), |
181 | opt_recv->dccpor_timestamp_echo, | 178 | opt_recv->dccpor_timestamp_echo, |
182 | len + 2, | 179 | len + 2, |
183 | (unsigned long long) | 180 | (unsigned long long) |
@@ -211,8 +208,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
211 | if (elapsed_time > opt_recv->dccpor_elapsed_time) | 208 | if (elapsed_time > opt_recv->dccpor_elapsed_time) |
212 | opt_recv->dccpor_elapsed_time = elapsed_time; | 209 | opt_recv->dccpor_elapsed_time = elapsed_time; |
213 | 210 | ||
214 | dccp_pr_debug("%sELAPSED_TIME=%d\n", debug_prefix, | 211 | dccp_pr_debug("%s rx opt: ELAPSED_TIME=%d\n", |
215 | elapsed_time); | 212 | dccp_role(sk), elapsed_time); |
216 | break; | 213 | break; |
217 | /* | 214 | /* |
218 | * From RFC 4340, sec. 10.3: | 215 | * From RFC 4340, sec. 10.3: |
@@ -242,9 +239,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
242 | } | 239 | } |
243 | break; | 240 | break; |
244 | default: | 241 | default: |
245 | pr_info("DCCP(%p): option %d(len=%d) not " | 242 | DCCP_CRIT("DCCP(%p): option %d(len=%d) not " |
246 | "implemented, ignoring\n", | 243 | "implemented, ignoring", sk, opt, len); |
247 | sk, opt, len); | ||
248 | break; | 244 | break; |
249 | } | 245 | } |
250 | 246 | ||
@@ -261,7 +257,7 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb) | |||
261 | out_invalid_option: | 257 | out_invalid_option: |
262 | DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT); | 258 | DCCP_INC_STATS_BH(DCCP_MIB_INVALIDOPT); |
263 | DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR; | 259 | DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_OPTION_ERROR; |
264 | pr_info("DCCP(%p): invalid option %d, len=%d\n", sk, opt, len); | 260 | DCCP_WARN("DCCP(%p): invalid option %d, len=%d", sk, opt, len); |
265 | return -1; | 261 | return -1; |
266 | } | 262 | } |
267 | 263 | ||
@@ -451,8 +447,7 @@ static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat, | |||
451 | u8 *to; | 447 | u8 *to; |
452 | 448 | ||
453 | if (DCCP_SKB_CB(skb)->dccpd_opt_len + len + 3 > DCCP_MAX_OPT_LEN) { | 449 | if (DCCP_SKB_CB(skb)->dccpd_opt_len + len + 3 > DCCP_MAX_OPT_LEN) { |
454 | LIMIT_NETDEBUG(KERN_INFO "DCCP: packet too small" | 450 | DCCP_WARN("packet too small for feature %d option!\n", feat); |
455 | " to insert feature %d option!\n", feat); | ||
456 | return -1; | 451 | return -1; |
457 | } | 452 | } |
458 | 453 | ||
@@ -465,8 +460,10 @@ static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat, | |||
465 | 460 | ||
466 | if (len) | 461 | if (len) |
467 | memcpy(to, val, len); | 462 | memcpy(to, val, len); |
468 | dccp_pr_debug("option %d feat %d len %d\n", type, feat, len); | ||
469 | 463 | ||
464 | dccp_pr_debug("%s(%s (%d), ...), length %d\n", | ||
465 | dccp_feat_typename(type), | ||
466 | dccp_feat_name(feat), feat, len); | ||
470 | return 0; | 467 | return 0; |
471 | } | 468 | } |
472 | 469 | ||