aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipip.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ipip.c')
-rw-r--r--net/ipv4/ipip.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index ea398ee43f28..0c4556529228 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -94,7 +94,6 @@
94 94
95 95
96#include <linux/capability.h> 96#include <linux/capability.h>
97#include <linux/config.h>
98#include <linux/module.h> 97#include <linux/module.h>
99#include <linux/types.h> 98#include <linux/types.h>
100#include <linux/sched.h> 99#include <linux/sched.h>
@@ -342,7 +341,8 @@ out:
342 int code = skb->h.icmph->code; 341 int code = skb->h.icmph->code;
343 int rel_type = 0; 342 int rel_type = 0;
344 int rel_code = 0; 343 int rel_code = 0;
345 int rel_info = 0; 344 __be32 rel_info = 0;
345 __u32 n = 0;
346 struct sk_buff *skb2; 346 struct sk_buff *skb2;
347 struct flowi fl; 347 struct flowi fl;
348 struct rtable *rt; 348 struct rtable *rt;
@@ -355,14 +355,15 @@ out:
355 default: 355 default:
356 return 0; 356 return 0;
357 case ICMP_PARAMETERPROB: 357 case ICMP_PARAMETERPROB:
358 if (skb->h.icmph->un.gateway < hlen) 358 n = ntohl(skb->h.icmph->un.gateway) >> 24;
359 if (n < hlen)
359 return 0; 360 return 0;
360 361
361 /* So... This guy found something strange INSIDE encapsulated 362 /* So... This guy found something strange INSIDE encapsulated
362 packet. Well, he is fool, but what can we do ? 363 packet. Well, he is fool, but what can we do ?
363 */ 364 */
364 rel_type = ICMP_PARAMETERPROB; 365 rel_type = ICMP_PARAMETERPROB;
365 rel_info = skb->h.icmph->un.gateway - hlen; 366 rel_info = htonl((n - hlen) << 24);
366 break; 367 break;
367 368
368 case ICMP_DEST_UNREACH: 369 case ICMP_DEST_UNREACH:
@@ -373,13 +374,14 @@ out:
373 return 0; 374 return 0;
374 case ICMP_FRAG_NEEDED: 375 case ICMP_FRAG_NEEDED:
375 /* And it is the only really necessary thing :-) */ 376 /* And it is the only really necessary thing :-) */
376 rel_info = ntohs(skb->h.icmph->un.frag.mtu); 377 n = ntohs(skb->h.icmph->un.frag.mtu);
377 if (rel_info < hlen+68) 378 if (n < hlen+68)
378 return 0; 379 return 0;
379 rel_info -= hlen; 380 n -= hlen;
380 /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */ 381 /* BSD 4.2 MORE DOES NOT EXIST IN NATURE. */
381 if (rel_info > ntohs(eiph->tot_len)) 382 if (n > ntohs(eiph->tot_len))
382 return 0; 383 return 0;
384 rel_info = htonl(n);
383 break; 385 break;
384 default: 386 default:
385 /* All others are translated to HOST_UNREACH. 387 /* All others are translated to HOST_UNREACH.
@@ -441,12 +443,11 @@ out:
441 443
442 /* change mtu on this route */ 444 /* change mtu on this route */
443 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { 445 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
444 if (rel_info > dst_mtu(skb2->dst)) { 446 if (n > dst_mtu(skb2->dst)) {
445 kfree_skb(skb2); 447 kfree_skb(skb2);
446 return 0; 448 return 0;
447 } 449 }
448 skb2->dst->ops->update_pmtu(skb2->dst, rel_info); 450 skb2->dst->ops->update_pmtu(skb2->dst, n);
449 rel_info = htonl(rel_info);
450 } else if (type == ICMP_TIME_EXCEEDED) { 451 } else if (type == ICMP_TIME_EXCEEDED) {
451 struct ip_tunnel *t = netdev_priv(skb2->dev); 452 struct ip_tunnel *t = netdev_priv(skb2->dev);
452 if (t->parms.iph.ttl) { 453 if (t->parms.iph.ttl) {
@@ -488,7 +489,6 @@ static int ipip_rcv(struct sk_buff *skb)
488 489
489 skb->mac.raw = skb->nh.raw; 490 skb->mac.raw = skb->nh.raw;
490 skb->nh.raw = skb->data; 491 skb->nh.raw = skb->data;
491 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
492 skb->protocol = htons(ETH_P_IP); 492 skb->protocol = htons(ETH_P_IP);
493 skb->pkt_type = PACKET_HOST; 493 skb->pkt_type = PACKET_HOST;
494 494