* [PATCH 18/37] dccp: Support for Mandatory options
@ 2008-08-28 17:44 Gerrit Renker
2008-08-28 21:50 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: Gerrit Renker @ 2008-08-28 17:44 UTC (permalink / raw)
To: dccp
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>
---
net/dccp/feat.h | 2 ++
net/dccp/options.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
--- a/net/dccp/feat.h
+++ b/net/dccp/feat.h
@@ -136,4 +136,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 */
--- 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,
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)
{
--
1.6.0.rc2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 18/37] dccp: Support for Mandatory options
2008-08-28 17:44 [PATCH 18/37] dccp: Support for Mandatory options Gerrit Renker
@ 2008-08-28 21:50 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-08-28 21:50 UTC (permalink / raw)
To: dccp
Em Thu, Aug 28, 2008 at 07:44:53PM +0200, Gerrit Renker escreveu:
> 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>
> ---
> net/dccp/feat.h | 2 ++
> net/dccp/options.c | 15 +++++++++++++++
> 2 files changed, 17 insertions(+), 0 deletions(-)
>
> --- a/net/dccp/feat.h
> +++ b/net/dccp/feat.h
> @@ -136,4 +136,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 */
> --- 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,
> 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)
> {
> --
> 1.6.0.rc2
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-08-28 21:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28 17:44 [PATCH 18/37] dccp: Support for Mandatory options Gerrit Renker
2008-08-28 21:50 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).