From owner-svn-src-user@FreeBSD.ORG Tue Feb 2 07:39:56 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62BBD106566C; Tue, 2 Feb 2010 07:39:56 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52A218FC12; Tue, 2 Feb 2010 07:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o127duVB012267; Tue, 2 Feb 2010 07:39:56 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o127duhd012265; Tue, 2 Feb 2010 07:39:56 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201002020739.o127duhd012265@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Feb 2010 07:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203369 - user/luigi/ipfw3-head/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Feb 2010 07:39:56 -0000 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;