svn commit: r203369 - user/luigi/ipfw3-head/sbin/ipfw
Luigi Rizzo
luigi at FreeBSD.org
Tue Feb 2 07:39:56 UTC 2010
Author: luigi
Date: Tue Feb 2 07:39:56 2010
New Revision: 203369
URL: http://svn.freebsd.org/changeset/base/203369
Log:
the man page says inet_pton returns 1 on success and 0 on errors,
but it does not specify if other return values are possible.
So be strict and only use 1 as success, instead of anything != 0
as it was done before (this caused bugs under windows)
Modified:
user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c
Modified: user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c
==============================================================================
--- user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Tue Feb 2 05:57:42 2010 (r203368)
+++ user/luigi/ipfw3-head/sbin/ipfw/ipfw2.c Tue Feb 2 07:39:56 2010 (r203369)
@@ -2535,11 +2535,11 @@ add_src(ipfw_insn *cmd, char *av, u_char
*ch = '\0';
if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 ||
- inet_pton(AF_INET6, host, &a))
+ inet_pton(AF_INET6, host, &a) == 1)
ret = add_srcip6(cmd, av);
/* XXX: should check for IPv4, not !IPv6 */
if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 ||
- !inet_pton(AF_INET6, host, &a)))
+ inet_pton(AF_INET6, host, &a) != 1))
ret = add_srcip(cmd, av);
if (ret == NULL && strcmp(av, "any") != 0)
ret = cmd;
@@ -2561,11 +2561,11 @@ add_dst(ipfw_insn *cmd, char *av, u_char
*ch = '\0';
if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 ||
- inet_pton(AF_INET6, host, &a))
+ inet_pton(AF_INET6, host, &a) == 1)
ret = add_dstip6(cmd, av);
/* XXX: should check for IPv4, not !IPv6 */
if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 ||
- !inet_pton(AF_INET6, host, &a)))
+ inet_pton(AF_INET6, host, &a) != 1))
ret = add_dstip(cmd, av);
if (ret == NULL && strcmp(av, "any") != 0)
ret = cmd;
More information about the svn-src-user
mailing list