summaryrefslogtreecommitdiff
path: root/sys/net/pf_if.c
diff options
context:
space:
mode:
authorPhilipp Buehler <pb@cvs.openbsd.org>2004-04-28 02:43:10 +0000
committerPhilipp Buehler <pb@cvs.openbsd.org>2004-04-28 02:43:10 +0000
commitfbc3da186093d0f377959cbb178704df3df7fbbf (patch)
treeb125686ba91f29f28d0cc7ea1252db065034584e /sys/net/pf_if.c
parent0109542fc439ac9a11f415a835810794b4c3aeb2 (diff)
Dont step into INET6 code, just because af != AF_INET
Also comment #endif properly while being here ok mcbride@
Diffstat (limited to 'sys/net/pf_if.c')
-rw-r--r--sys/net/pf_if.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
index cdc6e36962f..77c5f06b6cd 100644
--- a/sys/net/pf_if.c
+++ b/sys/net/pf_if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_if.c,v 1.11 2004/03/15 11:38:23 cedric Exp $ */
+/* $OpenBSD: pf_if.c,v 1.12 2004/04/28 02:43:09 pb Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -430,14 +430,14 @@ pfi_instance_add(struct ifnet *ifp, int net, int flags)
}
if (af == AF_INET)
got4 = 1;
- else
+ else if (af == AF_INET6)
got6 = 1;
net2 = net;
if (net2 == 128 && (flags & PFI_AFLAG_NETWORK)) {
if (af == AF_INET) {
net2 = pfi_unmask(&((struct sockaddr_in *)
ia->ifa_netmask)->sin_addr);
- } else {
+ } else if (af == AF_INET6) {
net2 = pfi_unmask(&((struct sockaddr_in6 *)
ia->ifa_netmask)->sin6_addr);
}
@@ -816,7 +816,9 @@ pfi_dohooks(struct pfi_kif *p)
int
pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af)
{
- if (af == AF_INET) {
+ switch (af) {
+#ifdef INET
+ case AF_INET:
switch (dyn->pfid_acnt4) {
case 0:
return (0);
@@ -826,7 +828,10 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af)
default:
return (pfr_match_addr(dyn->pfid_kt, a, AF_INET));
}
- } else {
+ break;
+#endif /* INET */
+#ifdef INET6
+ case AF_INET6:
switch (dyn->pfid_acnt6) {
case 0:
return (0);
@@ -836,5 +841,9 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af)
default:
return (pfr_match_addr(dyn->pfid_kt, a, AF_INET6));
}
+ break;
+#endif /* INET6 */
+ default:
+ return (0);
}
}