Community discussions

MikroTik App
 
csurata
just joined
Topic Author
Posts: 17
Joined: Sat May 09, 2020 3:14 am

Hap ax2 7.9rc3 Script error, it was working on hap ac2

Sun Apr 16, 2023 5:34 pm

Hello everyone, everything good?
I'm facing an issue in hap ax2 - where the script doesn't work properly whereas in HAP ac2 it worked perfectly.

Here's the script:

https://gist.github.com/stargieg/1b11d3 ... e6c474d618

# Define User Variables
:global ddnspass "TOKEN"
:global ddnshost "HOSTNAME.dynv6.net"
#:global ddnspool "pool0"
#:global ddnsinterface "bridge"
#:global ddnsinterface "6to4-henet"
#:global ddnsinterface "pppoe-out1"
#:global ddnsinterface "ether1"

# Define Global Variables
:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }


# Define Local Variables
:local int

# Loop thru interfaces and look for ones containing
# default gateways without routing-marks
:if ([ :typeof $ddnsinterface ] != "str" ) do={
:foreach int in=[ /ipv6 address find global ] do={
:local testip [ /ipv6 address get $int address ]
:if ($testip in "fe80::/10" || $testip in "fc00::/7") do={
} else={
:global ddnsip $testip
}
}
} else={
:if ([ :typeof $ddnspool ] != "str" ) do={
# Grab the current Global IP address on that interface.
:foreach int in=[ /ipv6 address find interface=$ddnsinterface global ] do={
:local testip [ /ipv6 address get $int address ]
:if ($testip in "fe80::/10" || $testip in "fc00::/7") do={
} else={
:global ddnsip $testip
}
}
} else={
# Grab the current Global IP address on that interface from spec ip pool.
:global ddnsip [ /ipv6 address get [ /ipv6 address find interface=$ddnsinterface from-pool=$ddnspool ] address ]
}
}

# Did we get an IP address to compare?
:if ([ :typeof $ddnsip ] = nil ) do={
:log info ("DynDNS: No ip address present on please check.")
} else={
:log info ("DynDNS: check IPv6 UPDATE " . $ddnsip)
:if ($ddnsip != $ddnslastip) do={
:log info "DynDNS: Sending IPv6 UPDATE!"
:local str "api/update\?hostname=$ddnshost&ipv6=$ddnsip&token=$ddnspass"
/tool fetch address="dynv6.com" host="dynv6.com" src-path="$str" mode=https dst-path=("/dynv6.".$ddnshost)
:delay 1
:local str [/file find name="dynv6.$ddnshost"];
/file remove $str
:global ddnslastip $ddnsip
}
}

I performed some tests and apparently the error is in this part:

:local str "api/update\?hostname=$ddnshost&ipv6=$ddnsip&token=$ddnspass"
/tool fetch address="dynv6.com" host="dynv6.com" src-path="$str" mode=https dst-path=("/dynv6.".$ddnshost)

Is there any bug or adaptation for ARM64 architecture (hap ax2)?
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3253
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Hap ax2 7.9rc3 Script error, it was working on hap ac2

Sun Apr 16, 2023 5:48 pm

I performed some tests and apparently the error is in this part:
:local str "api/update\?hostname=$ddnshost&ipv6=$ddnsip&token=$ddnspass"
/tool fetch address="dynv6.com" host="dynv6.com" src-path="$str" mode=https dst-path=("/dynv6.".$ddnshost)

Just a guess... the \? isn't need in the problematic line. In V7, the ? doesn't require escaping; while, in V6 it was the help operator (which is F1 in V7).

:local str "api/update?hostname=$ddnshost&ipv6=$ddnsip&token=$ddnspass"
 
csurata
just joined
Topic Author
Posts: 17
Joined: Sat May 09, 2020 3:14 am

Re: Hap ax2 7.9rc3 Script error, it was working on hap ac2  [SOLVED]

Tue Apr 18, 2023 8:32 pm

Thanks a lot for the answer, the solution was in the reconfiguration of the apis keys in dynv6 and the HAP ax2 executed the script . Thanks

Who is online

Users browsing this forum: almdandi and 25 guests