From owner-svn-src-head@freebsd.org Thu May 18 00:49:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C94CED70769; Thu, 18 May 2017 00:49:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B9201DEF; Thu, 18 May 2017 00:49:43 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v4I0nZnJ063722; Wed, 17 May 2017 17:49:35 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v4I0nZa1063721; Wed, 17 May 2017 17:49:35 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201705180049.v4I0nZa1063721@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r318400 - head/sbin/ipfw In-Reply-To: <201705171056.v4HAuMOV078812@repo.freebsd.org> To: "Andrey V. Elsukov" Date: Wed, 17 May 2017 17:49:34 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 00:49:44 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: ae > Date: Wed May 17 10:56:22 2017 > New Revision: 318400 > URL: https://svnweb.freebsd.org/changeset/base/318400 > > Log: > Allow zero port specification in table entries with type flow. > > PR: 217620 > MFC after: 1 week > > Modified: > head/sbin/ipfw/tables.c > > Modified: head/sbin/ipfw/tables.c > ============================================================================== > --- head/sbin/ipfw/tables.c Wed May 17 09:04:09 2017 (r318399) > +++ head/sbin/ipfw/tables.c Wed May 17 10:56:22 2017 (r318400) > @@ -1260,16 +1260,14 @@ tentry_fill_key_type(char *arg, ipfw_obj > if ((p = strchr(arg, ',')) != NULL) > *p++ = '\0'; > > - if ((port = htons(strtol(arg, NULL, 10))) == 0) { > + port = htons(strtol(arg, &pp, 10)); ^^^ Can this be converted to a sizeof(foo) somehow? Constants like this are typically bad style and lead to bugs. > + if (*pp != '\0') { > if ((sent = getservbyname(arg, NULL)) == NULL) > errx(EX_DATAERR, "Unknown service: %s", > arg); > - else > - key = sent->s_port; > + port = sent->s_port; > } > - > tfe->sport = port; > - > arg = p; > } > > @@ -1304,16 +1302,14 @@ tentry_fill_key_type(char *arg, ipfw_obj > if ((p = strchr(arg, ',')) != NULL) > *p++ = '\0'; > > - if ((port = htons(strtol(arg, NULL, 10))) == 0) { > + port = htons(strtol(arg, &pp, 10)); > + if (*pp != '\0') { > if ((sent = getservbyname(arg, NULL)) == NULL) > errx(EX_DATAERR, "Unknown service: %s", > arg); > - else > - key = sent->s_port; > + port = sent->s_port; > } > - > tfe->dport = port; > - > arg = p; > } > > > -- Rod Grimes rgrimes@freebsd.org