ipmr.c (7438189baa0a2fe30084bdc97e3d540ebc5444f3) | ipmr.c (f77f13e22df4a40d237697df496152c8c37f3f2b) |
---|---|
1/* 2 * IP multicast routing support for mrouted 3.6/3.8 3 * 4 * (c) 1995 Alan Cox, <alan@lxorguk.ukuu.org.uk> 5 * Linux Consultancy and Custom Driver Development 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 8 unchanged lines hidden (view full) --- 17 * Malcolm Beattie : Buffer handling fixes. 18 * Alexey Kuznetsov : Double buffer free and other fixes. 19 * SVR Anand : Fixed several multicast bugs and problems. 20 * Alexey Kuznetsov : Status, optimisations and more. 21 * Brad Parker : Better behaviour on mrouted upcall 22 * overflow. 23 * Carlos Picoto : PIMv1 Support 24 * Pavlin Ivanov Radoslavov: PIMv2 Registers must checksum only PIM header | 1/* 2 * IP multicast routing support for mrouted 3.6/3.8 3 * 4 * (c) 1995 Alan Cox, <alan@lxorguk.ukuu.org.uk> 5 * Linux Consultancy and Custom Driver Development 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 8 unchanged lines hidden (view full) --- 17 * Malcolm Beattie : Buffer handling fixes. 18 * Alexey Kuznetsov : Double buffer free and other fixes. 19 * SVR Anand : Fixed several multicast bugs and problems. 20 * Alexey Kuznetsov : Status, optimisations and more. 21 * Brad Parker : Better behaviour on mrouted upcall 22 * overflow. 23 * Carlos Picoto : PIMv1 Support 24 * Pavlin Ivanov Radoslavov: PIMv2 Registers must checksum only PIM header |
25 * Relax this requrement to work with older peers. | 25 * Relax this requirement to work with older peers. |
26 * 27 */ 28 29#include <asm/system.h> 30#include <asm/uaccess.h> 31#include <linux/types.h> 32#include <linux/capability.h> 33#include <linux/errno.h> --- 763 unchanged lines hidden (view full) --- 797 return -ENOENT; 798} 799 800static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock) 801{ 802 int line; 803 struct mfc_cache *uc, *c, **cp; 804 | 26 * 27 */ 28 29#include <asm/system.h> 30#include <asm/uaccess.h> 31#include <linux/types.h> 32#include <linux/capability.h> 33#include <linux/errno.h> --- 763 unchanged lines hidden (view full) --- 797 return -ENOENT; 798} 799 800static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock) 801{ 802 int line; 803 struct mfc_cache *uc, *c, **cp; 804 |
805 if (mfc->mfcc_parent >= MAXVIFS) 806 return -ENFILE; 807 | |
808 line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); 809 810 for (cp = &net->ipv4.mfc_cache_array[line]; 811 (c = *cp) != NULL; cp = &c->next) { 812 if (c->mfc_origin == mfc->mfcc_origin.s_addr && 813 c->mfc_mcastgrp == mfc->mfcc_mcastgrp.s_addr) 814 break; 815 } --- 795 unchanged lines hidden (view full) --- 1611#endif 1612 1613static int 1614ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) 1615{ 1616 int ct; 1617 struct rtnexthop *nhp; 1618 struct net *net = mfc_net(c); | 805 line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); 806 807 for (cp = &net->ipv4.mfc_cache_array[line]; 808 (c = *cp) != NULL; cp = &c->next) { 809 if (c->mfc_origin == mfc->mfcc_origin.s_addr && 810 c->mfc_mcastgrp == mfc->mfcc_mcastgrp.s_addr) 811 break; 812 } --- 795 unchanged lines hidden (view full) --- 1608#endif 1609 1610static int 1611ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) 1612{ 1613 int ct; 1614 struct rtnexthop *nhp; 1615 struct net *net = mfc_net(c); |
1616 struct net_device *dev = net->ipv4.vif_table[c->mfc_parent].dev; |
|
1619 u8 *b = skb_tail_pointer(skb); 1620 struct rtattr *mp_head; 1621 | 1617 u8 *b = skb_tail_pointer(skb); 1618 struct rtattr *mp_head; 1619 |
1622 /* If cache is unresolved, don't try to parse IIF and OIF */ 1623 if (c->mfc_parent > MAXVIFS) 1624 return -ENOENT; | 1620 if (dev) 1621 RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); |
1625 | 1622 |
1626 if (VIF_EXISTS(net, c->mfc_parent)) 1627 RTA_PUT(skb, RTA_IIF, 4, &net->ipv4.vif_table[c->mfc_parent].dev->ifindex); 1628 | |
1629 mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); 1630 1631 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { | 1623 mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); 1624 1625 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { |
1632 if (VIF_EXISTS(net, ct) && c->mfc_un.res.ttls[ct] < 255) { | 1626 if (c->mfc_un.res.ttls[ct] < 255) { |
1633 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) 1634 goto rtattr_failure; 1635 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); 1636 nhp->rtnh_flags = 0; 1637 nhp->rtnh_hops = c->mfc_un.res.ttls[ct]; 1638 nhp->rtnh_ifindex = net->ipv4.vif_table[ct].dev->ifindex; 1639 nhp->rtnh_len = sizeof(*nhp); 1640 } --- 432 unchanged lines hidden --- | 1627 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) 1628 goto rtattr_failure; 1629 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); 1630 nhp->rtnh_flags = 0; 1631 nhp->rtnh_hops = c->mfc_un.res.ttls[ct]; 1632 nhp->rtnh_ifindex = net->ipv4.vif_table[ct].dev->ifindex; 1633 nhp->rtnh_len = sizeof(*nhp); 1634 } --- 432 unchanged lines hidden --- |