Page MenuHomeFreeBSD

D46088.id141366.diff
No OneTemporary

D46088.id141366.diff

diff --git a/sbin/pfctl/pfctl.8 b/sbin/pfctl/pfctl.8
--- a/sbin/pfctl/pfctl.8
+++ b/sbin/pfctl/pfctl.8
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 20, 2023
+.Dd July 23, 2024
.Dt PFCTL 8
.Os
.Sh NAME
@@ -531,6 +531,8 @@
flag.
Comments starting with a
.Sq #
+or
+.Sq \;
are allowed in the text file.
With these commands, the
.Fl v
diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c
--- a/sbin/pfctl/pfctl_radix.c
+++ b/sbin/pfctl/pfctl_radix.c
@@ -534,8 +534,8 @@
/* skip spaces */
while (isspace(next_ch) && !feof(fp))
next_ch = fgetc(fp);
- /* remove from '#' until end of line */
- if (next_ch == '#')
+ /* remove from '#' or ';' until end of line */
+ if (next_ch == '#' || next_ch == ';')
while (!feof(fp)) {
next_ch = fgetc(fp);
if (next_ch == '\n')
diff --git a/sbin/pfctl/tests/files/pf1020.in b/sbin/pfctl/tests/files/pf1020.in
new file mode 100644
--- /dev/null
+++ b/sbin/pfctl/tests/files/pf1020.in
@@ -0,0 +1,3 @@
+table <tabl1> file "./pf1020.include"
+
+block from <tabl1>
diff --git a/sbin/pfctl/tests/files/pf1020.include b/sbin/pfctl/tests/files/pf1020.include
new file mode 100644
--- /dev/null
+++ b/sbin/pfctl/tests/files/pf1020.include
@@ -0,0 +1,4 @@
+; comment1
+# comment2
+1.0.0.1/32 ; comment1
+2.0.0.2/32 # comment2
diff --git a/sbin/pfctl/tests/files/pf1020.ok b/sbin/pfctl/tests/files/pf1020.ok
new file mode 100644
--- /dev/null
+++ b/sbin/pfctl/tests/files/pf1020.ok
@@ -0,0 +1,2 @@
+table <tabl1> file "./pf1020.include"
+block drop from <tabl1> to any
diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc
--- a/sbin/pfctl/tests/pfctl_test_list.inc
+++ b/sbin/pfctl/tests/pfctl_test_list.inc
@@ -128,3 +128,4 @@
PFCTL_TEST(1017, "Ethernet rule with ridentifier and several labels")
PFCTL_TEST(1018, "Test dynamic address mask")
PFCTL_TEST(1019, "Test pflow option")
+PFCTL_TEST(1020, "Test hashmark and semicolon comment")

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 29, 9:18 PM (6 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17846603
Default Alt Text
D46088.id141366.diff (2 KB)

Event Timeline