aboutsummaryrefslogtreecommitdiff
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorFranco Fichtner <franco@opnsense.org>2022-08-08 16:31:02 +0000
committerKristof Provost <kp@FreeBSD.org>2022-08-08 16:31:52 +0000
commit28b64169eace3477abbd50c18163d37c45cf273a (patch)
tree83699c64ac84f04422006a6dc528ea2b58ccb4c3 /sbin/pfctl
parent45add40717c24ef0b5418664fae1718b15a0422b (diff)
downloadsrc-28b64169eace3477abbd50c18163d37c45cf273a.tar.gz
src-28b64169eace3477abbd50c18163d37c45cf273a.zip
pf: stop resolving hosts as dns that use ":" modifier
When the interface does not exist avoid passing host with special pf modifiers to DNS resolution as they come up empty anyway. Reviewed by: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35429
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/pfctl_parser.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index a05683f0cbce..c65fe6abe3f6 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -74,7 +74,7 @@ void print_fromto(struct pf_rule_addr *, pf_osfp_t,
struct pf_rule_addr *, u_int8_t, u_int8_t, int, int);
int ifa_skip_if(const char *filter, struct node_host *p);
-struct node_host *host_if(const char *, int);
+struct node_host *host_if(const char *, int, int *);
struct node_host *host_v4(const char *, int);
struct node_host *host_v6(const char *, int);
struct node_host *host_dns(const char *, int, int);
@@ -1695,7 +1695,7 @@ host(const char *s)
/* interface with this name exists? */
/* expensive with thousands of interfaces - prioritze IPv4/6 check */
- if (cont && (h = host_if(ps, mask)) != NULL)
+ if (cont && (h = host_if(ps, mask, &cont)) != NULL)
cont = 0;
/* dns lookup */
@@ -1711,7 +1711,7 @@ host(const char *s)
}
struct node_host *
-host_if(const char *s, int mask)
+host_if(const char *s, int mask, int *cont)
{
struct node_host *n, *h = NULL;
char *p, *ps;
@@ -1733,6 +1733,7 @@ host_if(const char *s, int mask)
return (NULL);
}
*p = '\0';
+ *cont = 0;
}
if (flags & (flags - 1) & PFI_AFLAG_MODEMASK) { /* Yep! */
fprintf(stderr, "illegal combination of interface modifiers\n");