[rancid] RANCID no longer working with MikroTik RouterOS 6.49 and 7.1rc3 and 7.1rc4

heasley heas at shrubbery.net
Fri Oct 15 20:56:24 UTC 2021


Fri, Oct 15, 2021 at 01:39:18PM -0700, Michael Ducharme:
> Hello,
> 
> I had a look at your patch and I'm not sure that would fix the issue. Also
> show-sensitive only works with v7 and above and throws an error on RouterOS
> v6.
> 
> Someone on the MikroTik forums found that there is no longer a newline
> being generated after the output so the regexp doesn't match and so RANCID
> no longer identifies the end of the command. You can see more detail here:
> https://forum.mikrotik.com/viewtopic.php?t=179233#p885616

ah, thats a separate problem.  thats fun.  without looking-up that esc
code, looks like some fancy cmdline hanlding.  Maybe this will avoid
that stupidity?

diff --git a/lib/routeros.pm.in b/lib/routeros.pm.in
index 3b1b7dae..4ab9730e 100644
--- a/lib/routeros.pm.in
+++ b/lib/routeros.pm.in
@@ -23,6 +23,8 @@ use rancid @VERSION@;
 
 # load-time initialization
 sub import {
+    $ENV{'TERM'} = "vt100";
+
     $timeo = 90;                       # mtlogin timeout in seconds
 
     0;

or "network" or "dumb", if it has either in its termcap.

> They came up with this patch to fix it and I confirmed that it works with
> RouterOS v6.49 and v7. However I haven't tested with older RouterOS
> versions, and I don't know if it might break something else:

it could match other output unintentionally - maybe.

> --- /usr/libexec/rancid/mtrancid-orig       2021-10-14
> 03:44:22.102333666 +0200+++ /usr/libexec/rancid/mtrancid
> 2021-10-13 07:16:22.567538444 +0200@@ -348,7 +348,7 @@
>         $clean_run=0;
>         last;
>      }
> -    while (/\s*($cmds_regexp)\s*$/) {
> +    while (/\s*($cmds_regexp)\s*/) {
>         $cmd = $1;
>         if (!defined($prompt)) {
>             $prompt = "\] > ";  # crude but effective



More information about the Rancid-discuss mailing list