aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-11-23 19:09:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-23 19:09:11 -0500
commitd371056695ef993d36c57b73d654e66080377a9c (patch)
tree85e587e5558cf00232d8b24b4e28a390d3856d2a
parent02fa460ef553faabc7e0b15ff9f607f028739808 (diff)
dccp: Support for Mandatory options
Support for Mandatory options is provided by this patch, which will be used by subsequent feature-negotiation patches. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dccp/feat.h2
-rw-r--r--net/dccp/options.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/net/dccp/feat.h b/net/dccp/feat.h
index a8ab9e1e8b17..f8e4878dfc28 100644
--- a/net/dccp/feat.h
+++ b/net/dccp/feat.h
@@ -139,4 +139,6 @@ extern int dccp_feat_init(struct sock *sk);
139 139
140extern void dccp_encode_value_var(const u64 value, u8 *to, const u8 len); 140extern void dccp_encode_value_var(const u64 value, u8 *to, const u8 len);
141extern u64 dccp_decode_value_var(const u8 *bf, const u8 len); 141extern u64 dccp_decode_value_var(const u8 *bf, const u8 len);
142
143extern int dccp_insert_option_mandatory(struct sk_buff *skb);
142#endif /* _DCCP_FEAT_H */ 144#endif /* _DCCP_FEAT_H */
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 9cb0ff894052..676d53065de9 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -467,6 +467,21 @@ static int dccp_insert_option_timestamp_echo(struct dccp_sock *dp,
467 return 0; 467 return 0;
468} 468}
469 469
470/**
471 * dccp_insert_option_mandatory - Mandatory option (5.8.2)
472 * Note that since we are using skb_push, this function needs to be called
473 * _after_ inserting the option it is supposed to influence (stack order).
474 */
475int dccp_insert_option_mandatory(struct sk_buff *skb)
476{
477 if (DCCP_SKB_CB(skb)->dccpd_opt_len >= DCCP_MAX_OPT_LEN)
478 return -1;
479
480 DCCP_SKB_CB(skb)->dccpd_opt_len++;
481 *skb_push(skb, 1) = DCCPO_MANDATORY;
482 return 0;
483}
484
470static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat, 485static int dccp_insert_feat_opt(struct sk_buff *skb, u8 type, u8 feat,
471 u8 *val, u8 len) 486 u8 *val, u8 len)
472{ 487{