From d60cf7eb0890c2dd1c25bf9240eba22acfc68011 Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Thu, 13 Dec 2007 12:40:40 -0200 Subject: [PATCH] --- yaml --- r: 78447 b: refs/heads/master c: dd6303df095d18b0c524a76a42f57bcc679b2039 h: refs/heads/master i: 78445: 15ddcc1ebef3fe29d63605b61e196b6e953aa24a 78443: 40f6a1ed7bafbe3ee2c22beb9edc925ba94f3f66 78439: 8464d69070dbc9df1156348beef2a7f411d55bc2 78431: 01629d201c4044a4f9926b3b82330bdeadb9ee40 v: v3 --- [refs] | 2 +- trunk/net/dccp/feat.c | 12 ++++-------- trunk/net/dccp/feat.h | 26 -------------------------- 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/[refs] b/[refs] index b1b8a1ed84db..36b22144b068 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: af3b867e2f6b72422bc7aacb1f1e26f47a9649bc +refs/heads/master: dd6303df095d18b0c524a76a42f57bcc679b2039 diff --git a/trunk/net/dccp/feat.c b/trunk/net/dccp/feat.c index 5ebdd86c1b99..084744e624d3 100644 --- a/trunk/net/dccp/feat.c +++ b/trunk/net/dccp/feat.c @@ -24,11 +24,7 @@ int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, dccp_feat_debug(type, feature, *val); - if (!dccp_feat_is_valid_type(type)) { - DCCP_WARN("option type %d invalid in negotiation\n", type); - return 1; - } - if (!dccp_feat_is_valid_length(type, feature, len)) { + if (len > 3) { DCCP_WARN("invalid length %d\n", len); return 1; } @@ -637,12 +633,12 @@ const char *dccp_feat_name(const u8 feat) [DCCPF_MIN_CSUM_COVER] = "Min. Csum Coverage", [DCCPF_DATA_CHECKSUM] = "Send Data Checksum", }; + if (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC) + return feature_names[DCCPF_RESERVED]; + if (feat >= DCCPF_MIN_CCID_SPECIFIC) return "CCID-specific"; - if (dccp_feat_is_reserved(feat)) - return feature_names[DCCPF_RESERVED]; - return feature_names[feat]; } diff --git a/trunk/net/dccp/feat.h b/trunk/net/dccp/feat.h index 177f7dee4d10..e272222c7ace 100644 --- a/trunk/net/dccp/feat.h +++ b/trunk/net/dccp/feat.h @@ -14,32 +14,6 @@ #include #include "dccp.h" -static inline int dccp_feat_is_valid_length(u8 type, u8 feature, u8 len) -{ - /* sec. 6.1: Confirm has at least length 3, - * sec. 6.2: Change has at least length 4 */ - if (len < 3) - return 1; - if (len < 4 && (type == DCCPO_CHANGE_L || type == DCCPO_CHANGE_R)) - return 1; - /* XXX: add per-feature length validation (sec. 6.6.8) */ - return 0; -} - -static inline int dccp_feat_is_reserved(const u8 feat) -{ - return (feat > DCCPF_DATA_CHECKSUM && - feat < DCCPF_MIN_CCID_SPECIFIC) || - feat == DCCPF_RESERVED; -} - -/* feature negotiation knows only these four option types (RFC 4340, sec. 6) */ -static inline int dccp_feat_is_valid_type(const u8 optnum) -{ - return optnum >= DCCPO_CHANGE_L && optnum <= DCCPO_CONFIRM_R; - -} - #ifdef CONFIG_IP_DCCP_DEBUG extern const char *dccp_feat_typename(const u8 type); extern const char *dccp_feat_name(const u8 feat);