From nobody Mon Aug 22 07:21:06 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MB3gQ38ZYz4b4WW; Mon, 22 Aug 2022 07:21:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MB3gQ2SW4z3Nvk; Mon, 22 Aug 2022 07:21:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661152866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NCxmZeYTkqWJr+oK9DEsuxAaWHqFVDzhNDTwSRjGYBY=; b=jNwT8kBSisJ1NK2XdUN3sJ3S8U/Qt3cEmFHOEq1x0okMkA7EpI0fcqTdUqS0JuBpI8JPwc CGr6ar3sousVOidAoY+vBg8kTWdVwl/xBr6mWsSas+b/SNmJO+ruiiC4ftfw3wmK3xqeCU cMpYRpFvAPdUVoPgXQY6x+vXfT6Jh/hVylg+gcl2SX5HnFzubD+iM5ojoRvLryO425bv0v ibvbhfkM5OcC+vQRHb9N1P+ssjaNQmbuc41XUE1+IHKIYPqcBrpXqvYZJjupeMpIkh6sAZ CYNJiU8NEJsSXkuO8RRZrpxzeRAGP+75usgU4Exj1v9lk8hKcMvNc1yb67DLFw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MB3gQ19NVzhBH; Mon, 22 Aug 2022 07:21:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27M7L60Z088229; Mon, 22 Aug 2022 07:21:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27M7L60u088228; Mon, 22 Aug 2022 07:21:06 GMT (envelope-from git) Date: Mon, 22 Aug 2022 07:21:06 GMT Message-Id: <202208220721.27M7L60u088228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2e9bba56219c - stable/13 - pf: stop resolving hosts as dns that use ":" modifier List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e9bba56219ca524b69b52b71886abe48036fa5c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661152866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NCxmZeYTkqWJr+oK9DEsuxAaWHqFVDzhNDTwSRjGYBY=; b=ToOsEBXqcMSJxmvWX+t937tSJ5zvslJm6Tl4Q7xgCk8VGJG2U32IBL2Ii27GYdXmfVeNVv k/VXhjshR1MI10Q//Jdop+OVDEmqlWA2Q8FXyNzd89GX0HbkpI4+Y/P0pW2C3Na2S2rBxY ZsWQNrW8FOAPudB8frdcp+3gPFw1nvngBAv7vcRTuylaeinbWkjEpz6aNa9bJ5zBL5Z9aw cfFkucbKo4z8VF/ZFQNV1gYsSXAyaODe9F8V+GqLbnrIYHkifu4UeZM2z9nmWIeuK0il9f rOf8eLoROSEZuMtritsfSkM0VNr5xQGVtFT4D46Xt/CvZAJO8B5x90OyoOrfYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661152866; a=rsa-sha256; cv=none; b=irNG1o+SaqicFr4Es613mINlSzqgHrq6L8j3smktoITsz+zSmaQLx4T3PubdXwAaoGuQlh 70SgQtHrfofVXqjqtrv5sCkvlBiAhDQwGFyFPObSN6iq0wKKqHNQ1j3QrFkzuK0Qsnia6n xqIJotXl8vfE4/gLqn7UR6DS8R7qcAktO/dQX9Igd0ycKgFLejG6aXU51tU9N63mH0xQss BycmTbzSrEXqRY5CszGxt5kuFgjS+lh5CTY/A7hu00xsQMMZuRPI7HLvDEZgBdIsC1cf0E qDsdJ4wpnBLPOu6lFYRVJSzZpwJ52vlBSM6klf3efSUEhwTXb8DhNk6RyMnEPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2e9bba56219ca524b69b52b71886abe48036fa5c commit 2e9bba56219ca524b69b52b71886abe48036fa5c Author: Franco Fichtner AuthorDate: 2022-08-08 16:31:02 +0000 Commit: Kristof Provost CommitDate: 2022-08-22 06:55:27 +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 (cherry picked from commit 28b64169eace3477abbd50c18163d37c45cf273a) --- 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 8537d2933dc8..d22d7fe12375 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); @@ -1575,7 +1575,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 */ @@ -1591,7 +1591,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; @@ -1613,6 +1613,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");