Bug 201520

Summary: Wrong Error Line Number Given by PF syntax checker
Product: Base System Reporter: Davide Davini <diotonante>
Component: kernAssignee: freebsd-pf (Nobody) <pf>
Status: Closed FIXED    
Severity: Affects Many People CC: kp
Priority: ---    
Version: 9.3-RELEASE   
Hardware: Any   
OS: Any   

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