From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Nikolay Aleksandrov <nikolay@redhat.com>
Cc: netdev@vger.kernel.org, fubar@us.ibm.com, andy@greyhouse.net,
davem@davemloft.net
Subject: Re: [PATCH v2 3/4] bonding: arp_ip_count and arp_targets can be wrong
Date: Sun, 19 May 2013 01:28:38 +0400 [thread overview]
Message-ID: <5197F286.1070505@cogentembedded.com> (raw)
In-Reply-To: <1368875911-4952-4-git-send-email-nikolay@redhat.com>
Hello.
On 18-05-2013 15:18, Nikolay Aleksandrov wrote:
> When getting arp_ip_targets if we encounter a bad IP, arp_ip_count still
> gets increased and all the targets after the wrong one will not be probed
> if arp_interval is enabled after that (unless a new IP target is added
> through sysfs) because of the zero entry, in this case reading
> arp_ip_target through sysfs will show valid targets even if there's a
> zero entry.
> Example: 1.2.3.4,4.5.6.7,blah,5.6.7.8
> When retrieving the list from arp_ip_target the output would be:
> 1.2.3.4,4.5.6.7,5.6.7.8
> but there will be a 0 entry between 4.5.6.7 and 5.6.7.8. If arp_interval
> is enabled after that 5.6.7.8 will never be checked because of that.
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
> ---
> drivers/net/bonding/bond_main.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 1a0cc13..d6a96cb 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
[...]
> @@ -4650,19 +4650,18 @@ static int bond_check_params(struct bond_params *params)
> arp_interval = BOND_LINK_ARP_INTERV;
> }
>
> - for (arp_ip_count = 0;
> - (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[arp_ip_count];
> - arp_ip_count++) {
> + for (arp_ip_count = 0, i = 0;
> + (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) {
> /* not complete check, but should be good enough to
> catch mistakes */
> - __be32 ip = in_aton(arp_ip_target[arp_ip_count]);
> - if (!isdigit(arp_ip_target[arp_ip_count][0]) ||
> - ip == 0 || ip == htonl(INADDR_BROADCAST)) {
> + __be32 ip = in_aton(arp_ip_target[i]);
Empty line wouldn't hurt here, after declaration.
> + if (!isdigit(arp_ip_target[i][0]) || ip == 0 ||
> + ip == htonl(INADDR_BROADCAST)) {
next prev parent reply other threads:[~2013-05-18 21:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-18 11:18 [PATCH v2 0/4] bonding: race and inconsistency fixes Nikolay Aleksandrov
2013-05-18 11:18 ` [PATCH v2 1/4] bonding: fix set mode race conditions Nikolay Aleksandrov
2013-05-18 11:18 ` [PATCH v2 2/4] bonding: replace %x with %pI4 for IPv4 addresses Nikolay Aleksandrov
2013-05-18 11:18 ` [PATCH v2 3/4] bonding: arp_ip_count and arp_targets can be wrong Nikolay Aleksandrov
2013-05-18 21:28 ` Sergei Shtylyov [this message]
2013-05-18 11:18 ` [PATCH v2 4/4] bonding: fix multiple 3ad mode sysfs race conditions Nikolay Aleksandrov
2013-05-20 6:26 ` [PATCH v2 0/4] bonding: race and inconsistency fixes 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=5197F286.1070505@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.