summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcamield <camield@openbsd.org>2005-05-23 21:29:50 +0000
committercamield <camield@openbsd.org>2005-05-23 21:29:50 +0000
commit96163da686b71c59283e31ca13b9fbd8d589bff2 (patch)
treeb819247711617ff4a723ac2fa20766744d1b01a0
parentsuspected airprime pc5220 EVDO support (diff)
downloadwireguard-openbsd-96163da686b71c59283e31ca13b9fbd8d589bff2.tar.xz
wireguard-openbsd-96163da686b71c59283e31ca13b9fbd8d589bff2.zip
remove code that duplicates getservice()
ok dhartmei mcbride
-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];