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

Special dummy fasttrack counters rule #36

Open
gaztelugatxe opened this issue Apr 21, 2018 · 3 comments
Open

Special dummy fasttrack counters rule #36

gaztelugatxe opened this issue Apr 21, 2018 · 3 comments

Comments

@gaztelugatxe
Copy link

Commands that should work such as:

$util->setMenu('/ip firewall filter');
$util->disable();

don't work when the special dummy rule to show fasttrack counters is present. PHP throws this error:

PEAR2\Net\RouterOS\RouterErrorException: Error when disabling items in /var/www/html/pru/PEAR2_Net_RouterOS-1.0.0b6/src/PEAR2/Net/RouterOS/Util.php:634 
Stack trace: #0 /var/www/html/pru/ros_4_fw.php(73): PEAR2\Net\RouterOS\Util->disable() #1 {main} 
Response collection: Array ( [0] => PEAR2\Net\RouterOS\Response Object ( [unrecognizedWords:protected] => Array ( ) [_type:PEAR2\Net\RouterOS\Response:private] => !trap [attributes:protected] => Array ( [message] => failure: cannot change builtin ) [_tag:PEAR2\Net\RouterOS\Message:private] => ) [1] => PEAR2\Net\RouterOS\Response Object ( [unrecognizedWords:protected] => Array ( ) [_type:PEAR2\Net\RouterOS\Response:private] => !done [attributes:protected] => Array ( ) [_tag:PEAR2\Net\RouterOS\Message:private] => ) ) `

If we skip that first dummy rule, for example:

$util->disable(1);

no error happens and the rule is correctly disabled.

@boenrobot
Copy link
Member

boenrobot commented Apr 21, 2018

As you can see, this is an error message originating from the router. It is normal, and is the case even on the command line (try f.e. /ip firewall filter disable [find] and see the same error message appear).

If you want to disable all of "your" rules, you should instead target all rules that are not dynamic. Dynamic rules are removed when the thing that created them is disabled or removed. In the case of the dummy fasttrack rules, there's no such option, but at least the rule is always dynamic.

So f.e.

$util->setMenu('/ip firewall filter');
$util->disable(RouterOS\Query::where('dynamic', 'false'));

and the equivalent in CLI being /ip firewall filter disable [find where dynamic=no].

@gaztelugatxe
Copy link
Author

Thanks for the fast answer.

Yes, I understand is not a bug, but the

$util->disable(RouterOS\Query::where('dynamic', 'false'));

still throws an error, so I'll keep on trying things.

@boenrobot
Copy link
Member

boenrobot commented Apr 21, 2018

Oh... crap... testing this now, I'm seeing the query failing is actually the effect of bug #34... Already fixed, but the new version is not released yet.

If you're using Composer, you can get it now by using "dev-develop" as your version vector. Or if you're using an extracted archive (as your error message seems to indicate), you can get an unpackaged zip (i.e. one that does NOT include dependencies) from here, and merge the new files with the old ones, replacing the original ones.

There are some more things I'd like to get around to before I make a new tagged and packaged release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants