luckman212/pf_fwrule_toggle

Rule not found by description when omitting `filter`

Closed this issue · 3 comments

TFWol commented

Example:

Does not work
php -q fwrule_toggle.php -d 'test rule' toggle
Result: no matching rules found

Works
php -q fwrule_toggle.php -d 'test rule' filter toggle

Not a bug, just a quirk of the syntax because I'm not using a "real" arg parser. If you want to explicitly specify an action (toggle, or enable etc) then you must specify nat or filter as positional param 3. Technically you could pass an empty arg '' as well, like this:

php -q fwrule_toggle.php -d 'test rule' '' toggle

If you just want to toggle, you can omit everything after the rule description, since toggle is the default action:

php -q fwrule_toggle.php -d 'test rule'

I might try to improve the parser in the future, but for now I don't have much time to work on this.

TFWol commented

No problem. I just put in an Issue since it didn't seem to work as the readme suggested, so I wanted to let you know.
I had explicitly specified the filter when I saw it wasn't working.

Really like the script you've made since it isn't all that invasive.
Too bad pfSense doesn't give us a native API.

Thanks. I updated the README to clarify. Closing this for now.