From 57c5c3f7049c0d60340c7fa66cb85cc2d5b65e78 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 20 Sep 2023 12:26:49 +0200 Subject: collect-wireless-mac: add CNAME(s) in notification --- collect-wireless-mac.capsman.rsc | 8 ++++++-- collect-wireless-mac.local.rsc | 8 ++++++-- collect-wireless-mac.template.rsc | 8 ++++++-- collect-wireless-mac.wifiwave2.rsc | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/collect-wireless-mac.capsman.rsc b/collect-wireless-mac.capsman.rsc index f21fc46..f421a53 100644 --- a/collect-wireless-mac.capsman.rsc +++ b/collect-wireless-mac.capsman.rsc @@ -18,6 +18,7 @@ :global EitherOr; :global FormatLine; +:global FormatMultiLines; :global GetMacVendor; :global LogPrintExit2; :global ScriptLock; @@ -58,7 +59,10 @@ $ScriptLock $0 false 10; :set DnsName "no dns name"; :local DnsRec ([ /ip/dns/static/find where address=$Address ]->0); :if ([ :len $DnsRec ] > 0) do={ - :set DnsName [ /ip/dns/static/get $DnsRec name ]; + :set DnsName ({ [ /ip/dns/static/get $DnsRec name ] }); + :foreach CName in=[ /ip/dns/static/find where cname=($DnsName->0) ] do={ + :set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]); + } } } :local DateTime ([ /system/clock/get date ] . " " . [ /system/clock/get time ]); @@ -77,7 +81,7 @@ $ScriptLock $0 false 10; [ $FormatLine "Vendor" $Vendor ] . "\n" . \ [ $FormatLine "Hostname" $HostName ] . "\n" . \ [ $FormatLine "Address" $Address ] . "\n" . \ - [ $FormatLine "DNS name" $DnsName ] . "\n" . \ + [ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \ [ $FormatLine "Date" $DateTime ]) }); } } else={ diff --git a/collect-wireless-mac.local.rsc b/collect-wireless-mac.local.rsc index 6bc8f45..99f8d3b 100644 --- a/collect-wireless-mac.local.rsc +++ b/collect-wireless-mac.local.rsc @@ -18,6 +18,7 @@ :global EitherOr; :global FormatLine; +:global FormatMultiLines; :global GetMacVendor; :global LogPrintExit2; :global ScriptLock; @@ -58,7 +59,10 @@ $ScriptLock $0 false 10; :set DnsName "no dns name"; :local DnsRec ([ /ip/dns/static/find where address=$Address ]->0); :if ([ :len $DnsRec ] > 0) do={ - :set DnsName [ /ip/dns/static/get $DnsRec name ]; + :set DnsName ({ [ /ip/dns/static/get $DnsRec name ] }); + :foreach CName in=[ /ip/dns/static/find where cname=($DnsName->0) ] do={ + :set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]); + } } } :set ($RegVal->"ssid") [ /interface/wireless/get [ find where name=($RegVal->"interface") ] ssid ]; @@ -78,7 +82,7 @@ $ScriptLock $0 false 10; [ $FormatLine "Vendor" $Vendor ] . "\n" . \ [ $FormatLine "Hostname" $HostName ] . "\n" . \ [ $FormatLine "Address" $Address ] . "\n" . \ - [ $FormatLine "DNS name" $DnsName ] . "\n" . \ + [ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \ [ $FormatLine "Date" $DateTime ]) }); } } else={ diff --git a/collect-wireless-mac.template.rsc b/collect-wireless-mac.template.rsc index df6b831..a584c79 100644 --- a/collect-wireless-mac.template.rsc +++ b/collect-wireless-mac.template.rsc @@ -19,6 +19,7 @@ :global EitherOr; :global FormatLine; +:global FormatMultiLines; :global GetMacVendor; :global LogPrintExit2; :global ScriptLock; @@ -73,7 +74,10 @@ $ScriptLock $0 false 10; :set DnsName "no dns name"; :local DnsRec ([ /ip/dns/static/find where address=$Address ]->0); :if ([ :len $DnsRec ] > 0) do={ - :set DnsName [ /ip/dns/static/get $DnsRec name ]; + :set DnsName ({ [ /ip/dns/static/get $DnsRec name ] }); + :foreach CName in=[ /ip/dns/static/find where cname=($DnsName->0) ] do={ + :set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]); + } } } :set ($RegVal->"ssid") [ /interface/wireless/get [ find where name=($RegVal->"interface") ] ssid ]; @@ -95,7 +99,7 @@ $ScriptLock $0 false 10; [ $FormatLine "Vendor" $Vendor ] . "\n" . \ [ $FormatLine "Hostname" $HostName ] . "\n" . \ [ $FormatLine "Address" $Address ] . "\n" . \ - [ $FormatLine "DNS name" $DnsName ] . "\n" . \ + [ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \ [ $FormatLine "Date" $DateTime ]) }); } } else={ diff --git a/collect-wireless-mac.wifiwave2.rsc b/collect-wireless-mac.wifiwave2.rsc index 42713a6..04e65e8 100644 --- a/collect-wireless-mac.wifiwave2.rsc +++ b/collect-wireless-mac.wifiwave2.rsc @@ -18,6 +18,7 @@ :global EitherOr; :global FormatLine; +:global FormatMultiLines; :global GetMacVendor; :global LogPrintExit2; :global ScriptLock; @@ -58,7 +59,10 @@ $ScriptLock $0 false 10; :set DnsName "no dns name"; :local DnsRec ([ /ip/dns/static/find where address=$Address ]->0); :if ([ :len $DnsRec ] > 0) do={ - :set DnsName [ /ip/dns/static/get $DnsRec name ]; + :set DnsName ({ [ /ip/dns/static/get $DnsRec name ] }); + :foreach CName in=[ /ip/dns/static/find where cname=($DnsName->0) ] do={ + :set DnsName ($DnsName, [ /ip/dns/static/get $CName name ]); + } } } :local DateTime ([ /system/clock/get date ] . " " . [ /system/clock/get time ]); @@ -77,7 +81,7 @@ $ScriptLock $0 false 10; [ $FormatLine "Vendor" $Vendor ] . "\n" . \ [ $FormatLine "Hostname" $HostName ] . "\n" . \ [ $FormatLine "Address" $Address ] . "\n" . \ - [ $FormatLine "DNS name" $DnsName ] . "\n" . \ + [ $FormatMultiLines "DNS name" $DnsName ] . "\n" . \ [ $FormatLine "Date" $DateTime ]) }); } } else={ -- cgit v1.2.3-70-g09d2