diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2012-12-03 20:13:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-04 13:08:11 -0500 |
commit | 1eb99af52c4bc705f4042f37f255975acfc738f2 (patch) | |
tree | 7ccdd3e0185a44644cb68d9e3e1f6c46cab71943 /net/ipv4 | |
parent | 9a68ac72a44ecb6d4dc4a7cadf45e1a2cd183885 (diff) |
ipmr/ip6mr: allow to get unresolved cache via netlink
/proc/net/ip[6]_mr_cache allows to get all mfc entries, even if they are put in
the unresolved list (mfc[6]_unres_queue). But only the table RT_TABLE_DEFAULT is
displayed.
This patch adds the parsing of the unresolved list when the dump is made via
rtnetlink, hence each table can be checked.
In IPv6, we set rtm_type in ip6mr_fill_mroute(), because in case of unresolved
mfc __ip6mr_fill_mroute() will not set it. In IPv4, it is already done.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ipmr.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 91782a7634c2..084dac3bc151 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2154,6 +2154,7 @@ static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | |||
2154 | { | 2154 | { |
2155 | struct nlmsghdr *nlh; | 2155 | struct nlmsghdr *nlh; |
2156 | struct rtmsg *rtm; | 2156 | struct rtmsg *rtm; |
2157 | int err; | ||
2157 | 2158 | ||
2158 | nlh = nlmsg_put(skb, portid, seq, RTM_NEWROUTE, sizeof(*rtm), NLM_F_MULTI); | 2159 | nlh = nlmsg_put(skb, portid, seq, RTM_NEWROUTE, sizeof(*rtm), NLM_F_MULTI); |
2159 | if (nlh == NULL) | 2160 | if (nlh == NULL) |
@@ -2178,7 +2179,9 @@ static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | |||
2178 | if (nla_put_be32(skb, RTA_SRC, c->mfc_origin) || | 2179 | if (nla_put_be32(skb, RTA_SRC, c->mfc_origin) || |
2179 | nla_put_be32(skb, RTA_DST, c->mfc_mcastgrp)) | 2180 | nla_put_be32(skb, RTA_DST, c->mfc_mcastgrp)) |
2180 | goto nla_put_failure; | 2181 | goto nla_put_failure; |
2181 | if (__ipmr_fill_mroute(mrt, skb, c, rtm) < 0) | 2182 | err = __ipmr_fill_mroute(mrt, skb, c, rtm); |
2183 | /* do not break the dump if cache is unresolved */ | ||
2184 | if (err < 0 && err != -ENOENT) | ||
2182 | goto nla_put_failure; | 2185 | goto nla_put_failure; |
2183 | 2186 | ||
2184 | return nlmsg_end(skb, nlh); | 2187 | return nlmsg_end(skb, nlh); |
@@ -2221,6 +2224,22 @@ next_entry: | |||
2221 | } | 2224 | } |
2222 | e = s_e = 0; | 2225 | e = s_e = 0; |
2223 | } | 2226 | } |
2227 | spin_lock_bh(&mfc_unres_lock); | ||
2228 | list_for_each_entry(mfc, &mrt->mfc_unres_queue, list) { | ||
2229 | if (e < s_e) | ||
2230 | goto next_entry2; | ||
2231 | if (ipmr_fill_mroute(mrt, skb, | ||
2232 | NETLINK_CB(cb->skb).portid, | ||
2233 | cb->nlh->nlmsg_seq, | ||
2234 | mfc) < 0) { | ||
2235 | spin_unlock_bh(&mfc_unres_lock); | ||
2236 | goto done; | ||
2237 | } | ||
2238 | next_entry2: | ||
2239 | e++; | ||
2240 | } | ||
2241 | spin_unlock_bh(&mfc_unres_lock); | ||
2242 | e = s_e = 0; | ||
2224 | s_h = 0; | 2243 | s_h = 0; |
2225 | next_table: | 2244 | next_table: |
2226 | t++; | 2245 | t++; |