summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2012-12-20 15:12:52 +0000
committerDavid S. Miller <davem@davemloft.net>2012-12-21 13:14:00 -0800
commit412ed94744d16806fbec3bd250fd94e71cde5a1f (patch)
tree092eb88bc8d798797354bdaa8db95c26faa35f6b /net
parent29042073e7af55334ac3c4f2a8340263200c5749 (diff)
downloadlinux-3.10-412ed94744d16806fbec3bd250fd94e71cde5a1f.tar.gz
linux-3.10-412ed94744d16806fbec3bd250fd94e71cde5a1f.tar.bz2
linux-3.10-412ed94744d16806fbec3bd250fd94e71cde5a1f.zip
ip_gre: make ipgre_tunnel_xmit() not parse network header as IP unconditionally
ipgre_tunnel_xmit() parses network header as IP unconditionally. But transmitting packets are not always IP packet. For example such packet can be sent by packet socket with sockaddr_ll.sll_protocol set. So make the function check if skb->protocol is IP. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_gre.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index a85ae2f7a21..8fcf0ed7654 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -760,7 +760,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
if (dev->header_ops && dev->type == ARPHRD_IPGRE) {
gre_hlen = 0;
- tiph = (const struct iphdr *)skb->data;
+ if (skb->protocol == htons(ETH_P_IP))
+ tiph = (const struct iphdr *)skb->data;
+ else
+ tiph = &tunnel->parms.iph;
} else {
gre_hlen = tunnel->hlen;
tiph = &tunnel->parms.iph;