diff options
Diffstat (limited to 'net/ipv4/ipmr.c')
| -rw-r--r-- | net/ipv4/ipmr.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 54596f73eff5..d0a6092a67be 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
| @@ -802,6 +802,9 @@ static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock) | |||
| 802 | int line; | 802 | int line; |
| 803 | struct mfc_cache *uc, *c, **cp; | 803 | struct mfc_cache *uc, *c, **cp; |
| 804 | 804 | ||
| 805 | if (mfc->mfcc_parent >= MAXVIFS) | ||
| 806 | return -ENFILE; | ||
| 807 | |||
| 805 | line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); | 808 | line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr); |
| 806 | 809 | ||
| 807 | for (cp = &net->ipv4.mfc_cache_array[line]; | 810 | for (cp = &net->ipv4.mfc_cache_array[line]; |
| @@ -1163,9 +1166,6 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v | |||
| 1163 | int ct; | 1166 | int ct; |
| 1164 | LIST_HEAD(list); | 1167 | LIST_HEAD(list); |
| 1165 | 1168 | ||
| 1166 | if (!net_eq(dev_net(dev), net)) | ||
| 1167 | return NOTIFY_DONE; | ||
| 1168 | |||
| 1169 | if (event != NETDEV_UNREGISTER) | 1169 | if (event != NETDEV_UNREGISTER) |
| 1170 | return NOTIFY_DONE; | 1170 | return NOTIFY_DONE; |
| 1171 | v = &net->ipv4.vif_table[0]; | 1171 | v = &net->ipv4.vif_table[0]; |
| @@ -1616,17 +1616,20 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm) | |||
| 1616 | int ct; | 1616 | int ct; |
| 1617 | struct rtnexthop *nhp; | 1617 | struct rtnexthop *nhp; |
| 1618 | struct net *net = mfc_net(c); | 1618 | struct net *net = mfc_net(c); |
| 1619 | struct net_device *dev = net->ipv4.vif_table[c->mfc_parent].dev; | ||
| 1620 | u8 *b = skb_tail_pointer(skb); | 1619 | u8 *b = skb_tail_pointer(skb); |
| 1621 | struct rtattr *mp_head; | 1620 | struct rtattr *mp_head; |
| 1622 | 1621 | ||
| 1623 | if (dev) | 1622 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
| 1624 | RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); | 1623 | if (c->mfc_parent > MAXVIFS) |
| 1624 | return -ENOENT; | ||
| 1625 | |||
| 1626 | if (VIF_EXISTS(net, c->mfc_parent)) | ||
| 1627 | RTA_PUT(skb, RTA_IIF, 4, &net->ipv4.vif_table[c->mfc_parent].dev->ifindex); | ||
| 1625 | 1628 | ||
| 1626 | mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); | 1629 | mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); |
| 1627 | 1630 | ||
| 1628 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { | 1631 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { |
| 1629 | if (c->mfc_un.res.ttls[ct] < 255) { | 1632 | if (VIF_EXISTS(net, ct) && c->mfc_un.res.ttls[ct] < 255) { |
| 1630 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) | 1633 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) |
| 1631 | goto rtattr_failure; | 1634 | goto rtattr_failure; |
| 1632 | nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); | 1635 | nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); |
