aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipmr.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r--net/ipv4/ipmr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 05bc27002def..8f45c95db451 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1437,7 +1437,8 @@ int pim_rcv_v1(struct sk_buff * skb)
1437 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) 1437 pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
1438 goto drop; 1438 goto drop;
1439 1439
1440 encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr)); 1440 encap = (struct iphdr *)(skb_transport_header(skb) +
1441 sizeof(struct igmphdr));
1441 /* 1442 /*
1442 Check that: 1443 Check that:
1443 a. packet is really destinted to a multicast group 1444 a. packet is really destinted to a multicast group
@@ -1490,7 +1491,7 @@ static int pim_rcv(struct sk_buff * skb)
1490 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) 1491 if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
1491 goto drop; 1492 goto drop;
1492 1493
1493 pim = (struct pimreghdr*)skb->h.raw; 1494 pim = (struct pimreghdr *)skb_transport_header(skb);
1494 if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || 1495 if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
1495 (pim->flags&PIM_NULL_REGISTER) || 1496 (pim->flags&PIM_NULL_REGISTER) ||
1496 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && 1497 (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
@@ -1498,7 +1499,8 @@ static int pim_rcv(struct sk_buff * skb)
1498 goto drop; 1499 goto drop;
1499 1500
1500 /* check if the inner packet is destined to mcast group */ 1501 /* check if the inner packet is destined to mcast group */
1501 encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr)); 1502 encap = (struct iphdr *)(skb_transport_header(skb) +
1503 sizeof(struct pimreghdr));
1502 if (!MULTICAST(encap->daddr) || 1504 if (!MULTICAST(encap->daddr) ||
1503 encap->tot_len == 0 || 1505 encap->tot_len == 0 ||
1504 ntohs(encap->tot_len) + sizeof(*pim) > skb->len) 1506 ntohs(encap->tot_len) + sizeof(*pim) > skb->len)