diff mbox

[net,v2] ip_tunnel: Set network header properly for IP_ECN_decapsulate()

Message ID CAL1qit8cy1GOfpdu+LxrFuvegSoC_GFvE67gnfFMBW224hhNAQ@mail.gmail.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Ying Cai May 4, 2014, 5:40 a.m. UTC
In ip_tunnel_rcv(), set skb->network_header to inner IP header
before IP_ECN_decapsulate().

Without the fix, IP_ECN_decapsulate() takes outer IP header as
inner IP header, possibly causing error messages or packet drops.

Note that this skb_reset_network_header() call was in this spot when
the original feature for checking consistency of ECN bits through
tunnels was added in eccc1bb8d4b4 ("tunnel: drop packet if ECN present
with not-ECT"). It was only removed from this spot in 3d7b46cd20e3
("ip_tunnel: push generic protocol handling to ip_tunnel module.").

Fixes: 3d7b46cd20e3 ("ip_tunnel: push generic protocol handling to
ip_tunnel module.")
Reported-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Ying Cai <ycai@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/ip_tunnel.c | 2 ++
 1 file changed, 2 insertions(+)

  if (log_ecn_error)

Comments

Sergei Shtylyov May 4, 2014, 3:13 p.m. UTC | #1
Hello.

On 04-05-2014 9:40, Ying Cai wrote:

> In ip_tunnel_rcv(), set skb->network_header to inner IP header
> before IP_ECN_decapsulate().

> Without the fix, IP_ECN_decapsulate() takes outer IP header as
> inner IP header, possibly causing error messages or packet drops.

> Note that this skb_reset_network_header() call was in this spot when
> the original feature for checking consistency of ECN bits through
> tunnels was added in eccc1bb8d4b4 ("tunnel: drop packet if ECN present
> with not-ECT"). It was only removed from this spot in 3d7b46cd20e3
> ("ip_tunnel: push generic protocol handling to ip_tunnel module.").

> Fixes: 3d7b46cd20e3 ("ip_tunnel: push generic protocol handling to
> ip_tunnel module.")
> Reported-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Ying Cai <ycai@google.com>
> Acked-by: Neal Cardwell <ncardwell@google.com>
> ---
>   net/ipv4/ip_tunnel.c | 2 ++
>   1 file changed, 2 insertions(+)

> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index fa5b751..b3f8597 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -442,6 +442,8 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct
> sk_buff *skb,
>    tunnel->i_seqno = ntohl(tpi->seq) + 1;
>    }
>
> + skb_reset_network_header(skb);
> +
>    err = IP_ECN_decapsulate(iph, skb);
>    if (unlikely(err)) {
>    if (log_ecn_error)

    The path is seriously whitespace-damaged. See 
Documentation/email-clients.txt in the kernel tree.

WBR, Sergei

--
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
Pravin B Shelar May 5, 2014, 11:46 p.m. UTC | #2
On Sat, May 3, 2014 at 10:40 PM, Ying Cai <ycai@google.com> wrote:
> In ip_tunnel_rcv(), set skb->network_header to inner IP header
> before IP_ECN_decapsulate().
>
> Without the fix, IP_ECN_decapsulate() takes outer IP header as
> inner IP header, possibly causing error messages or packet drops.
>
> Note that this skb_reset_network_header() call was in this spot when
> the original feature for checking consistency of ECN bits through
> tunnels was added in eccc1bb8d4b4 ("tunnel: drop packet if ECN present
> with not-ECT"). It was only removed from this spot in 3d7b46cd20e3
> ("ip_tunnel: push generic protocol handling to ip_tunnel module.").
>
> Fixes: 3d7b46cd20e3 ("ip_tunnel: push generic protocol handling to
> ip_tunnel module.")
> Reported-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Ying Cai <ycai@google.com>
> Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>

Looks good. Thanks.
> ---
>  net/ipv4/ip_tunnel.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index fa5b751..b3f8597 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -442,6 +442,8 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct
> sk_buff *skb,
>   tunnel->i_seqno = ntohl(tpi->seq) + 1;
>   }
>
> + skb_reset_network_header(skb);
> +
>   err = IP_ECN_decapsulate(iph, skb);
>   if (unlikely(err)) {
>   if (log_ecn_error)
> --
> 1.9.1.423.g4596e3a
--
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
diff mbox

Patch

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index fa5b751..b3f8597 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -442,6 +442,8 @@  int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct
sk_buff *skb,
  tunnel->i_seqno = ntohl(tpi->seq) + 1;
  }

+ skb_reset_network_header(skb);
+
  err = IP_ECN_decapsulate(iph, skb);
  if (unlikely(err)) {