summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2017-05-24 09:01:54 +0000
committerae <ae@FreeBSD.org>2017-05-24 09:01:54 +0000
commitc9bf380cdc6cd74a7fd4e3b9cb4333d056580ff5 (patch)
tree7779a52aa040cd764d38b92abef0808157a9251a
parentb034ff356e0477e6ea7cc534acf5fee15cfb4ce5 (diff)
downloadFreeBSD-src-c9bf380cdc6cd74a7fd4e3b9cb4333d056580ff5.zip
FreeBSD-src-c9bf380cdc6cd74a7fd4e3b9cb4333d056580ff5.tar.gz
MFC r318400:
Allow zero port specification in table entries with type flow. PR: 217620
-rw-r--r--sbin/ipfw/tables.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c
index bc0c61b..9aad4d9 100644
--- a/sbin/ipfw/tables.c
+++ b/sbin/ipfw/tables.c
@@ -1260,16 +1260,14 @@ tentry_fill_key_type(char *arg, ipfw_obj_tentry *tentry, uint8_t type,
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_tentry *tentry, uint8_t type,
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;
}
OpenPOWER on IntegriCloud