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;
}
[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];
}
#include <linux/types.h>
#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);