From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, junwei.zhang@6wind.com,
hongjun.li@6wind.com, Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [PATCH net-next 1/2] ipv4: provide addr and netconf dump consistency info
Date: Fri, 22 Mar 2013 15:42:39 +0100 [thread overview]
Message-ID: <1363963360-3603-1-git-send-email-nicolas.dichtel@6wind.com> (raw)
This patch takes benefit of dev_addr_genid and dev_base_seq to check if a change
occurs during a netlink dump. If a change is detected, the flag NLM_F_DUMP_INTR
is set in the first message after the dump was interrupted.
Reported-by: Junwei Zhang <junwei.zhang@6wind.com>
Reported-by: Hongjun Li <hongjun.li@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
net/ipv4/devinet.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index af57bba..158ca5e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1499,6 +1499,8 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
idx = 0;
head = &net->dev_index_head[h];
rcu_read_lock();
+ cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^
+ net->dev_base_seq;
hlist_for_each_entry_rcu(dev, head, index_hlist) {
if (idx < s_idx)
goto cont;
@@ -1519,6 +1521,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
rcu_read_unlock();
goto done;
}
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
}
cont:
idx++;
@@ -1808,6 +1811,8 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb,
idx = 0;
head = &net->dev_index_head[h];
rcu_read_lock();
+ cb->seq = atomic_read(&net->ipv4.dev_addr_genid) ^
+ net->dev_base_seq;
hlist_for_each_entry_rcu(dev, head, index_hlist) {
if (idx < s_idx)
goto cont;
@@ -1825,6 +1830,7 @@ static int inet_netconf_dump_devconf(struct sk_buff *skb,
rcu_read_unlock();
goto done;
}
+ nl_dump_check_consistent(cb, nlmsg_hdr(skb));
cont:
idx++;
}
--
1.8.0.1
next reply other threads:[~2013-03-22 14:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 14:42 Nicolas Dichtel [this message]
2013-03-22 14:42 ` [PATCH net-next 2/2] ipv6: provide addr and netconf dump consistency info Nicolas Dichtel
2013-03-22 16:22 ` Nicolas Dichtel
2013-03-22 16:28 ` [PATCH net-next v2 1/2] ipv4: " Nicolas Dichtel
2013-03-22 16:28 ` [PATCH net-next v2 2/2] ipv6: " Nicolas Dichtel
2013-03-24 21:16 ` [PATCH net-next v2 1/2] ipv4: " David Miller
-- strict thread matches above, loose matches on Subject: below --
2013-03-22 14:45 [PATCH iproute2] libnetlink: check flag NLM_F_DUMP_INTR during dumps Nicolas Dichtel
2013-03-22 14:59 ` Eric Dumazet
2013-03-22 15:03 ` Nicolas Dichtel
2013-03-22 15:14 ` Eric Dumazet
2013-03-22 15:22 ` Thomas Graf
2013-03-22 15:42 ` [PATCH iproute2 v2] " Nicolas Dichtel
2013-03-22 15:49 ` Eric Dumazet
2013-03-22 16:34 ` [PATCH iproute2 v3] " Nicolas Dichtel
2013-03-24 21:17 ` [PATCH net-next v2 2/2] ipv6: provide addr and netconf dump consistency info David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363963360-3603-1-git-send-email-nicolas.dichtel@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=davem@davemloft.net \
--cc=hongjun.li@6wind.com \
--cc=junwei.zhang@6wind.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).