From: Andrew Morton <akpm@linux-foundation.org>
To: Steve Wise <swise@opengridcomputing.com>
Cc: kxie@chelsio.com, netdev@vger.kernel.org,
open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, jgarzik@pobox.com,
davem@davemloft.net, michaelc@cs.wisc.edu, rdreier@cisco.com,
daisyc@us.ibm.com, wenxiong@us.ibm.com, bhua@us.ibm.com,
divy@chelsio.com, dm@chelsio.com, leedom@chelsio.com
Subject: Re: [PATCH 1/4 2.6.28] cxgb3 - manage a private ip address for iSCSI
Date: Fri, 22 Aug 2008 12:53:16 -0700 [thread overview]
Message-ID: <20080822125316.37547cce.akpm@linux-foundation.org> (raw)
In-Reply-To: <48AF10BE.9050100@opengridcomputing.com>
On Fri, 22 Aug 2008 14:17:18 -0500
Steve Wise <swise@opengridcomputing.com> wrote:
> Andrew Morton wrote:
> >> + unsigned long octet;
> >> + const char *parse = buf;
> >> + char *endp;
> >> + int i;
> >> +
> >> + for (i = 1; i <= 4; i++) {
> >> + octet = simple_strtoul(parse, &endp, 10);
> >> + if (endp == buf || octet > 255 ||
> >> + (i < 4 && *endp != '.') ||
> >> + (i == 4 && *endp != '\0' && *endp != '\n'))
> >> + return -EINVAL;
> >> + a = (a << 8) | octet;
> >> + parse = endp+1;
> >> + }
> >> + pi->iscsi_ipaddr = htonl(a);
> >> + return endp-buf;
> >> +}
> >>
> >
> > This appears to be taking a dotted quad ipv4 address in ascii form,
> > turning it into a u32 while performing checking?
> >
> > Surely we have a library function somewhere in networking which does
> > this? If not, I'd suggest writing one.
> >
> >
>
> try in_aton() from include/linux/inet.h.
>
yeah. But that function is a crock. No error checking at all!
next prev parent reply other threads:[~2008-08-22 19:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 18:38 [PATCH 1/4 2.6.28] cxgb3 - manage a private ip address for iSCSI Karen Xie
2008-08-22 19:08 ` Andrew Morton
2008-08-22 19:17 ` Steve Wise
2008-08-22 19:53 ` Andrew Morton [this message]
2008-08-22 20:09 ` Steve Wise
2008-08-23 4:55 ` Herbert Xu
-- strict thread matches above, loose matches on Subject: below --
2008-08-28 4:21 Karen Xie
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=20080822125316.37547cce.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bhua@us.ibm.com \
--cc=daisyc@us.ibm.com \
--cc=davem@davemloft.net \
--cc=divy@chelsio.com \
--cc=dm@chelsio.com \
--cc=jgarzik@pobox.com \
--cc=kxie@chelsio.com \
--cc=leedom@chelsio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=netdev@vger.kernel.org \
--cc=open-iscsi@googlegroups.com \
--cc=rdreier@cisco.com \
--cc=swise@opengridcomputing.com \
--cc=wenxiong@us.ibm.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 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).