npf
                                
                                
                                
                                    npf copied to clipboard
                            
                            
                            
                        Incorrect parsing near keyword "apply"
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!
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.