* [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header
@ 2012-12-25 2:51 Isaku Yamahata
2012-12-25 2:51 ` [PATCH 2/2] ipv6/ip6_gre: set transport header correctly Isaku Yamahata
2012-12-26 23:20 ` [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Isaku Yamahata @ 2012-12-25 2:51 UTC (permalink / raw)
To: netdev; +Cc: yamahata
ipgre_tunnel_xmit() incorrectly sets transport header to inner payload
instead of GRE header. It seems copy-and-pasted from ipip.c.
So set transport header to gre header.
(In ipip case the transport header is the inner ip header, so that's
correct.)
Found by inspection. In practice the incorrect transport header
doesn't matter because the skb usually is sent to another net_device
or socket, so the transport header isn't referenced.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
net/ipv4/ip_gre.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 58cb627..303012a 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -912,9 +912,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
/* Warning : tiph value might point to freed memory */
}
- skb_reset_transport_header(skb);
skb_push(skb, gre_hlen);
skb_reset_network_header(skb);
+ skb_set_transport_header(skb, sizeof(*iph));
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
IPSKB_REROUTED);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ipv6/ip6_gre: set transport header correctly
2012-12-25 2:51 [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header Isaku Yamahata
@ 2012-12-25 2:51 ` Isaku Yamahata
2012-12-26 23:20 ` David Miller
2012-12-26 23:20 ` [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Isaku Yamahata @ 2012-12-25 2:51 UTC (permalink / raw)
To: netdev; +Cc: yamahata
ip6gre_xmit2() incorrectly sets transport header to inner payload
instead of GRE header. It seems copy-and-pasted from ipip.c.
Set transport header to gre header.
(In ipip case the transport header is the inner ip header, so that's
correct.)
Found by inspection. In practice the incorrect transport header
doesn't matter because the skb usually is sent to another net_device
or socket, so the transport header isn't referenced.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
net/ipv6/ip6_gre.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 867466c..c727e47 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -758,8 +758,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
skb_dst_set_noref(skb, dst);
}
- skb->transport_header = skb->network_header;
-
proto = NEXTHDR_GRE;
if (encap_limit >= 0) {
init_tel_txopt(&opt, encap_limit);
@@ -768,6 +766,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
skb_push(skb, gre_hlen);
skb_reset_network_header(skb);
+ skb_set_transport_header(skb, sizeof(*ipv6h));
/*
* Push down and install the IP header.
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header
2012-12-25 2:51 [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header Isaku Yamahata
2012-12-25 2:51 ` [PATCH 2/2] ipv6/ip6_gre: set transport header correctly Isaku Yamahata
@ 2012-12-26 23:20 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-12-26 23:20 UTC (permalink / raw)
To: yamahata; +Cc: netdev
From: Isaku Yamahata <yamahata@valinux.co.jp>
Date: Tue, 25 Dec 2012 11:51:03 +0900
> ipgre_tunnel_xmit() incorrectly sets transport header to inner payload
> instead of GRE header. It seems copy-and-pasted from ipip.c.
> So set transport header to gre header.
> (In ipip case the transport header is the inner ip header, so that's
> correct.)
>
> Found by inspection. In practice the incorrect transport header
> doesn't matter because the skb usually is sent to another net_device
> or socket, so the transport header isn't referenced.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ipv6/ip6_gre: set transport header correctly
2012-12-25 2:51 ` [PATCH 2/2] ipv6/ip6_gre: set transport header correctly Isaku Yamahata
@ 2012-12-26 23:20 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-12-26 23:20 UTC (permalink / raw)
To: yamahata; +Cc: netdev
From: Isaku Yamahata <yamahata@valinux.co.jp>
Date: Tue, 25 Dec 2012 11:51:04 +0900
> ip6gre_xmit2() incorrectly sets transport header to inner payload
> instead of GRE header. It seems copy-and-pasted from ipip.c.
> Set transport header to gre header.
> (In ipip case the transport header is the inner ip header, so that's
> correct.)
>
> Found by inspection. In practice the incorrect transport header
> doesn't matter because the skb usually is sent to another net_device
> or socket, so the transport header isn't referenced.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-26 23:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-25 2:51 [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header Isaku Yamahata
2012-12-25 2:51 ` [PATCH 2/2] ipv6/ip6_gre: set transport header correctly Isaku Yamahata
2012-12-26 23:20 ` David Miller
2012-12-26 23:20 ` [PATCH 1/2] ipv4/ip_gre: set transport header correctly to gre header David Miller
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).