Bug 242044 - pf can't load rules with newline at end.
Summary: pf can't load rules with newline at end.
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-pf (Nobody)
Depends on:
Reported: 2019-11-18 03:21 UTC by sasamotikomi
Modified: 2019-11-23 18:27 UTC (History)
1 user (show)

See Also:

pf failed config (30 bytes, text/plain)
2019-11-23 01:14 UTC, sasamotikomi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description sasamotikomi 2019-11-18 03:21:27 UTC
Remove newline at end of file and your rules will fail.
Comment 1 Kristof Provost freebsd_committer 2019-11-18 16:08:32 UTC
Can you attach an example failing pf.conf file?

If I understand you correctly you're saying that a ruleset which doesn't have an endline on the last line does not work.
I wouldn't consider that to be a bug.
Comment 2 sasamotikomi 2019-11-23 01:14:46 UTC
Created attachment 209352 [details]
pf failed config

Example of not working rules.
Comment 3 Kristof Provost freebsd_committer 2019-11-23 18:27:08 UTC
Does your pfctl not warn about this?

On CURRENT and on 11.3 pfctl produces this error message for me:
> pf_no_endl.conf:2: syntax error
> pfctl: Syntax error in config file: pf rules not loaded

Given that I don't consider this to be a bug. That's a malformed pf.conf which the code is appropriately rejecting and warning about.