diff options
Diffstat (limited to 'net/ipv6/ip6mr.c')
| -rw-r--r-- | net/ipv6/ip6mr.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 23e4ac0cc30e..3e333268db89 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
| 34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
| 35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
| 36 | #include <linux/slab.h> | ||
| 36 | #include <net/protocol.h> | 37 | #include <net/protocol.h> |
| 37 | #include <linux/skbuff.h> | 38 | #include <linux/skbuff.h> |
| 38 | #include <net/sock.h> | 39 | #include <net/sock.h> |
| @@ -1695,17 +1696,20 @@ ip6mr_fill_mroute(struct sk_buff *skb, struct mfc6_cache *c, struct rtmsg *rtm) | |||
| 1695 | int ct; | 1696 | int ct; |
| 1696 | struct rtnexthop *nhp; | 1697 | struct rtnexthop *nhp; |
| 1697 | struct net *net = mfc6_net(c); | 1698 | struct net *net = mfc6_net(c); |
| 1698 | struct net_device *dev = net->ipv6.vif6_table[c->mf6c_parent].dev; | ||
| 1699 | u8 *b = skb_tail_pointer(skb); | 1699 | u8 *b = skb_tail_pointer(skb); |
| 1700 | struct rtattr *mp_head; | 1700 | struct rtattr *mp_head; |
| 1701 | 1701 | ||
| 1702 | if (dev) | 1702 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
| 1703 | RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); | 1703 | if (c->mf6c_parent > MAXMIFS) |
| 1704 | return -ENOENT; | ||
| 1705 | |||
| 1706 | if (MIF_EXISTS(net, c->mf6c_parent)) | ||
| 1707 | RTA_PUT(skb, RTA_IIF, 4, &net->ipv6.vif6_table[c->mf6c_parent].dev->ifindex); | ||
| 1704 | 1708 | ||
| 1705 | mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); | 1709 | mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); |
| 1706 | 1710 | ||
| 1707 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { | 1711 | for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { |
| 1708 | if (c->mfc_un.res.ttls[ct] < 255) { | 1712 | if (MIF_EXISTS(net, ct) && c->mfc_un.res.ttls[ct] < 255) { |
| 1709 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) | 1713 | if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) |
| 1710 | goto rtattr_failure; | 1714 | goto rtattr_failure; |
| 1711 | nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); | 1715 | nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); |
