Date: Thu, 12 Nov 2009 14:22:12 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r199223 - head/sys/contrib/rdma/krping Message-ID: <200911121422.nACEMCAA032694@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Thu Nov 12 14:22:12 2009 New Revision: 199223 URL: http://svn.freebsd.org/changeset/base/199223 Log: Remove the explicit definition of inet_aton() as it was introduced as a general function in r199208. Reported by: np Sponsored by: Sandvine Incorporated MFC: 1 week Modified: head/sys/contrib/rdma/krping/krping.c Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Thu Nov 12 13:09:36 2009 (r199222) +++ head/sys/contrib/rdma/krping/krping.c Thu Nov 12 14:22:12 2009 (r199223) @@ -112,109 +112,6 @@ struct krping_cb_list krping_cbs; #define RPING_BUFSIZE 128*1024 #define RPING_SQ_DEPTH 32 - -/* lifted from netinet/libalias/alias_proxy.c */ -static int inet_aton(const char *cp, struct in_addr *addr); -static int -inet_aton(cp, addr) - const char *cp; - struct in_addr *addr; -{ - u_long parts[4]; - in_addr_t val; - const char *c; - char *endptr; - int gotend, n; - - c = (const char *)cp; - n = 0; - /* - * Run through the string, grabbing numbers until - * the end of the string, or some error - */ - gotend = 0; - while (!gotend) { - unsigned long l; - - l = strtoul(c, &endptr, 0); - - if (l == ULONG_MAX || (l == 0 && endptr == c)) - return (0); - - val = (in_addr_t)l; - /* - * If the whole string is invalid, endptr will equal - * c.. this way we can make sure someone hasn't - * gone '.12' or something which would get past - * the next check. - */ - if (endptr == c) - return (0); - parts[n] = val; - c = endptr; - - /* Check the next character past the previous number's end */ - switch (*c) { - case '.' : - /* Make sure we only do 3 dots .. */ - if (n == 3) /* Whoops. Quit. */ - return (0); - n++; - c++; - break; - - case '\0': - gotend = 1; - break; - - default: - if (isspace((unsigned char)*c)) { - gotend = 1; - break; - } else - return (0); /* Invalid character, so fail */ - } - - } - - /* - * Concoct the address according to - * the number of parts specified. - */ - - switch (n) { - case 0: /* a -- 32 bits */ - /* - * Nothing is necessary here. Overflow checking was - * already done in strtoul(). - */ - break; - case 1: /* a.b -- 8.24 bits */ - if (val > 0xffffff || parts[0] > 0xff) - return (0); - val |= parts[0] << 24; - break; - - case 2: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 3: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff || - parts[2] > 0xff) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - - if (addr != NULL) - addr->s_addr = htonl(val); - return (1); -} - - static void krping_wait(struct krping_cb *cb, int state) { int rc;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911121422.nACEMCAA032694>