From owner-svn-src-stable-9@FreeBSD.ORG Thu May 8 18:06:45 2014 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A2F4DD15; Thu, 8 May 2014 18:06:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F637F49; Thu, 8 May 2014 18:06:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s48I6jTm075142; Thu, 8 May 2014 18:06:45 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s48I6jsH075141; Thu, 8 May 2014 18:06:45 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201405081806.s48I6jsH075141@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Thu, 8 May 2014 18:06:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r265692 - stable/9/sbin/ipfw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2014 18:06:45 -0000 Author: melifaro Date: Thu May 8 18:06:44 2014 New Revision: 265692 URL: http://svnweb.freebsd.org/changeset/base/265692 Log: Merge r258677. Fix key lookup in ipfw(8) broken since r232865. Print warning for IPv4 address strings which are valid in inet_aton() but not valid in inet_pton(). (1) Found by: Özkan KIRIK Submitted by: Ian Smith (1) Modified: stable/9/sbin/ipfw/ipfw2.c Directory Properties: stable/9/sbin/ (props changed) stable/9/sbin/ipfw/ (props changed) Modified: stable/9/sbin/ipfw/ipfw2.c ============================================================================== --- stable/9/sbin/ipfw/ipfw2.c Thu May 8 17:27:46 2014 (r265691) +++ stable/9/sbin/ipfw/ipfw2.c Thu May 8 18:06:44 2014 (r265692) @@ -4263,13 +4263,24 @@ table_fill_xentry(char *arg, ipfw_table_ addrlen = sizeof(struct in6_addr); } else { /* Port or any other key */ - key = strtol(arg, &p, 10); /* Skip non-base 10 entries like 'fa1' */ - if (p != arg) { + key = strtol(arg, &p, 10); + if (*p == '\0') { pkey = (uint32_t *)paddr; *pkey = htonl(key); type = IPFW_TABLE_CIDR; + masklen = 32; addrlen = sizeof(uint32_t); + } else if ((p != arg) && (*p == '.')) { + /* + * Warn on IPv4 address strings + * which are "valid" for inet_aton() but not + * in inet_pton(). + * + * Typical examples: '10.5' or '10.0.0.05' + */ + errx(EX_DATAERR, + "Invalid IPv4 address: %s", arg); } } }