summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-07-25 03:13:46 +0000
committerbrian <brian@FreeBSD.org>1997-07-25 03:13:46 +0000
commitfa74c6b5cf20bf83ae7fe9dadbdf1c726a49e812 (patch)
treef79a63ff101f8021aa8f994a4e19171a50018210 /sbin
parent651e67a9c67ef527612e2216690de7138e458e5d (diff)
downloadFreeBSD-src-fa74c6b5cf20bf83ae7fe9dadbdf1c726a49e812.zip
FreeBSD-src-fa74c6b5cf20bf83ae7fe9dadbdf1c726a49e812.tar.gz
Allow service names as the divert/tee arg.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipfw/ipfw.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c
index 5c66255..802e5c6 100644
--- a/sbin/ipfw/ipfw.c
+++ b/sbin/ipfw/ipfw.c
@@ -16,7 +16,7 @@
*
* NEW command line interface for IP firewall facility
*
- * $Id: ipfw.c,v 1.44 1997/06/13 06:27:12 charnier Exp $
+ * $Id: ipfw.c,v 1.45 1997/06/23 22:32:13 julian Exp $
*
*/
@@ -807,15 +807,29 @@ add(ac,av)
if (!ac)
show_usage("missing divert port");
rule.fw_divert_port = strtoul(*av, NULL, 0); av++; ac--;
- if (rule.fw_divert_port == 0)
- show_usage("illegal divert port");
+ if (rule.fw_divert_port == 0) {
+ struct servent *s;
+ setservent(1);
+ s = getservbyname(av[-1], "divert");
+ if (s != NULL)
+ rule.fw_divert_port = ntohs(s->s_port);
+ else
+ show_usage("illegal divert port");
+ }
} else if (!strncmp(*av,"tee",strlen(*av))) {
rule.fw_flg |= IP_FW_F_TEE; av++; ac--;
if (!ac)
show_usage("missing divert port");
rule.fw_divert_port = strtoul(*av, NULL, 0); av++; ac--;
- if (rule.fw_divert_port == 0)
- show_usage("illegal divert port");
+ if (rule.fw_divert_port == 0) {
+ struct servent *s;
+ setservent(1);
+ s = getservbyname(av[-1], "divert");
+ if (s != NULL)
+ rule.fw_divert_port = ntohs(s->s_port);
+ else
+ show_usage("illegal divert port");
+ }
} else if (!strncmp(*av,"skipto",strlen(*av))) {
rule.fw_flg |= IP_FW_F_SKIPTO; av++; ac--;
if (!ac)
OpenPOWER on IntegriCloud