Bug 201520 - Wrong Error Line Number Given by PF syntax checker
Summary: Wrong Error Line Number Given by PF syntax checker
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.3-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-pf (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-13 10:20 UTC by Davide Davini
Modified: 2018-11-18 11:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Davide Davini 2015-07-13 10:20:57 UTC
PF syntax parser counts macro lines splited using "\" as a single line.

To reproduce the issue:
# cat -n pf.test
     1  internal_net="{ 192.168.0.0/24 \
     2  192.168.1.0/24 192.168.2.0/24 }"
     3
     4  pass in on em0 \
     5  from a to b
# pfctl -nf pf.test
no IP address found for a
pf.test:4: could not parse host specification

Ref: https://forums.freebsd.org/threads/wrong-error-line-number-given-by-pf-syntax-checker.52121/#post-292829
Comment 1 Davide Davini 2015-07-13 10:23:26 UTC
I forgot to mention it effects 9.3-RELEASE and 10.1-RELEASE. I don't know about stable and current.
Comment 2 Davide Davini 2015-07-13 10:38:06 UTC
Someone pointed out to me the example is misleading.

This one is much clearer.
# cat -n pf.test
     1  internal_net="{ 192.168.0.0/24 \
     2          192.168.1.0/24 \
     3          192.168.2.0/24 }"
     4
     5  pass in on em0 from a to b
     6
# pfctl -nf pf.test
no IP address found for a
pf.test:3: could not parse host specification
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-10-22 04:13:51 UTC
A commit references this bug:

Author: kp
Date: Mon Oct 22 04:12:51 UTC 2018
New revision: 339578
URL: https://svnweb.freebsd.org/changeset/base/339578

Log:
  pfctl: Fix line numbers when \ is used inside ""

  PR:		201520
  Obtained from:	OpenBSD
  MFC after:	2 weeks

Changes:
  head/sbin/pfctl/parse.y
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-11-18 10:54:45 UTC
A commit references this bug:

Author: kp
Date: Sun Nov 18 10:54:39 UTC 2018
New revision: 340560
URL: https://svnweb.freebsd.org/changeset/base/340560

Log:
  MFC r339578:

  pfctl: Fix line numbers when \ is used inside ""

  PR:		201520
  Obtained from:	OpenBSD

Changes:
_U  stable/11/
  stable/11/sbin/pfctl/parse.y
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-11-18 10:55:48 UTC
A commit references this bug:

Author: kp
Date: Sun Nov 18 10:54:47 UTC 2018
New revision: 340561
URL: https://svnweb.freebsd.org/changeset/base/340561

Log:
  MFC r339578:

  pfctl: Fix line numbers when \ is used inside ""

  PR:		201520
  Obtained from:	OpenBSD

Changes:
_U  stable/12/
  stable/12/sbin/pfctl/parse.y