summaryrefslogtreecommitdiff
path: root/patches/linux-2.6.20-ipgre.diff
blob: a78ed1747c4c91e5b610e8cc2842e07b72e5ae0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: linux-2.6.20/net/ipv4/ip_gre.c
===================================================================
--- linux-2.6.20.orig/net/ipv4/ip_gre.c	2008-01-04 15:05:34.000000000 +0200
+++ linux-2.6.20/net/ipv4/ip_gre.c	2008-01-04 15:05:37.000000000 +0200
@@ -1033,7 +1033,13 @@
 	return 0;
 }
 
-#ifdef CONFIG_NET_IPGRE_BROADCAST
+static int ipgre_tunnel_parse_header(struct sk_buff *skb, unsigned char *haddr)
+{
+	struct iphdr *iph = (struct iphdr*) skb_mac_header(skb);
+	memcpy(haddr, &iph->saddr, 4);
+	return 4;
+}
+
 /* Nice toy. Unfortunately, useless in real life :-)
    It allows to construct virtual multiprotocol broadcast "LAN"
    over the Internet, provided multicast routing is tuned.
@@ -1091,6 +1097,7 @@
 	return -t->hlen;
 }
 
+#ifdef CONFIG_NET_IPGRE_BROADCAST
 static int ipgre_open(struct net_device *dev)
 {
 	struct ip_tunnel *t = netdev_priv(dev);
@@ -1139,6 +1146,7 @@
 	dev->get_stats		= ipgre_tunnel_get_stats;
 	dev->do_ioctl		= ipgre_tunnel_ioctl;
 	dev->change_mtu		= ipgre_tunnel_change_mtu;
+	dev->hard_header_parse  = ipgre_tunnel_parse_header;
 
 	dev->type		= ARPHRD_IPGRE;
 	dev->hard_header_len 	= LL_MAX_HEADER + sizeof(struct iphdr) + 4;
@@ -1193,6 +1201,8 @@
 			dev->stop = ipgre_close;
 		}
 #endif
+	} else {
+		dev->hard_header = ipgre_header;
 	}
 
 	if (!tdev && tunnel->parms.link)