]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
dccp: Support for Mandatory options
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Mon, 24 Nov 2008 00:09:11 +0000 (16:09 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Nov 2008 00:09:11 +0000 (16:09 -0800)
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>
net/dccp/feat.h
net/dccp/options.c

index a8ab9e1e8b177186410020ca57e28dc7a33fcd3e..f8e4878dfc2826ad2c70deb3d69b789dd1aaec67 100644 (file)
@@ -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 */
index 9cb0ff8940521aae59921704a56077cc614c2f10..676d53065de9885cb0694b654b1264c36c315bdd 100644 (file)
@@ -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)
 {