netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: James Chapman <jchapman@katalix.com>
Cc: derek@ihtfp.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-2.6.23] UDP: Cleanup UDP encapsulation code
Date: Thu, 05 Jul 2007 17:04:25 +0200	[thread overview]
Message-ID: <468D0879.4080903@trash.net> (raw)
In-Reply-To: <200707051427.l65ER6iS016766@quickie.katalix.com>

James Chapman wrote:

> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index b9276f8..777d5e8 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -70,7 +70,8 @@
>   *	Alexey Kuznetsov:		allow both IPv4 and IPv6 sockets to bind
>   *					a single port at the same time.
>   *	Derek Atkins <derek@ihtfp.com>: Add Encapulation Support
> - *	James Chapman		:	Add L2TP encapsulation type.
> + *	James Chapman		:	Use socket's encap_rcv for all encapsulated
> + *					protocols..

We have git for changelogs, please don't add to this.

> -				}
> +		unsigned int len;
>  
> -				/* FALLTHROUGH -- pass up as UDP packet */
> +		/* if we're overly short, let UDP handle it */
> +		len = skb->len - sizeof(struct udphdr);
> +		if (len <= 0)
> +			goto udp;
> +
> +		if (up->encap_rcv != NULL) {
> +			int ret;
> +
> +			ret = (*up->encap_rcv)(sk, skb);
> +			if (ret == 0)
> +				goto out;
> +			if (ret < 0) {
> +				/* Eat the packet .. */
> +				kfree_skb(skb);
> +				goto out;
>  			}


This doesn't seem to handle encapsulated transport mode packets.
In that case xfrm4_rcv_encap returns the negative decapsulated
protocol number, you change it to a positive number again:

> +	ret = xfrm4_rcv_encap(skb, encap_type);
> +	return -ret;

and then continue to process it as UDP. What should happen in
that case is that the negative protocol value is returned to
ip_local_deliver_finish.

      reply	other threads:[~2007-07-05 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-05 14:27 [PATCH net-2.6.23] UDP: Cleanup UDP encapsulation code James Chapman
2007-07-05 15:04 ` Patrick McHardy [this message]

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=468D0879.4080903@trash.net \
    --to=kaber@trash.net \
    --cc=derek@ihtfp.com \
    --cc=jchapman@katalix.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).