From: Tetsuo Takata <takata.tetsuo@oss.ntt.co.jp>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Stephen Hemminger <shemminger@osdl.org>,
bonding-devel@lists.sourceforge.net, netdev@vger.kernel.org,
takatatt@intellilink.co.jp
Subject: Re: [PATCH] bonding: enhance the IP address check of arp_ip_target
Date: Wed, 12 Jul 2006 18:30:40 +0900 [thread overview]
Message-ID: <44B4C140.5040403@oss.ntt.co.jp> (raw)
In-Reply-To: <E1G0X8h-0003Tg-00@gondolin.me.apana.org.au>
Hi,
Thank you for the comments.
>> Why not just use sscanf?
Here's a fixed version of the previous patch, that uses sscanf.
>
> Better yet, use a better interface like netlink rather than module
> parameters.
Wouldn't that be overkill?
best regards,
---
Signed-off-by: Tetsuo Takata <takatatt@intellilink.co.jp>
--- linux-2.6.17.4/drivers/net/bonding/bond_main.c 2006-06-18 10:49:35.000000000 +0900
+++ linux-2.6.17.4-enhance-ipcheck/drivers/net/bonding/bond_main.c 2006-07-12 17:20:39.000000000 +0900
@@ -4455,7 +4455,36 @@ static int bond_check_params(struct bond
arp_ip_count++) {
/* not complete check, but should be good enough to
catch mistakes */
- if (!isdigit(arp_ip_target[arp_ip_count][0])) {
+ int ip1, ip2, ip3, ip4, notip = 0;
+ char dummy;
+
+ /* notip's number means error code for debug purpose */
+ do {
+ if (sscanf(arp_ip_target[arp_ip_count], "%d.%d.%d.%d%c",
+ &ip1, &ip2, &ip3, &ip4, &dummy) != 4) {
+ notip = 1;
+ break;
+ } else {
+ if (ip1 < 0 || ip1 > 255) {
+ notip = 1;
+ break;
+ }
+ if (ip2 < 0 || ip2 > 255) {
+ notip = 1;
+ break;
+ }
+ if (ip3 < 0 || ip3 > 255) {
+ notip = 1;
+ break;
+ }
+ if (ip4 < 0 || ip4 > 255) {
+ notip = 1;
+ break;
+ }
+ }
+ } while(0);
+
+ if (notip) {
printk(KERN_WARNING DRV_NAME
": Warning: bad arp_ip_target module parameter "
"(%s), ARP monitoring will not be performed\n",
prev parent reply other threads:[~2006-07-12 9:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-12 4:25 [PATCH] bonding: enhance the IP address check of arp_ip_target Tetsuo Takata
2006-07-12 4:53 ` Stephen Hemminger
2006-07-12 5:19 ` Herbert Xu
2006-07-12 9:30 ` Tetsuo Takata [this message]
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=44B4C140.5040403@oss.ntt.co.jp \
--to=takata.tetsuo@oss.ntt.co.jp \
--cc=bonding-devel@lists.sourceforge.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.org \
--cc=takatatt@intellilink.co.jp \
/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.