aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/feat.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2006-11-20 15:39:23 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:24:38 -0500
commit59348b19efebfd6a8d0791ff81d207b16594c94b (patch)
treea9212a7bf62bd594cf02d23b9e33eb45a46d414d /net/dccp/feat.c
parentb1308dc015eb09cf094ca169296738a13ae049ad (diff)
[DCCP]: Simplified conditions due to use of enum:8 states
This reaps the benefit of the earlier patch, which changed the type of CCID 3 states to use enums, in that many conditions are now simplified and the number of possible (unexpected) values is greatly reduced. In a few instances, this also allowed to simplify pre-conditions; where care has been taken to retain logical equivalence. [DCCP]: Introduce a consistent BUG/WARN message scheme This refines the existing set of DCCP messages so that * BUG(), BUG_ON(), WARN_ON() have meaningful DCCP-specific counterparts * DCCP_CRIT (for severe warnings) is not rate-limited * DCCP_WARN() is introduced as rate-limited wrapper Using these allows a faster and cleaner transition to their original counterparts once the code has matured into a full DCCP implementation. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/feat.c')
-rw-r--r--net/dccp/feat.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index e808c418c992..4dc487f27a1f 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -25,11 +25,11 @@ int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature,
25 dccp_feat_debug(type, feature, *val); 25 dccp_feat_debug(type, feature, *val);
26 26
27 if (!dccp_feat_is_valid_type(type)) { 27 if (!dccp_feat_is_valid_type(type)) {
28 pr_info("option type %d invalid in negotiation\n", type); 28 DCCP_WARN("option type %d invalid in negotiation\n", type);
29 return 1; 29 return 1;
30 } 30 }
31 if (!dccp_feat_is_valid_length(type, feature, len)) { 31 if (!dccp_feat_is_valid_length(type, feature, len)) {
32 pr_info("invalid length %d\n", len); 32 DCCP_WARN("invalid length %d\n", len);
33 return 1; 33 return 1;
34 } 34 }
35 /* XXX add further sanity checks */ 35 /* XXX add further sanity checks */
@@ -169,7 +169,8 @@ static int dccp_feat_reconcile(struct sock *sk, struct dccp_opt_pend *opt,
169 break; 169 break;
170 170
171 default: 171 default:
172 WARN_ON(1); /* XXX implement res */ 172 DCCP_BUG("Fell through, feat=%d", opt->dccpop_feat);
173 /* XXX implement res */
173 return -EFAULT; 174 return -EFAULT;
174 } 175 }
175 176
@@ -328,7 +329,7 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
328 switch (type) { 329 switch (type) {
329 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break; 330 case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break;
330 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break; 331 case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break;
331 default: pr_info("invalid type %d\n", type); return; 332 default: DCCP_WARN("invalid type %d\n", type); return;
332 333
333 } 334 }
334 opt->dccpop_feat = feature; 335 opt->dccpop_feat = feature;
@@ -426,7 +427,7 @@ int dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature,
426 switch (type) { 427 switch (type) {
427 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break; 428 case DCCPO_CONFIRM_L: t = DCCPO_CHANGE_R; break;
428 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break; 429 case DCCPO_CONFIRM_R: t = DCCPO_CHANGE_L; break;
429 default: pr_info("invalid type %d\n", type); 430 default: DCCP_WARN("invalid type %d\n", type);
430 return 1; 431 return 1;
431 432
432 } 433 }