Commit graph

751 commits

Author SHA1 Message Date
Christian Hesse
c3f27bf776 ppp-on-up: fix variable handling
The variable $interface is not a name but a reference... Basically
this worked only because of the oddity - the filter did not work
and *all* dhcp-clients were disabled and enabled.
2019-01-04 13:02:34 +01:00
Christian Hesse
870f00bb36 global: variable names are CamelCase
___  _         ___     __
           / _ )(_)__ _   / _/__ _/ /_
          / _  / / _ `/  / _/ _ `/ __/
         /____/_/\_, /  /_/ \_,_/\__/
 _       __     /___/       _             __
| |     / /___ __________  (_)___  ____ _/ /
| | /| / / __ `/ ___/ __ \/ / __ \/ __ `/ /
| |/ |/ / /_/ / /  / / / / / / / / /_/ /_/
|__/|__/\__,_/_/  /_/ /_/_/_/ /_/\__, (_)
                                /____/

RouterOS has some odd behavior when it comes to variable names. Let's
have a look at the interfaces:

[admin@MikroTik] > / interface print where name=en1
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  RS en1                                 ether            1500  1598

That looks ok. Now we use a script:

{ :local interface "en1";
  / interface print where name=$interface; }

And the result...

[admin@MikroTik] > { :local interface "en1";
{...   / interface print where name=$interface; }
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  RS en1                                 ether            1500  1598

... still looks ok.
We make a little modification to the script:

{ :local name "en1";
  / interface print where name=$name; }

And the result:

[admin@MikroTik] > { :local name "en1";
{...   / interface print where name=$name; }
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU
 0  RS en1                                 ether            1500  1598
 1   S en2                                 ether            1500  1598
 2   S en3                                 ether            1500  1598
 3   S en4                                 ether            1500  1598
 4   S en5                                 ether            1500  1598
 5  R  br-local                            bridge           1500  1598

Ups! The filter has no effect!
That happens whenever the variable name ($name) matches the property
name (name=).

And another modification:

{ :local type "en1";
  / interface print where name=$type; }

And the result:

[admin@MikroTik] > { :local type "en1";
{...   / interface print where name=$type; }
Flags: D - dynamic, X - disabled, R - running, S - slave
 #     NAME                                TYPE       ACTUAL-MTU L2MTU

Ups! Nothing?
Even if the variable name ($type) matches whatever property name (type=)
things go wrong.

The answer from MikroTik support (in Ticket#2019010222000454):

> This is how scripting works in RouterOS and we will not fix it.

To get around this we use variable names in CamelCase. Let's hope
Mikrotik never ever introduces property names in CamelCase...

*fingers crossed*
2019-01-04 12:35:34 +01:00
Christian Hesse
7d06a7e8c2 global-{config,functions}: move variables, make independent 2019-01-03 16:09:03 +01:00
Christian Hesse
6e03a3b935 script-updates: add configuration versioning 2019-01-03 15:36:26 +01:00
Christian Hesse
0f72662745 dhcp-to-dns: give time in short format
Note that a unit is required to make it a time value!
2019-01-03 10:28:23 +01:00
Christian Hesse
93a6bff312 daily-psk-schedule: give time in short format
Note that a unit is required to make it a time value!
2019-01-03 10:23:02 +01:00
Christian Hesse
fe04b8b8db rename script 'check-lte-firmware-update' -> 'check-lte-firmware-upgrade'
That's the correct wording from commands..
2019-01-02 22:50:23 +01:00
Christian Hesse
e2b5124e8c add script 'unattended-lte-firmware-upgrade' 2019-01-02 22:50:23 +01:00
Christian Hesse
29a363649d add template for script documentation 2019-01-02 21:31:59 +01:00
Christian Hesse
99e92340bc README: add link to scroll up 2019-01-02 21:04:54 +01:00
Christian Hesse
7f7a9d8c89 ignore all html files 2019-01-02 16:26:32 +01:00
Christian Hesse
dfa750a7f5 Makefile: update links for generated html 2019-01-02 16:22:14 +01:00
Christian Hesse
e27a4e8f0e Makefile: update for extended functionality
This can handle new and multiple markdown files.
2019-01-02 15:41:00 +01:00
Christian Hesse
bc36fb74c3 update-tunnelbroker: verify certificate 2019-01-02 15:02:42 +01:00
Michael Gisbers
ca16f286ef update-tunnelbroker: move configuration to global-config...
... and get the external ip address from cloud.

Signed-off-by: Michael Gisbers <michael@gisbers.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
2019-01-02 15:02:42 +01:00
Michael Gisbers
69e76f5ecc capsman-download-packages: use upgrade command to force remote-cap upgrade
Signed-off-by: Michael Gisbers <michael@gisbers.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
2019-01-02 15:02:42 +01:00
Christian Hesse
688c757df0 check-routeros-update: be more verbose on error 2019-01-02 15:02:42 +01:00
Christian Hesse
a19f15c515 check-routeros-update: do not fail if safe-update-url return error
We still want the notification...
2019-01-02 15:02:42 +01:00
Christian Hesse
472cd3d905 update copyright for 2019 2019-01-02 09:38:34 +01:00
Christian Hesse
3cdd0fb94b global-functions: properly define global functions 2018-12-28 22:56:29 +01:00
Christian Hesse
ea55464434 global-functions: update comment in $SendNotification 2018-12-28 22:56:29 +01:00
Christian Hesse
ac2e6cfc61 global-functions: add $DownloadPackage
... and make script 'capsman-download-packages' use it.
2018-12-28 22:56:07 +01:00
Christian Hesse
30166cc287 capsman-download-packages: move condition to loop 2018-12-28 18:50:22 +01:00
Christian Hesse
58d105da00 remove script 'remove-packages'
Use script 'capsman-download-packages' to download and
cleanup packages...
2018-12-27 21:50:17 +01:00
Christian Hesse
1131d8ee41 capsman-download-packages: act in package-path only 2018-12-27 21:42:30 +01:00
Christian Hesse
0ecb0749fd capsman-download-packages: do not restart service...
... but disconnect old CAPs and force reconnect with update.
2018-12-27 21:36:31 +01:00
Michael Gisbers
e1f5f7254a capsman-download-packages: rewrite package-name from wireless@ to wireless
Signed-off-by: Michael Gisbers <michael@gisbers.de>
Signed-off-by: Christian Hesse <mail@eworm.de>
2018-12-27 21:32:00 +01:00
Christian Hesse
ecc475af3e add script 'capsman-download-packages' 2018-12-27 02:19:27 +01:00
Christian Hesse
ee5eefefc3 global-functions: add $GetMacVendor 2018-12-27 00:48:56 +01:00
Christian Hesse
2505e5d42f remove-packages: delay if uptime less than one minute 2018-12-21 11:38:04 +01:00
Christian Hesse
f4673928ef global-functions: make $CertificateAvailable work on CommonName
This should prevent endless certificate switching for Let's Encrypt
cross-signed intermediate certificates.
2018-12-20 22:21:00 +01:00
Christian Hesse
abdc9b0cbd README: add Root CA certificate DST Root CA X3
This is used by Let's Encrypt to cross-sign.
2018-12-20 17:25:23 +01:00
Christian Hesse
44be3d8d07 check-certificates: support auto-renew of certificates 2018-12-20 15:55:40 +01:00
Christian Hesse
ee49fe3184 update-gre-address: remove settings from global-config
Instead read infos from gre interface comment.
2018-12-19 17:22:36 +01:00
Christian Hesse
9f077ab8bf ipv6-update: remove settings from global-config
Instead make it more robust by reading comments.
2018-12-19 16:48:34 +01:00
Christian Hesse
6f606f9ca5 email-backup: support cloud backup 2018-12-18 22:48:28 +01:00
Christian Hesse
be68c739a8 README: add initial commands for copy and paste 2018-12-18 21:47:47 +01:00
Christian Hesse
f97b45b5b8 check-lte-firmware-update: strip the extra line break 2018-12-17 11:36:41 +01:00
Christian Hesse
9346df67d7 add script 'check-lte-firmware-update' 2018-12-14 23:04:18 +01:00
Christian Hesse
b8830ee6a5 collect-wireless-mac: send the mac's vendor part only 2018-12-14 12:48:01 +01:00
Christian Hesse
eda89ba643 collect-wireless-mac: get and record the vendor 2018-12-14 12:35:06 +01:00
Christian Hesse
65283ce76d email-backup: try without delay 2018-12-13 09:15:00 +01:00
Christian Hesse
a0fb616715 remove extra dollar sign 2018-12-12 21:57:17 +01:00
Christian Hesse
dee4495c0c email-backup: send backup and config export in one mail 2018-12-12 21:54:29 +01:00
Christian Hesse
587fef5451 email-backup: export terse 2018-12-12 21:32:50 +01:00
Christian Hesse
6e4d715937 global-functions: add identity tag in $SendNotification
... and send subject in telegram message.
2018-11-28 21:19:39 +01:00
Christian Hesse
c4f8c1ad52 global-config: add identity tag 2018-11-26 13:45:02 +01:00
Christian Hesse
cdb85460bd ip-addr-bridge: ignore bridges without ports
Bridges are used for loopback... Assume we do not want to disable
addresses if the bridge has no ports.
2018-11-26 11:12:24 +01:00
Christian Hesse
015f8e01b5 global-config: sort sms-action alphabetically 2018-11-13 10:20:45 +01:00
Christian Hesse
e17389749f global-config: add more examples for mode button and sms-action 2018-11-13 10:20:14 +01:00