summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2008-05-09 05:41:01 +0000
committermarkus <markus@openbsd.org>2008-05-09 05:41:01 +0000
commit782435eaec1348a74c8ee231099b3dc55ee766cc (patch)
tree59ffb37e9acf61e8fa848dc6515be270aad83808
parent- don't give up when the link is not available on startup: dhclient (diff)
downloadwireguard-openbsd-782435eaec1348a74c8ee231099b3dc55ee766cc.tar.xz
wireguard-openbsd-782435eaec1348a74c8ee231099b3dc55ee766cc.zip
convert port byte order in the production; add port keyword; ok deraadt@
-rw-r--r--regress/sbin/pfctl/pf97.in6
-rw-r--r--regress/sbin/pfctl/pf97.ok6
-rw-r--r--sbin/pfctl/parse.y10
-rw-r--r--sbin/pfctl/pfctl_parser.c4
4 files changed, 13 insertions, 13 deletions
diff --git a/regress/sbin/pfctl/pf97.in b/regress/sbin/pfctl/pf97.in
index 8f3d9415a96..c9aad6e935a 100644
--- a/regress/sbin/pfctl/pf97.in
+++ b/regress/sbin/pfctl/pf97.in
@@ -1,4 +1,4 @@
-pass in on em0 inet proto tcp from any to any port 220:230 divert-to 127.0.0.1 22
+pass in on em0 inet proto tcp from any to any port 220:230 divert-to 127.0.0.1 port 22
pass out on em0 inet proto tcp from any to any port 220:230 divert-reply
-pass in on em0 inet proto 103 divert-to 127.0.0.1 103
-pass on em0 inet proto tcp from any to any port 80 divert-to 127.0.0.1 8080
+pass on em0 inet proto tcp from any to any port 80 divert-to 127.0.0.1 port 8080
+pass in on em0 inet proto 103 divert-to 127.0.0.1 port 103 # FIXME
diff --git a/regress/sbin/pfctl/pf97.ok b/regress/sbin/pfctl/pf97.ok
index 66377f1c422..f81acb2d023 100644
--- a/regress/sbin/pfctl/pf97.ok
+++ b/regress/sbin/pfctl/pf97.ok
@@ -1,4 +1,4 @@
-pass in on em0 inet proto tcp from any to any port 220:230 flags S/SA keep state divert-to 127.0.0.1 22
+pass in on em0 inet proto tcp from any to any port 220:230 flags S/SA keep state divert-to 127.0.0.1 port 22
pass out on em0 inet proto tcp from any to any port 220:230 flags S/SA keep state divert-reply
-pass in on em0 inet proto pim all keep state divert-to 127.0.0.1 103
-pass on em0 inet proto tcp from any to any port = www flags S/SA keep state divert-to 127.0.0.1 8080
+pass on em0 inet proto tcp from any to any port = www flags S/SA keep state divert-to 127.0.0.1 port 8080
+pass in on em0 inet proto pim all keep state divert-to 127.0.0.1 port 103
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 2c4a2ce81d7..044405a8352 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.544 2008/05/09 02:44:54 markus Exp $ */
+/* $OpenBSD: parse.y,v 1.545 2008/05/09 05:41:01 markus Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -2182,7 +2182,7 @@ pfrule : action dir logquick interface route af proto fromto
}
free($9.queues.pqname);
}
- if ((r.divert.port = htons($9.divert.port))) {
+ if ((r.divert.port = $9.divert.port)) {
if (r.direction == PF_OUT) {
if ($9.divert.addr) {
yyerror("address specified "
@@ -2322,7 +2322,7 @@ filter_opt : USER uids {
}
filter_opts.rtableid = $2;
}
- | DIVERTTO STRING number {
+ | DIVERTTO STRING PORT number {
if ((filter_opts.divert.addr = host($2)) == NULL) {
yyerror("could not parse divert address: %s",
$2);
@@ -2330,9 +2330,9 @@ filter_opt : USER uids {
YYERROR;
}
free($2);
- filter_opts.divert.port = $3;
+ filter_opts.divert.port = htons($4);
if (!filter_opts.divert.port) {
- yyerror("invalid divert port: %d", $3);
+ yyerror("invalid divert port: %d", $4);
YYERROR;
}
}
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 932eb357b0f..2194b7a7a63 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.237 2008/05/09 02:44:55 markus Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.238 2008/05/09 05:41:01 markus Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -996,7 +996,7 @@ print_rule(struct pf_rule *r, const char *anchor_call, int verbose)
printf("?");
else
printf("%s", buf);
- printf(" %u", ntohs(r->divert.port));
+ printf(" port %u", ntohs(r->divert.port));
}
}
if (!anchor_call[0] && (r->action == PF_NAT ||