summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-07 18:26:56 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-06-07 18:26:56 +0000
commite9b97c0925e9948eacd86b28344a5bcf41ab881d (patch)
treeec40d85791784d0c0a83b602273e21279d69c8c4
parentf61c113f05903d75c0c5267e5cc94f84c6dbf88f (diff)
make IPv6 scope identification work for dst (from any to fe80::1%lo0)
-rw-r--r--sbin/pfctl/parse.y14
1 files changed, 9 insertions, 5 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index ae774f5750c..c2a44435168 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.72 2002/06/07 18:24:33 itojun Exp $ */
+/* $OpenBSD: parse.y,v 1.73 2002/06/07 18:26:55 itojun Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -1632,17 +1632,21 @@ expand_rule(struct pf_rule *r,
(src_host->ifindex && dst_host->ifindex &&
src_host->ifindex != dst_host->ifindex) ||
(src_host->ifindex && if_nametoindex(interface->ifname) &&
- src_host->ifindex != if_nametoindex(interface->ifname)))
+ src_host->ifindex != if_nametoindex(interface->ifname)) ||
+ (dst_host->ifindex && if_nametoindex(interface->ifname) &&
+ dst_host->ifindex != if_nametoindex(interface->ifname)))
continue;
if (!r->af && src_host->af)
r->af = src_host->af;
else if (!r->af && dst_host->af)
r->af = dst_host->af;
- if (if_indextoname(src_host->ifindex, ifname) == 0)
- memcpy(r->ifname, interface->ifname, sizeof(r->ifname));
- else
+ if (if_indextoname(src_host->ifindex, ifname))
+ memcpy(r->ifname, ifname, sizeof(r->ifname));
+ else if (if_indextoname(dst_host->ifindex, ifname))
memcpy(r->ifname, ifname, sizeof(r->ifname));
+ else
+ memcpy(r->ifname, interface->ifname, sizeof(r->ifname));
r->proto = proto->proto;
r->src.addr = src_host->addr;
r->src.mask = src_host->mask;