All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Cong Wang <amwang@redhat.com>
Cc: netdev@vger.kernel.org, Pravin B Shelar <pshelar@nicira.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next v2] gre: fix a regression in ioctl
Date: Sat, 29 Jun 2013 19:52:44 +0400	[thread overview]
Message-ID: <51CF02CC.7070907@cogentembedded.com> (raw)
In-Reply-To: <1372472672-1900-1-git-send-email-amwang@redhat.com>

Hello.

On 29-06-2013 6:24, Cong Wang wrote:

> From: Cong Wang <amwang@redhat.com>

> When testing GRE tunnel, I got:

>   # ip tunnel show
>   get tunnel gre0 failed: Invalid argument
>   get tunnel gre1 failed: Invalid argument

> This is a regression introduced by commit c54419321455631079c7d
> ("GRE: Refactor GRE tunneling code.") because previously we
> only check the parameters for SIOCADDTUNNEL and SIOCCHGTUNNEL,
> after that commit, the check is moved for all commands.

> So, just move it back inside SIOCADDTUNNEL and SIOCCHGTUNNEL.

> After this patch I got:

>   # ip tunnel show
>   gre0: gre/ip  remote any  local any  ttl inherit  nopmtudisc
>   gre1: gre/ip  remote 192.168.122.101  local 192.168.122.45  ttl inherit

> Cc: Pravin B Shelar <pshelar@nicira.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Signed-off-by: Cong Wang <amwang@redhat.com>
> ---
> v2: check TUNNEL_* flags

[...]
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index 394cebc..dc7d7ac 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -712,6 +712,11 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)
>
>   	case SIOCADDTUNNEL:
>   	case SIOCCHGTUNNEL:
> +		if (p->iph.version != 4 || p->iph.protocol != IPPROTO_GRE ||
> +		    p->iph.ihl != 5 || (p->iph.frag_off&htons(~IP_DF)) ||
> +		    ((p->i_flags|p->o_flags)&(TUNNEL_VERSION|TUNNEL_ROUTING)))

    Maybe it's time to insert spaces around & to make the code formatted 
consistently?

WBR, Sergei

  parent reply	other threads:[~2013-06-29 15:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-29  2:04 [Patch net-next] gre: fix a regression in ioctl Cong Wang
2013-06-29  2:16 ` Cong Wang
2013-06-29  2:24 ` [Patch net-next v2] " Cong Wang
2013-06-29  3:28   ` Pravin Shelar
2013-06-29  3:33     ` Cong Wang
2013-06-29  3:55       ` Cong Wang
2013-06-29  4:02     ` [Patch net-next v3] " Cong Wang
2013-06-29 18:42       ` Dmitry Kravkov
2013-07-01  2:06         ` Cong Wang
2013-07-02  6:36       ` David Miller
2013-06-29 15:52   ` Sergei Shtylyov [this message]
2013-07-01  2:08     ` [Patch net-next v2] " Cong Wang

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=51CF02CC.7070907@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@nicira.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.