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.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 717ab7d6d7b6..97cfa97c8abb 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -28,7 +28,6 @@
28 * 28 *
29 */ 29 */
30 30
31#include <linux/config.h>
32#include <asm/system.h> 31#include <asm/system.h>
33#include <asm/uaccess.h> 32#include <asm/uaccess.h>
34#include <linux/types.h> 33#include <linux/types.h>
@@ -313,7 +312,8 @@ static void ipmr_destroy_unres(struct mfc_cache *c)
313 e = NLMSG_DATA(nlh); 312 e = NLMSG_DATA(nlh);
314 e->error = -ETIMEDOUT; 313 e->error = -ETIMEDOUT;
315 memset(&e->msg, 0, sizeof(e->msg)); 314 memset(&e->msg, 0, sizeof(e->msg));
316 netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); 315
316 rtnl_unicast(skb, NETLINK_CB(skb).pid);
317 } else 317 } else
318 kfree_skb(skb); 318 kfree_skb(skb);
319 } 319 }
@@ -462,7 +462,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
462 return 0; 462 return 0;
463} 463}
464 464
465static struct mfc_cache *ipmr_cache_find(__u32 origin, __u32 mcastgrp) 465static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
466{ 466{
467 int line=MFC_HASH(mcastgrp,origin); 467 int line=MFC_HASH(mcastgrp,origin);
468 struct mfc_cache *c; 468 struct mfc_cache *c;
@@ -513,7 +513,6 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
513 513
514 while((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) { 514 while((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) {
515 if (skb->nh.iph->version == 0) { 515 if (skb->nh.iph->version == 0) {
516 int err;
517 struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); 516 struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
518 517
519 if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { 518 if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) {
@@ -526,7 +525,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
526 e->error = -EMSGSIZE; 525 e->error = -EMSGSIZE;
527 memset(&e->msg, 0, sizeof(e->msg)); 526 memset(&e->msg, 0, sizeof(e->msg));
528 } 527 }
529 err = netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT); 528
529 rtnl_unicast(skb, NETLINK_CB(skb).pid);
530 } else 530 } else
531 ip_mr_forward(skb, c, 0); 531 ip_mr_forward(skb, c, 0);
532 } 532 }
@@ -1097,7 +1097,7 @@ static struct notifier_block ip_mr_notifier={
1097 * important for multicast video. 1097 * important for multicast video.
1098 */ 1098 */
1099 1099
1100static void ip_encap(struct sk_buff *skb, u32 saddr, u32 daddr) 1100static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
1101{ 1101{
1102 struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); 1102 struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
1103 1103
@@ -1462,7 +1462,6 @@ int pim_rcv_v1(struct sk_buff * skb)
1462 skb_pull(skb, (u8*)encap - skb->data); 1462 skb_pull(skb, (u8*)encap - skb->data);
1463 skb->nh.iph = (struct iphdr *)skb->data; 1463 skb->nh.iph = (struct iphdr *)skb->data;
1464 skb->dev = reg_dev; 1464 skb->dev = reg_dev;
1465 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
1466 skb->protocol = htons(ETH_P_IP); 1465 skb->protocol = htons(ETH_P_IP);
1467 skb->ip_summed = 0; 1466 skb->ip_summed = 0;
1468 skb->pkt_type = PACKET_HOST; 1467 skb->pkt_type = PACKET_HOST;
@@ -1518,7 +1517,6 @@ static int pim_rcv(struct sk_buff * skb)
1518 skb_pull(skb, (u8*)encap - skb->data); 1517 skb_pull(skb, (u8*)encap - skb->data);
1519 skb->nh.iph = (struct iphdr *)skb->data; 1518 skb->nh.iph = (struct iphdr *)skb->data;
1520 skb->dev = reg_dev; 1519 skb->dev = reg_dev;
1521 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
1522 skb->protocol = htons(ETH_P_IP); 1520 skb->protocol = htons(ETH_P_IP);
1523 skb->ip_summed = 0; 1521 skb->ip_summed = 0;
1524 skb->pkt_type = PACKET_HOST; 1522 skb->pkt_type = PACKET_HOST;
@@ -1581,6 +1579,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
1581 cache = ipmr_cache_find(rt->rt_src, rt->rt_dst); 1579 cache = ipmr_cache_find(rt->rt_src, rt->rt_dst);
1582 1580
1583 if (cache==NULL) { 1581 if (cache==NULL) {
1582 struct sk_buff *skb2;
1584 struct net_device *dev; 1583 struct net_device *dev;
1585 int vif; 1584 int vif;
1586 1585
@@ -1594,12 +1593,18 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
1594 read_unlock(&mrt_lock); 1593 read_unlock(&mrt_lock);
1595 return -ENODEV; 1594 return -ENODEV;
1596 } 1595 }
1597 skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); 1596 skb2 = skb_clone(skb, GFP_ATOMIC);
1598 skb->nh.iph->ihl = sizeof(struct iphdr)>>2; 1597 if (!skb2) {
1599 skb->nh.iph->saddr = rt->rt_src; 1598 read_unlock(&mrt_lock);
1600 skb->nh.iph->daddr = rt->rt_dst; 1599 return -ENOMEM;
1601 skb->nh.iph->version = 0; 1600 }
1602 err = ipmr_cache_unresolved(vif, skb); 1601
1602 skb2->nh.raw = skb_push(skb2, sizeof(struct iphdr));
1603 skb2->nh.iph->ihl = sizeof(struct iphdr)>>2;
1604 skb2->nh.iph->saddr = rt->rt_src;
1605 skb2->nh.iph->daddr = rt->rt_dst;
1606 skb2->nh.iph->version = 0;
1607 err = ipmr_cache_unresolved(vif, skb2);
1603 read_unlock(&mrt_lock); 1608 read_unlock(&mrt_lock);
1604 return err; 1609 return err;
1605 } 1610 }
@@ -1895,11 +1900,8 @@ void __init ip_mr_init(void)
1895{ 1900{
1896 mrt_cachep = kmem_cache_create("ip_mrt_cache", 1901 mrt_cachep = kmem_cache_create("ip_mrt_cache",
1897 sizeof(struct mfc_cache), 1902 sizeof(struct mfc_cache),
1898 0, SLAB_HWCACHE_ALIGN, 1903 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
1899 NULL, NULL); 1904 NULL, NULL);
1900 if (!mrt_cachep)
1901 panic("cannot allocate ip_mrt_cache");
1902
1903 init_timer(&ipmr_expire_timer); 1905 init_timer(&ipmr_expire_timer);
1904 ipmr_expire_timer.function=ipmr_expire_process; 1906 ipmr_expire_timer.function=ipmr_expire_process;
1905 register_netdevice_notifier(&ip_mr_notifier); 1907 register_netdevice_notifier(&ip_mr_notifier);