diff mbox

[net] ip_gre: fix ipgre_header to return correct offset

Message ID 1375785943-23908-1-git-send-email-timo.teras@iki.fi
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Timo Teras Aug. 6, 2013, 10:45 a.m. UTC
Fix ipgre_header() (header_ops->create) to return the correct
amount of bytes pushed. Most callers of dev_hard_header() seem
to care only if it was success, but af_packet.c uses it as
offset to the skb to copy from userspace only once. In practice
this fixes packet socket sendto()/sendmsg() to gre tunnels.

Regression introduced in c54419321455631079c7d6e60bc732dd0c5914c5
("GRE: Refactor GRE tunneling code.")

Cc: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
Should go to 3.10-stable too. Without this dmvpn setup does not work
at all, as opennhrp uses packet sockets to send the nhrp packets.

 net/ipv4/ip_gre.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet Aug. 6, 2013, 11:37 a.m. UTC | #1
On Tue, 2013-08-06 at 13:45 +0300, Timo Teräs wrote:
> Fix ipgre_header() (header_ops->create) to return the correct
> amount of bytes pushed. Most callers of dev_hard_header() seem
> to care only if it was success, but af_packet.c uses it as
> offset to the skb to copy from userspace only once. In practice
> this fixes packet socket sendto()/sendmsg() to gre tunnels.
> 
> Regression introduced in c54419321455631079c7d6e60bc732dd0c5914c5
> ("GRE: Refactor GRE tunneling code.")
> 
> Cc: Pravin B Shelar <pshelar@nicira.com>
> Signed-off-by: Timo Teräs <timo.teras@iki.fi>
> ---
> Should go to 3.10-stable too. Without this dmvpn setup does not work
> at all, as opennhrp uses packet sockets to send the nhrp packets.
> 
>  net/ipv4/ip_gre.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Eric Dumazet <edumazet@google.com>


--
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
David Miller Aug. 9, 2013, 6:06 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 06 Aug 2013 04:37:13 -0700

> On Tue, 2013-08-06 at 13:45 +0300, Timo Teräs wrote:
>> Fix ipgre_header() (header_ops->create) to return the correct
>> amount of bytes pushed. Most callers of dev_hard_header() seem
>> to care only if it was success, but af_packet.c uses it as
>> offset to the skb to copy from userspace only once. In practice
>> this fixes packet socket sendto()/sendmsg() to gre tunnels.
>> 
>> Regression introduced in c54419321455631079c7d6e60bc732dd0c5914c5
>> ("GRE: Refactor GRE tunneling code.")
>> 
>> Cc: Pravin B Shelar <pshelar@nicira.com>
>> Signed-off-by: Timo Teräs <timo.teras@iki.fi>
>> ---
>> Should go to 3.10-stable too. Without this dmvpn setup does not work
>> at all, as opennhrp uses packet sockets to send the nhrp packets.
>> 
>>  net/ipv4/ip_gre.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks.
--
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_gre.c b/net/ipv4/ip_gre.c
index 855004f..c52fee0 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -572,7 +572,7 @@  static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
 	if (daddr)
 		memcpy(&iph->daddr, daddr, 4);
 	if (iph->daddr)
-		return t->hlen;
+		return t->hlen + sizeof(*iph);
 
 	return -(t->hlen + sizeof(*iph));
 }