Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 1 | /* |
| 2 | * net/dccp/feat.c |
| 3 | * |
| 4 | * An implementation of the DCCP protocol |
| 5 | * Andrea Bittau <a.bittau@cs.ucl.ac.uk> |
| 6 | * |
Gerrit Renker | 5cdae19 | 2007-12-13 12:41:46 -0200 | [diff] [blame] | 7 | * ASSUMPTIONS |
| 8 | * ----------- |
| 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. |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 17 | */ |
| 18 | |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 19 | #include <linux/module.h> |
| 20 | |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 21 | #include "ccid.h" |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 22 | #include "feat.h" |
| 23 | |
| 24 | #define DCCP_FEAT_SP_NOAGREE (-123) |
| 25 | |
Gerrit Renker | 7d43d1a | 2008-11-04 23:43:47 -0800 | [diff] [blame^] | 26 | static const struct { |
| 27 | u8 feat_num; /* DCCPF_xxx */ |
| 28 | enum dccp_feat_type rxtx; /* RX or TX */ |
| 29 | enum dccp_feat_type reconciliation; /* SP or NN */ |
| 30 | u8 default_value; /* as in 6.4 */ |
| 31 | /* |
| 32 | * Lookup table for location and type of features (from RFC 4340/4342) |
| 33 | * +--------------------------+----+-----+----+----+---------+-----------+ |
| 34 | * | Feature | Location | Reconc. | Initial | Section | |
| 35 | * | | RX | TX | SP | NN | Value | Reference | |
| 36 | * +--------------------------+----+-----+----+----+---------+-----------+ |
| 37 | * | DCCPF_CCID | | X | X | | 2 | 10 | |
| 38 | * | DCCPF_SHORT_SEQNOS | | X | X | | 0 | 7.6.1 | |
| 39 | * | DCCPF_SEQUENCE_WINDOW | | X | | X | 100 | 7.5.2 | |
| 40 | * | DCCPF_ECN_INCAPABLE | X | | X | | 0 | 12.1 | |
| 41 | * | DCCPF_ACK_RATIO | | X | | X | 2 | 11.3 | |
| 42 | * | DCCPF_SEND_ACK_VECTOR | X | | X | | 0 | 11.5 | |
| 43 | * | DCCPF_SEND_NDP_COUNT | | X | X | | 0 | 7.7.2 | |
| 44 | * | DCCPF_MIN_CSUM_COVER | X | | X | | 0 | 9.2.1 | |
| 45 | * | DCCPF_DATA_CHECKSUM | X | | X | | 0 | 9.3.1 | |
| 46 | * | DCCPF_SEND_LEV_RATE | X | | X | | 0 | 4342/8.4 | |
| 47 | * +--------------------------+----+-----+----+----+---------+-----------+ |
| 48 | */ |
| 49 | } dccp_feat_table[] = { |
| 50 | { DCCPF_CCID, FEAT_AT_TX, FEAT_SP, 2 }, |
| 51 | { DCCPF_SHORT_SEQNOS, FEAT_AT_TX, FEAT_SP, 0 }, |
| 52 | { DCCPF_SEQUENCE_WINDOW, FEAT_AT_TX, FEAT_NN, 100 }, |
| 53 | { DCCPF_ECN_INCAPABLE, FEAT_AT_RX, FEAT_SP, 0 }, |
| 54 | { DCCPF_ACK_RATIO, FEAT_AT_TX, FEAT_NN, 2 }, |
| 55 | { DCCPF_SEND_ACK_VECTOR, FEAT_AT_RX, FEAT_SP, 0 }, |
| 56 | { DCCPF_SEND_NDP_COUNT, FEAT_AT_TX, FEAT_SP, 0 }, |
| 57 | { DCCPF_MIN_CSUM_COVER, FEAT_AT_RX, FEAT_SP, 0 }, |
| 58 | { DCCPF_DATA_CHECKSUM, FEAT_AT_RX, FEAT_SP, 0 }, |
| 59 | { DCCPF_SEND_LEV_RATE, FEAT_AT_RX, FEAT_SP, 0 }, |
| 60 | }; |
| 61 | #define DCCP_FEAT_SUPPORTED_MAX ARRAY_SIZE(dccp_feat_table) |
| 62 | |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 63 | int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, |
| 64 | u8 *val, u8 len, gfp_t gfp) |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 65 | { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 66 | struct dccp_opt_pend *opt; |
| 67 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 68 | dccp_feat_debug(type, feature, *val); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 69 | |
Gerrit Renker | dd6303d | 2007-12-13 12:40:40 -0200 | [diff] [blame] | 70 | if (len > 3) { |
Gerrit Renker | 59348b1 | 2006-11-20 18:39:23 -0200 | [diff] [blame] | 71 | DCCP_WARN("invalid length %d\n", len); |
Chris Wright | 1944317 | 2008-05-05 13:50:24 -0700 | [diff] [blame] | 72 | return -EINVAL; |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 73 | } |
| 74 | /* XXX add further sanity checks */ |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 75 | |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 76 | /* check if that feature is already being negotiated */ |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 77 | list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 78 | /* ok we found a negotiation for this option already */ |
| 79 | if (opt->dccpop_feat == feature && opt->dccpop_type == type) { |
| 80 | dccp_pr_debug("Replacing old\n"); |
| 81 | /* replace */ |
| 82 | BUG_ON(opt->dccpop_val == NULL); |
| 83 | kfree(opt->dccpop_val); |
| 84 | opt->dccpop_val = val; |
| 85 | opt->dccpop_len = len; |
| 86 | opt->dccpop_conf = 0; |
| 87 | return 0; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | /* negotiation for a new feature */ |
| 92 | opt = kmalloc(sizeof(*opt), gfp); |
| 93 | if (opt == NULL) |
| 94 | return -ENOMEM; |
| 95 | |
| 96 | opt->dccpop_type = type; |
| 97 | opt->dccpop_feat = feature; |
| 98 | opt->dccpop_len = len; |
| 99 | opt->dccpop_val = val; |
| 100 | opt->dccpop_conf = 0; |
| 101 | opt->dccpop_sc = NULL; |
| 102 | |
| 103 | BUG_ON(opt->dccpop_val == NULL); |
| 104 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 105 | list_add_tail(&opt->dccpop_node, &dmsk->dccpms_pending); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | EXPORT_SYMBOL_GPL(dccp_feat_change); |
| 110 | |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 111 | static int dccp_feat_update_ccid(struct sock *sk, u8 type, u8 new_ccid_nr) |
| 112 | { |
| 113 | struct dccp_sock *dp = dccp_sk(sk); |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 114 | struct dccp_minisock *dmsk = dccp_msk(sk); |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 115 | /* figure out if we are changing our CCID or the peer's */ |
| 116 | const int rx = type == DCCPO_CHANGE_R; |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 117 | const u8 ccid_nr = rx ? dmsk->dccpms_rx_ccid : dmsk->dccpms_tx_ccid; |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 118 | struct ccid *new_ccid; |
| 119 | |
| 120 | /* Check if nothing is being changed. */ |
| 121 | if (ccid_nr == new_ccid_nr) |
| 122 | return 0; |
| 123 | |
| 124 | new_ccid = ccid_new(new_ccid_nr, sk, rx, GFP_ATOMIC); |
| 125 | if (new_ccid == NULL) |
| 126 | return -ENOMEM; |
| 127 | |
| 128 | if (rx) { |
| 129 | ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); |
| 130 | dp->dccps_hc_rx_ccid = new_ccid; |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 131 | dmsk->dccpms_rx_ccid = new_ccid_nr; |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 132 | } else { |
| 133 | ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); |
| 134 | dp->dccps_hc_tx_ccid = new_ccid; |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 135 | dmsk->dccpms_tx_ccid = new_ccid_nr; |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | return 0; |
| 139 | } |
| 140 | |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 141 | static int dccp_feat_update(struct sock *sk, u8 type, u8 feat, u8 val) |
| 142 | { |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 143 | dccp_feat_debug(type, feat, val); |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 144 | |
| 145 | switch (feat) { |
| 146 | case DCCPF_CCID: |
| 147 | return dccp_feat_update_ccid(sk, type, val); |
| 148 | default: |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 149 | dccp_pr_debug("UNIMPLEMENTED: %s(%d, ...)\n", |
| 150 | dccp_feat_typename(type), feat); |
Andrea Bittau | 6ffd30f | 2006-03-20 19:22:37 -0800 | [diff] [blame] | 151 | break; |
| 152 | } |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | static int dccp_feat_reconcile(struct sock *sk, struct dccp_opt_pend *opt, |
| 157 | u8 *rpref, u8 rlen) |
| 158 | { |
| 159 | struct dccp_sock *dp = dccp_sk(sk); |
| 160 | u8 *spref, slen, *res = NULL; |
| 161 | int i, j, rc, agree = 1; |
| 162 | |
| 163 | BUG_ON(rpref == NULL); |
| 164 | |
| 165 | /* check if we are the black sheep */ |
| 166 | if (dp->dccps_role == DCCP_ROLE_CLIENT) { |
| 167 | spref = rpref; |
| 168 | slen = rlen; |
| 169 | rpref = opt->dccpop_val; |
| 170 | rlen = opt->dccpop_len; |
| 171 | } else { |
| 172 | spref = opt->dccpop_val; |
| 173 | slen = opt->dccpop_len; |
| 174 | } |
| 175 | /* |
| 176 | * Now we have server preference list in spref and client preference in |
| 177 | * rpref |
| 178 | */ |
| 179 | BUG_ON(spref == NULL); |
| 180 | BUG_ON(rpref == NULL); |
| 181 | |
| 182 | /* FIXME sanity check vals */ |
| 183 | |
| 184 | /* Are values in any order? XXX Lame "algorithm" here */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 185 | for (i = 0; i < slen; i++) { |
| 186 | for (j = 0; j < rlen; j++) { |
| 187 | if (spref[i] == rpref[j]) { |
| 188 | res = &spref[i]; |
| 189 | break; |
| 190 | } |
| 191 | } |
| 192 | if (res) |
| 193 | break; |
| 194 | } |
| 195 | |
| 196 | /* we didn't agree on anything */ |
| 197 | if (res == NULL) { |
| 198 | /* confirm previous value */ |
| 199 | switch (opt->dccpop_feat) { |
| 200 | case DCCPF_CCID: |
| 201 | /* XXX did i get this right? =P */ |
| 202 | if (opt->dccpop_type == DCCPO_CHANGE_L) |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 203 | res = &dccp_msk(sk)->dccpms_tx_ccid; |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 204 | else |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 205 | res = &dccp_msk(sk)->dccpms_rx_ccid; |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 206 | break; |
| 207 | |
| 208 | default: |
Gerrit Renker | 59348b1 | 2006-11-20 18:39:23 -0200 | [diff] [blame] | 209 | DCCP_BUG("Fell through, feat=%d", opt->dccpop_feat); |
| 210 | /* XXX implement res */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 211 | return -EFAULT; |
| 212 | } |
| 213 | |
| 214 | dccp_pr_debug("Don't agree... reconfirming %d\n", *res); |
| 215 | agree = 0; /* this is used for mandatory options... */ |
| 216 | } |
| 217 | |
| 218 | /* need to put result and our preference list */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 219 | rlen = 1 + opt->dccpop_len; |
| 220 | rpref = kmalloc(rlen, GFP_ATOMIC); |
| 221 | if (rpref == NULL) |
| 222 | return -ENOMEM; |
| 223 | |
| 224 | *rpref = *res; |
| 225 | memcpy(&rpref[1], opt->dccpop_val, opt->dccpop_len); |
| 226 | |
| 227 | /* put it in the "confirm queue" */ |
| 228 | if (opt->dccpop_sc == NULL) { |
| 229 | opt->dccpop_sc = kmalloc(sizeof(*opt->dccpop_sc), GFP_ATOMIC); |
| 230 | if (opt->dccpop_sc == NULL) { |
| 231 | kfree(rpref); |
| 232 | return -ENOMEM; |
| 233 | } |
| 234 | } else { |
| 235 | /* recycle the confirm slot */ |
| 236 | BUG_ON(opt->dccpop_sc->dccpoc_val == NULL); |
| 237 | kfree(opt->dccpop_sc->dccpoc_val); |
| 238 | dccp_pr_debug("recycling confirm slot\n"); |
| 239 | } |
| 240 | memset(opt->dccpop_sc, 0, sizeof(*opt->dccpop_sc)); |
| 241 | |
| 242 | opt->dccpop_sc->dccpoc_val = rpref; |
| 243 | opt->dccpop_sc->dccpoc_len = rlen; |
| 244 | |
| 245 | /* update the option on our side [we are about to send the confirm] */ |
| 246 | rc = dccp_feat_update(sk, opt->dccpop_type, opt->dccpop_feat, *res); |
| 247 | if (rc) { |
| 248 | kfree(opt->dccpop_sc->dccpoc_val); |
| 249 | kfree(opt->dccpop_sc); |
Randy Dunlap | 68907da | 2006-03-29 13:58:25 -0800 | [diff] [blame] | 250 | opt->dccpop_sc = NULL; |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 251 | return rc; |
| 252 | } |
| 253 | |
| 254 | dccp_pr_debug("Will confirm %d\n", *rpref); |
| 255 | |
| 256 | /* say we want to change to X but we just got a confirm X, suppress our |
| 257 | * change |
| 258 | */ |
| 259 | if (!opt->dccpop_conf) { |
| 260 | if (*opt->dccpop_val == *res) |
| 261 | opt->dccpop_conf = 1; |
| 262 | dccp_pr_debug("won't ask for change of same feature\n"); |
| 263 | } |
| 264 | |
| 265 | return agree ? 0 : DCCP_FEAT_SP_NOAGREE; /* used for mandatory opts */ |
| 266 | } |
| 267 | |
| 268 | static int dccp_feat_sp(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len) |
| 269 | { |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 270 | struct dccp_minisock *dmsk = dccp_msk(sk); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 271 | struct dccp_opt_pend *opt; |
| 272 | int rc = 1; |
| 273 | u8 t; |
| 274 | |
| 275 | /* |
| 276 | * We received a CHANGE. We gotta match it against our own preference |
| 277 | * list. If we got a CHANGE_R it means it's a change for us, so we need |
| 278 | * to compare our CHANGE_L list. |
| 279 | */ |
| 280 | if (type == DCCPO_CHANGE_L) |
| 281 | t = DCCPO_CHANGE_R; |
| 282 | else |
| 283 | t = DCCPO_CHANGE_L; |
| 284 | |
| 285 | /* find our preference list for this feature */ |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 286 | list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 287 | if (opt->dccpop_type != t || opt->dccpop_feat != feature) |
| 288 | continue; |
| 289 | |
| 290 | /* find the winner from the two preference lists */ |
| 291 | rc = dccp_feat_reconcile(sk, opt, val, len); |
| 292 | break; |
| 293 | } |
| 294 | |
| 295 | /* We didn't deal with the change. This can happen if we have no |
| 296 | * preference list for the feature. In fact, it just shouldn't |
| 297 | * happen---if we understand a feature, we should have a preference list |
| 298 | * with at least the default value. |
| 299 | */ |
| 300 | BUG_ON(rc == 1); |
| 301 | |
| 302 | return rc; |
| 303 | } |
| 304 | |
| 305 | static int dccp_feat_nn(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len) |
| 306 | { |
| 307 | struct dccp_opt_pend *opt; |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 308 | struct dccp_minisock *dmsk = dccp_msk(sk); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 309 | u8 *copy; |
| 310 | int rc; |
| 311 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 312 | /* NN features must be Change L (sec. 6.3.2) */ |
| 313 | if (type != DCCPO_CHANGE_L) { |
| 314 | dccp_pr_debug("received %s for NN feature %d\n", |
| 315 | dccp_feat_typename(type), feature); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 316 | return -EFAULT; |
| 317 | } |
| 318 | |
| 319 | /* XXX sanity check opt val */ |
| 320 | |
| 321 | /* copy option so we can confirm it */ |
| 322 | opt = kzalloc(sizeof(*opt), GFP_ATOMIC); |
| 323 | if (opt == NULL) |
| 324 | return -ENOMEM; |
| 325 | |
Arnaldo Carvalho de Melo | eed7341 | 2006-11-17 12:21:43 -0200 | [diff] [blame] | 326 | copy = kmemdup(val, len, GFP_ATOMIC); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 327 | if (copy == NULL) { |
| 328 | kfree(opt); |
| 329 | return -ENOMEM; |
| 330 | } |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 331 | |
| 332 | opt->dccpop_type = DCCPO_CONFIRM_R; /* NN can only confirm R */ |
| 333 | opt->dccpop_feat = feature; |
| 334 | opt->dccpop_val = copy; |
| 335 | opt->dccpop_len = len; |
| 336 | |
| 337 | /* change feature */ |
| 338 | rc = dccp_feat_update(sk, type, feature, *val); |
| 339 | if (rc) { |
| 340 | kfree(opt->dccpop_val); |
| 341 | kfree(opt); |
| 342 | return rc; |
| 343 | } |
| 344 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 345 | dccp_feat_debug(type, feature, *copy); |
| 346 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 347 | list_add_tail(&opt->dccpop_node, &dmsk->dccpms_conf); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 348 | |
| 349 | return 0; |
| 350 | } |
| 351 | |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 352 | static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk, |
| 353 | u8 type, u8 feature) |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 354 | { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 355 | /* XXX check if other confirms for that are queued and recycle slot */ |
| 356 | struct dccp_opt_pend *opt = kzalloc(sizeof(*opt), GFP_ATOMIC); |
| 357 | |
| 358 | if (opt == NULL) { |
| 359 | /* XXX what do we do? Ignoring should be fine. It's a change |
| 360 | * after all =P |
| 361 | */ |
| 362 | return; |
| 363 | } |
| 364 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 365 | switch (type) { |
Jesper Juhl | e576de8 | 2007-08-10 15:23:54 -0700 | [diff] [blame] | 366 | case DCCPO_CHANGE_L: |
| 367 | opt->dccpop_type = DCCPO_CONFIRM_R; |
| 368 | break; |
| 369 | case DCCPO_CHANGE_R: |
| 370 | opt->dccpop_type = DCCPO_CONFIRM_L; |
| 371 | break; |
| 372 | default: |
| 373 | DCCP_WARN("invalid type %d\n", type); |
| 374 | kfree(opt); |
| 375 | return; |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 376 | } |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 377 | opt->dccpop_feat = feature; |
Randy Dunlap | 68907da | 2006-03-29 13:58:25 -0800 | [diff] [blame] | 378 | opt->dccpop_val = NULL; |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 379 | opt->dccpop_len = 0; |
| 380 | |
| 381 | /* change feature */ |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 382 | dccp_pr_debug("Empty %s(%d)\n", dccp_feat_typename(type), feature); |
| 383 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 384 | list_add_tail(&opt->dccpop_node, &dmsk->dccpms_conf); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | static void dccp_feat_flush_confirm(struct sock *sk) |
| 388 | { |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 389 | struct dccp_minisock *dmsk = dccp_msk(sk); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 390 | /* Check if there is anything to confirm in the first place */ |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 391 | int yes = !list_empty(&dmsk->dccpms_conf); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 392 | |
| 393 | if (!yes) { |
| 394 | struct dccp_opt_pend *opt; |
| 395 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 396 | list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 397 | if (opt->dccpop_conf) { |
| 398 | yes = 1; |
| 399 | break; |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | if (!yes) |
| 405 | return; |
| 406 | |
| 407 | /* OK there is something to confirm... */ |
| 408 | /* XXX check if packet is in flight? Send delayed ack?? */ |
| 409 | if (sk->sk_state == DCCP_OPEN) |
| 410 | dccp_send_ack(sk); |
| 411 | } |
| 412 | |
| 413 | int dccp_feat_change_recv(struct sock *sk, u8 type, u8 feature, u8 *val, u8 len) |
| 414 | { |
| 415 | int rc; |
| 416 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 417 | dccp_feat_debug(type, feature, *val); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 418 | |
| 419 | /* figure out if it's SP or NN feature */ |
| 420 | switch (feature) { |
| 421 | /* deal with SP features */ |
| 422 | case DCCPF_CCID: |
| 423 | rc = dccp_feat_sp(sk, type, feature, val, len); |
| 424 | break; |
| 425 | |
| 426 | /* deal with NN features */ |
| 427 | case DCCPF_ACK_RATIO: |
| 428 | rc = dccp_feat_nn(sk, type, feature, val, len); |
| 429 | break; |
| 430 | |
| 431 | /* XXX implement other features */ |
| 432 | default: |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 433 | dccp_pr_debug("UNIMPLEMENTED: not handling %s(%d, ...)\n", |
| 434 | dccp_feat_typename(type), feature); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 435 | rc = -EFAULT; |
| 436 | break; |
| 437 | } |
| 438 | |
| 439 | /* check if there were problems changing features */ |
| 440 | if (rc) { |
| 441 | /* If we don't agree on SP, we sent a confirm for old value. |
| 442 | * However we propagate rc to caller in case option was |
| 443 | * mandatory |
| 444 | */ |
| 445 | if (rc != DCCP_FEAT_SP_NOAGREE) |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 446 | dccp_feat_empty_confirm(dccp_msk(sk), type, feature); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | /* generate the confirm [if required] */ |
| 450 | dccp_feat_flush_confirm(sk); |
| 451 | |
| 452 | return rc; |
| 453 | } |
| 454 | |
| 455 | EXPORT_SYMBOL_GPL(dccp_feat_change_recv); |
| 456 | |
| 457 | int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature, |
| 458 | u8 *val, u8 len) |
| 459 | { |
| 460 | u8 t; |
| 461 | struct dccp_opt_pend *opt; |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 462 | struct dccp_minisock *dmsk = dccp_msk(sk); |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 463 | int found = 0; |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 464 | int all_confirmed = 1; |
| 465 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 466 | dccp_feat_debug(type, feature, *val); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 467 | |
| 468 | /* locate our change request */ |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 469 | switch (type) { |
| 470 | case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break; |
| 471 | case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break; |
Arnaldo Carvalho de Melo | 8109b02 | 2006-12-10 16:01:18 -0200 | [diff] [blame] | 472 | default: DCCP_WARN("invalid type %d\n", type); |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 473 | return 1; |
| 474 | |
| 475 | } |
| 476 | /* XXX sanity check feature value */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 477 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 478 | list_for_each_entry(opt, &dmsk->dccpms_pending, dccpop_node) { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 479 | if (!opt->dccpop_conf && opt->dccpop_type == t && |
| 480 | opt->dccpop_feat == feature) { |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 481 | found = 1; |
| 482 | dccp_pr_debug("feature %d found\n", opt->dccpop_feat); |
| 483 | |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 484 | /* XXX do sanity check */ |
| 485 | |
| 486 | opt->dccpop_conf = 1; |
| 487 | |
| 488 | /* We got a confirmation---change the option */ |
| 489 | dccp_feat_update(sk, opt->dccpop_type, |
| 490 | opt->dccpop_feat, *val); |
| 491 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 492 | /* XXX check the return value of dccp_feat_update */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 493 | break; |
| 494 | } |
| 495 | |
| 496 | if (!opt->dccpop_conf) |
| 497 | all_confirmed = 0; |
| 498 | } |
| 499 | |
| 500 | /* fix re-transmit timer */ |
| 501 | /* XXX gotta make sure that no option negotiation occurs during |
| 502 | * connection shutdown. Consider that the CLOSEREQ is sent and timer is |
| 503 | * on. if all options are confirmed it might kill timer which should |
| 504 | * remain alive until close is received. |
| 505 | */ |
| 506 | if (all_confirmed) { |
| 507 | dccp_pr_debug("clear feat negotiation timer %p\n", sk); |
| 508 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS); |
| 509 | } |
| 510 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 511 | if (!found) |
| 512 | dccp_pr_debug("%s(%d, ...) never requested\n", |
| 513 | dccp_feat_typename(type), feature); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 514 | return 0; |
| 515 | } |
| 516 | |
| 517 | EXPORT_SYMBOL_GPL(dccp_feat_confirm_recv); |
| 518 | |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 519 | void dccp_feat_clean(struct dccp_minisock *dmsk) |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 520 | { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 521 | struct dccp_opt_pend *opt, *next; |
| 522 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 523 | list_for_each_entry_safe(opt, next, &dmsk->dccpms_pending, |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 524 | dccpop_node) { |
YOSHIFUJI Hideaki | c9eaf17 | 2007-02-09 23:24:38 +0900 | [diff] [blame] | 525 | BUG_ON(opt->dccpop_val == NULL); |
| 526 | kfree(opt->dccpop_val); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 527 | |
| 528 | if (opt->dccpop_sc != NULL) { |
| 529 | BUG_ON(opt->dccpop_sc->dccpoc_val == NULL); |
| 530 | kfree(opt->dccpop_sc->dccpoc_val); |
| 531 | kfree(opt->dccpop_sc); |
| 532 | } |
| 533 | |
YOSHIFUJI Hideaki | c9eaf17 | 2007-02-09 23:24:38 +0900 | [diff] [blame] | 534 | kfree(opt); |
| 535 | } |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 536 | INIT_LIST_HEAD(&dmsk->dccpms_pending); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 537 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 538 | list_for_each_entry_safe(opt, next, &dmsk->dccpms_conf, dccpop_node) { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 539 | BUG_ON(opt == NULL); |
| 540 | if (opt->dccpop_val != NULL) |
| 541 | kfree(opt->dccpop_val); |
| 542 | kfree(opt); |
| 543 | } |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 544 | INIT_LIST_HEAD(&dmsk->dccpms_conf); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 545 | } |
| 546 | |
| 547 | EXPORT_SYMBOL_GPL(dccp_feat_clean); |
| 548 | |
| 549 | /* this is to be called only when a listening sock creates its child. It is |
| 550 | * assumed by the function---the confirm is not duplicated, but rather it is |
| 551 | * "passed on". |
| 552 | */ |
| 553 | int dccp_feat_clone(struct sock *oldsk, struct sock *newsk) |
| 554 | { |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 555 | struct dccp_minisock *olddmsk = dccp_msk(oldsk); |
| 556 | struct dccp_minisock *newdmsk = dccp_msk(newsk); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 557 | struct dccp_opt_pend *opt; |
| 558 | int rc = 0; |
| 559 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 560 | INIT_LIST_HEAD(&newdmsk->dccpms_pending); |
| 561 | INIT_LIST_HEAD(&newdmsk->dccpms_conf); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 562 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 563 | list_for_each_entry(opt, &olddmsk->dccpms_pending, dccpop_node) { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 564 | struct dccp_opt_pend *newopt; |
| 565 | /* copy the value of the option */ |
Arnaldo Carvalho de Melo | eed7341 | 2006-11-17 12:21:43 -0200 | [diff] [blame] | 566 | u8 *val = kmemdup(opt->dccpop_val, opt->dccpop_len, GFP_ATOMIC); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 567 | |
| 568 | if (val == NULL) |
| 569 | goto out_clean; |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 570 | |
Arnaldo Carvalho de Melo | eed7341 | 2006-11-17 12:21:43 -0200 | [diff] [blame] | 571 | newopt = kmemdup(opt, sizeof(*newopt), GFP_ATOMIC); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 572 | if (newopt == NULL) { |
| 573 | kfree(val); |
| 574 | goto out_clean; |
| 575 | } |
| 576 | |
| 577 | /* insert the option */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 578 | newopt->dccpop_val = val; |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 579 | list_add_tail(&newopt->dccpop_node, &newdmsk->dccpms_pending); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 580 | |
| 581 | /* XXX what happens with backlogs and multiple connections at |
| 582 | * once... |
| 583 | */ |
| 584 | /* the master socket no longer needs to worry about confirms */ |
Randy Dunlap | 68907da | 2006-03-29 13:58:25 -0800 | [diff] [blame] | 585 | opt->dccpop_sc = NULL; /* it's not a memleak---new socket has it */ |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 586 | |
| 587 | /* reset state for a new socket */ |
| 588 | opt->dccpop_conf = 0; |
| 589 | } |
| 590 | |
| 591 | /* XXX not doing anything about the conf queue */ |
| 592 | |
| 593 | out: |
| 594 | return rc; |
| 595 | |
| 596 | out_clean: |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 597 | dccp_feat_clean(newdmsk); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 598 | rc = -ENOMEM; |
| 599 | goto out; |
| 600 | } |
| 601 | |
| 602 | EXPORT_SYMBOL_GPL(dccp_feat_clone); |
| 603 | |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 604 | static int __dccp_feat_init(struct dccp_minisock *dmsk, u8 type, u8 feat, |
| 605 | u8 *val, u8 len) |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 606 | { |
| 607 | int rc = -ENOMEM; |
Arnaldo Carvalho de Melo | eed7341 | 2006-11-17 12:21:43 -0200 | [diff] [blame] | 608 | u8 *copy = kmemdup(val, len, GFP_KERNEL); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 609 | |
| 610 | if (copy != NULL) { |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 611 | rc = dccp_feat_change(dmsk, type, feat, copy, len, GFP_KERNEL); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 612 | if (rc) |
| 613 | kfree(copy); |
| 614 | } |
| 615 | return rc; |
| 616 | } |
| 617 | |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 618 | int dccp_feat_init(struct dccp_minisock *dmsk) |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 619 | { |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 620 | int rc; |
| 621 | |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 622 | INIT_LIST_HEAD(&dmsk->dccpms_pending); |
| 623 | INIT_LIST_HEAD(&dmsk->dccpms_conf); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 624 | |
| 625 | /* CCID L */ |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 626 | rc = __dccp_feat_init(dmsk, DCCPO_CHANGE_L, DCCPF_CCID, |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 627 | &dmsk->dccpms_tx_ccid, 1); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 628 | if (rc) |
| 629 | goto out; |
| 630 | |
| 631 | /* CCID R */ |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 632 | rc = __dccp_feat_init(dmsk, DCCPO_CHANGE_R, DCCPF_CCID, |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 633 | &dmsk->dccpms_rx_ccid, 1); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 634 | if (rc) |
| 635 | goto out; |
| 636 | |
| 637 | /* Ack ratio */ |
Arnaldo Carvalho de Melo | 8ca0d17 | 2006-03-20 22:51:53 -0800 | [diff] [blame] | 638 | rc = __dccp_feat_init(dmsk, DCCPO_CHANGE_L, DCCPF_ACK_RATIO, |
Arnaldo Carvalho de Melo | a4bf390 | 2006-03-20 22:50:58 -0800 | [diff] [blame] | 639 | &dmsk->dccpms_ack_ratio, 1); |
Andrea Bittau | afe0025 | 2006-03-20 17:43:56 -0800 | [diff] [blame] | 640 | out: |
| 641 | return rc; |
| 642 | } |
| 643 | |
| 644 | EXPORT_SYMBOL_GPL(dccp_feat_init); |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 645 | |
| 646 | #ifdef CONFIG_IP_DCCP_DEBUG |
| 647 | const char *dccp_feat_typename(const u8 type) |
| 648 | { |
| 649 | switch(type) { |
| 650 | case DCCPO_CHANGE_L: return("ChangeL"); |
| 651 | case DCCPO_CONFIRM_L: return("ConfirmL"); |
| 652 | case DCCPO_CHANGE_R: return("ChangeR"); |
| 653 | case DCCPO_CONFIRM_R: return("ConfirmR"); |
| 654 | /* the following case must not appear in feature negotation */ |
Arnaldo Carvalho de Melo | 8109b02 | 2006-12-10 16:01:18 -0200 | [diff] [blame] | 655 | default: dccp_pr_debug("unknown type %d [BUG!]\n", type); |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 656 | } |
| 657 | return NULL; |
| 658 | } |
| 659 | |
| 660 | EXPORT_SYMBOL_GPL(dccp_feat_typename); |
| 661 | |
| 662 | const char *dccp_feat_name(const u8 feat) |
| 663 | { |
| 664 | static const char *feature_names[] = { |
| 665 | [DCCPF_RESERVED] = "Reserved", |
| 666 | [DCCPF_CCID] = "CCID", |
| 667 | [DCCPF_SHORT_SEQNOS] = "Allow Short Seqnos", |
| 668 | [DCCPF_SEQUENCE_WINDOW] = "Sequence Window", |
| 669 | [DCCPF_ECN_INCAPABLE] = "ECN Incapable", |
| 670 | [DCCPF_ACK_RATIO] = "Ack Ratio", |
| 671 | [DCCPF_SEND_ACK_VECTOR] = "Send ACK Vector", |
| 672 | [DCCPF_SEND_NDP_COUNT] = "Send NDP Count", |
| 673 | [DCCPF_MIN_CSUM_COVER] = "Min. Csum Coverage", |
| 674 | [DCCPF_DATA_CHECKSUM] = "Send Data Checksum", |
| 675 | }; |
Gerrit Renker | dd6303d | 2007-12-13 12:40:40 -0200 | [diff] [blame] | 676 | if (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC) |
| 677 | return feature_names[DCCPF_RESERVED]; |
| 678 | |
Gerrit Renker | 7d43d1a | 2008-11-04 23:43:47 -0800 | [diff] [blame^] | 679 | if (feat == DCCPF_SEND_LEV_RATE) |
| 680 | return "Send Loss Event Rate"; |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 681 | if (feat >= DCCPF_MIN_CCID_SPECIFIC) |
| 682 | return "CCID-specific"; |
| 683 | |
Gerrit Renker | c02fdc0 | 2006-11-14 12:48:10 -0200 | [diff] [blame] | 684 | return feature_names[feat]; |
| 685 | } |
| 686 | |
| 687 | EXPORT_SYMBOL_GPL(dccp_feat_name); |
| 688 | #endif /* CONFIG_IP_DCCP_DEBUG */ |