From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 8/8]: Support inserting options during the 3-way
Date: Tue, 25 Sep 2007 18:52:27 +0000 [thread overview]
Message-ID: <20070925185227.GI18348@ghostprotocols.net> (raw)
In-Reply-To: <200709251530.51394@strip-the-willow>
Em Tue, Sep 25, 2007 at 03:30:51PM +0100, Gerrit Renker escreveu:
> [DCCP]: Support inserting options during the 3-way handshake
>
> This provides a separate routine to insert options during the initial handshake.
> The main purpose is to conduct feature negotiation, for the moment the only user
> is the timestamp echo needed for the (CCID3) handshake RTT sample.
>
> Padding of options has been put into a small separate routine, to be shared among
> the two functions. This could also be used as a generic routine to finish inserting
> options.
>
> Also removed an `XXX' comment since its content was obvious.
>
> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
> ---
> net/dccp/dccp.h | 1 +
> net/dccp/options.c | 40 ++++++++++++++++++++++++++++------------
> net/dccp/output.c | 2 +-
> 3 files changed, 30 insertions(+), 13 deletions(-)
>
> --- a/net/dccp/output.c
> +++ b/net/dccp/output.c
> @@ -303,7 +303,7 @@ struct sk_buff *dccp_make_response(struc
> DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_RESPONSE;
> DCCP_SKB_CB(skb)->dccpd_seq = dreq->dreq_iss;
>
> - if (dccp_insert_options(sk, skb)) {
> + if (dccp_insert_options_rsk(dreq, skb)) {
> kfree_skb(skb);
> return NULL;
> }
> --- a/net/dccp/dccp.h
> +++ b/net/dccp/dccp.h
> @@ -422,6 +422,7 @@ static inline int dccp_ack_pending(const
> }
>
> extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb);
> +extern int dccp_insert_options_rsk(struct dccp_request_sock*, struct sk_buff*);
> extern int dccp_insert_option_elapsed_time(struct sock *sk,
> struct sk_buff *skb,
> u32 elapsed_time);
> --- a/net/dccp/options.c
> +++ b/net/dccp/options.c
> @@ -160,7 +160,7 @@ int dccp_parse_options(struct sock *sk,
> if (len != 4)
> goto out_invalid_option;
>
> - tse = dreq? &dreq->dreq_tstamp : dp->dccps_tstamp;
> + tse = dreq? &dreq->dreq_tstamp : &dp->dccps_tstamp;
And here you fix it in an unrelated patch, tsc, tsc :-)
I'll try to fix up these issues since I think its already late in
Scotland :-)
> /*
> * Keep the earliest received timestamp on the socket,
> * until echoing to the peer frees it. This policy is
> @@ -525,6 +525,18 @@ static int dccp_insert_options_feat(stru
> return 0;
> }
>
> +/* The length of all options needs to be a multiple of 4 (5.8) */
> +static void dccp_insert_option_padding(struct sk_buff *skb)
> +{
> + int padding = DCCP_SKB_CB(skb)->dccpd_opt_len % 4;
> +
> + if (padding != 0) {
> + padding = 4 - padding;
> + memset(skb_push(skb, padding), 0, padding);
> + DCCP_SKB_CB(skb)->dccpd_opt_len += padding;
> + }
> +}
> +
> int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
> {
> struct dccp_sock *dp = dccp_sk(sk);
> @@ -568,18 +580,22 @@ int dccp_insert_options(struct sock *sk,
> dccp_insert_option_timestamp_echo(&dp->dccps_tstamp, skb))
> return -1;
>
> - /* XXX: insert other options when appropriate */
> + dccp_insert_option_padding(skb);
> + return 0;
> +}
>
> - if (DCCP_SKB_CB(skb)->dccpd_opt_len != 0) {
> - /* The length of all options has to be a multiple of 4 */
> - int padding = DCCP_SKB_CB(skb)->dccpd_opt_len % 4;
> -
> - if (padding != 0) {
> - padding = 4 - padding;
> - memset(skb_push(skb, padding), 0, padding);
> - DCCP_SKB_CB(skb)->dccpd_opt_len += padding;
> - }
> - }
> +/**
> + * dccp_insert_options_rsk - dccp_insert_options for request sockets
> + * This function is analogous to above - also use with dccp_reserve_hdr_space().
> + */
> +int dccp_insert_options_rsk(struct dccp_request_sock *dreq, struct sk_buff *skb)
> +{
> + DCCP_SKB_CB(skb)->dccpd_opt_len = 0;
> +
> + if (dreq->dreq_tstamp != NULL &&
> + dccp_insert_option_timestamp_echo(&dreq->dreq_tstamp, skb))
> + return -1;
>
> + dccp_insert_option_padding(skb);
> return 0;
> }
> -
> To unsubscribe from this list: send the line "unsubscribe dccp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2007-09-25 18:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-25 14:30 [PATCH 8/8]: Support inserting options during the 3-way handshake Gerrit Renker
2007-09-25 18:52 ` Arnaldo Carvalho de Melo [this message]
2007-09-25 23:09 ` Ian McDonald
2007-09-26 9:04 ` Gerrit Renker
2007-09-26 9:45 ` [PATCH 8/8]: Support inserting options during the 3-way Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070925185227.GI18348@ghostprotocols.net \
--to=acme@ghostprotocols.net \
--cc=dccp@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox