aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_gre.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r--net/ipv4/ip_gre.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index f151900efaf9..02b02a8d681c 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -674,7 +674,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
674 struct rtable *rt; /* Route to the other host */ 674 struct rtable *rt; /* Route to the other host */
675 struct net_device *tdev; /* Device to other host */ 675 struct net_device *tdev; /* Device to other host */
676 struct iphdr *iph; /* Our new IP header */ 676 struct iphdr *iph; /* Our new IP header */
677 int max_headroom; /* The extra header space needed */ 677 unsigned int max_headroom; /* The extra header space needed */
678 int gre_hlen; 678 int gre_hlen;
679 __be32 dst; 679 __be32 dst;
680 int mtu; 680 int mtu;
@@ -1033,7 +1033,6 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
1033 return 0; 1033 return 0;
1034} 1034}
1035 1035
1036#ifdef CONFIG_NET_IPGRE_BROADCAST
1037/* Nice toy. Unfortunately, useless in real life :-) 1036/* Nice toy. Unfortunately, useless in real life :-)
1038 It allows to construct virtual multiprotocol broadcast "LAN" 1037 It allows to construct virtual multiprotocol broadcast "LAN"
1039 over the Internet, provided multicast routing is tuned. 1038 over the Internet, provided multicast routing is tuned.
@@ -1092,10 +1091,19 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
1092 return -t->hlen; 1091 return -t->hlen;
1093} 1092}
1094 1093
1094static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr)
1095{
1096 struct iphdr *iph = (struct iphdr*) skb_mac_header(skb);
1097 memcpy(haddr, &iph->saddr, 4);
1098 return 4;
1099}
1100
1095static const struct header_ops ipgre_header_ops = { 1101static const struct header_ops ipgre_header_ops = {
1096 .create = ipgre_header, 1102 .create = ipgre_header,
1103 .parse = ipgre_header_parse,
1097}; 1104};
1098 1105
1106#ifdef CONFIG_NET_IPGRE_BROADCAST
1099static int ipgre_open(struct net_device *dev) 1107static int ipgre_open(struct net_device *dev)
1100{ 1108{
1101 struct ip_tunnel *t = netdev_priv(dev); 1109 struct ip_tunnel *t = netdev_priv(dev);
@@ -1197,6 +1205,8 @@ static int ipgre_tunnel_init(struct net_device *dev)
1197 dev->stop = ipgre_close; 1205 dev->stop = ipgre_close;
1198 } 1206 }
1199#endif 1207#endif
1208 } else {
1209 dev->header_ops = &ipgre_header_ops;
1200 } 1210 }
1201 1211
1202 if (!tdev && tunnel->parms.link) 1212 if (!tdev && tunnel->parms.link)