summaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorCamiel Dobbelaar <camield@cvs.openbsd.org>2005-05-23 21:29:51 +0000
committerCamiel Dobbelaar <camield@cvs.openbsd.org>2005-05-23 21:29:51 +0000
commit063fc8e0305977e98cbac3e0eb6b4fdfdaef52f2 (patch)
tree00170046b7e894112bd218e70d956c984886e2b5 /sbin/pfctl
parentefb89e6aa3b8be186e66bf2c337449c9b126b3cc (diff)
remove code that duplicates getservice()
ok dhartmei mcbride
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/parse.y28
1 files changed, 5 insertions, 23 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 136c8d4af28..38273ffe940 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.484 2005/05/21 21:03:58 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.485 2005/05/23 21:29:50 camield Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -2428,31 +2428,13 @@ port_item : port {
port : STRING {
char *p = strchr($1, ':');
- struct servent *s = NULL;
- u_long ulval;
if (p == NULL) {
- if (atoul($1, &ulval) == 0) {
- if (ulval > 65535) {
- free($1);
- yyerror("illegal port value %lu",
- ulval);
- YYERROR;
- }
- $$.a = htons(ulval);
- } else {
- s = getservbyname($1, "tcp");
- if (s == NULL)
- s = getservbyname($1, "udp");
- if (s == NULL) {
- yyerror("unknown port %s", $1);
- free($1);
- YYERROR;
- }
- $$.a = s->s_port;
+ if (($$.a = getservice($1)) == -1) {
+ free($1);
+ YYERROR;
}
- $$.b = 0;
- $$.t = 0;
+ $$.b = $$.t = 0;
} else {
int port[2];