svn commit: r318777 - stable/11/sbin/ipfw

Andrey V. Elsukov ae at FreeBSD.org
Wed May 24 09:01:56 UTC 2017


Author: ae
Date: Wed May 24 09:01:54 2017
New Revision: 318777
URL: https://svnweb.freebsd.org/changeset/base/318777

Log:
  MFC r318400:
    Allow zero port specification in table entries with type flow.
  
    PR:		217620

Modified:
  stable/11/sbin/ipfw/tables.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/tables.c
==============================================================================
--- stable/11/sbin/ipfw/tables.c	Wed May 24 06:49:01 2017	(r318776)
+++ stable/11/sbin/ipfw/tables.c	Wed May 24 09:01:54 2017	(r318777)
@@ -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));
+			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;
 		}
 


More information about the svn-src-all mailing list