From ba1b0ad441e1ef1d9e177758d982d4d60ccb69f9 Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Sun, 23 Nov 2008 16:09:11 -0800 Subject: [PATCH] --- yaml --- r: 122105 b: refs/heads/master c: d371056695ef993d36c57b73d654e66080377a9c h: refs/heads/master i: 122103: e52806d2fbe0bba1080ebce80e0fedcd2fc1d290 v: v3 --- [refs] | 2 +- trunk/net/dccp/feat.h | 2 ++ trunk/net/dccp/options.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index b23b685ba857..f500d5388ce5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 02fa460ef553faabc7e0b15ff9f607f028739808 +refs/heads/master: d371056695ef993d36c57b73d654e66080377a9c diff --git a/trunk/net/dccp/feat.h b/trunk/net/dccp/feat.h index a8ab9e1e8b17..f8e4878dfc28 100644 --- a/trunk/net/dccp/feat.h +++ b/trunk/net/dccp/feat.h @@ -139,4 +139,6 @@ extern int dccp_feat_init(struct sock *sk); extern void dccp_encode_value_var(const u64 value, u8 *to, const u8 len); extern u64 dccp_decode_value_var(const u8 *bf, const u8 len); + +extern int dccp_insert_option_mandatory(struct sk_buff *skb); #endif /* _DCCP_FEAT_H */ diff --git a/trunk/net/dccp/options.c b/trunk/net/dccp/options.c index 9cb0ff894052..676d53065de9 100644 --- a/trunk/net/dccp/options.c +++ b/trunk/net/dccp/options.c @@ -467,6 +467,21 @@ static int dccp_insert_option_timestamp_echo(struct dccp_sock *dp, return 0; } +/** + * dccp_insert_option_mandatory - Mandatory option (5.8.2) + * Note that since we are using skb_push, this function needs to be called + * _after_ inserting the option it is supposed to influence (stack order). + */ +int dccp_insert_option_mandatory(struct sk_buff *skb) +{ + if (DCCP_SKB_CB(skb)->dccpd_opt_len >= DCCP_MAX_OPT_LEN) + return -1; + + DCCP_SKB_CB(skb)->dccpd_opt_len++; + *skb_push(skb, 1) = DCCPO_MANDATORY; + return 0; +} + static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat, u8 *val, u8 len) {