The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=28b64169eace3477abbd50c18163d37c45cf273a

commit 28b64169eace3477abbd50c18163d37c45cf273a
Author:     Franco Fichtner <fra...@opnsense.org>
AuthorDate: 2022-08-08 16:31:02 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2022-08-08 16:31:52 +0000

    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
---
 sbin/pfctl/pfctl_parser.c | 7 ++++---
 1 file 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");

Reply via email to