Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect parsing near keyword "apply" #68

Open
Biogen opened this issue Feb 1, 2020 · 1 comment
Open

Incorrect parsing near keyword "apply" #68

Biogen opened this issue Feb 1, 2020 · 1 comment
Assignees
Labels

Comments

@Biogen
Copy link

Biogen commented Feb 1, 2020

Hello,

When I create a new rule for ruleset with apply "log" via npfctl I get an error: syntax error near 'log'
Example:

# npfctl rule "test" add pass all apply "log"
stdin:1:18: syntax error near 'log'

npf.conf:

procedure "log" {
    log: npflog0
}

group default {
    ruleset "test"
    pass all apply "log"
}

Also, I face to this problem when try to create the same rule by npfctl API.
How can I solve this problem?
Thank you!

@rmind rmind self-assigned this Feb 6, 2020
@rmind
Copy link
Owner

rmind commented Jun 6, 2020

Currently, npfctl parser requires strings to be in double quotes, meaning that apply "log" is valid, while apply log is not. Since the rule is passed from shell, its interpreter consumes the quotes. You need to escape the quotes or pass the expression as a literal, e.g.:

npfctl rule "test" add 'pass all apply "log"'

This is not an NPF bug. The npfctl parser could be relaxed to not require the quotes for strings, but I tend to think it is not worth doing that.

@rmind rmind added the not-bug label Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants