last night i realized that MKT does not have Option 39 in dhcp v6 client
so, here it is script implementation
Code: Select all
#ascii chars
:local ascii1 ("0123456789")
:local ascii2 ("abcdefghijklmnopqrstuvwxyz")
:local ascii3 ("-")
:local ascii ($ascii1 . $ascii2 . $ascii3)
#ascii values
:local val1 "30,31,32,33,34,35,36,37,38,39,"
:local val2 "61,62,63,64,65,66,67,68,69,6a,6b,6c,6d,6e,6f,70,71,72,73,74,75,76,77,78,79,7a,"
:local val3 "2d"
:local val [:toarray ($val1 . $val2 . $val3)]
#hex chars
:local hex "0123456789ABCDEF"
:local hn [/system identity get name]
:local hnld [:len $hn]
:global hout ""
:global tmp ""
:local cnt 0
:for pc from 0 to ($hnld-1) do={
:local chr [:pick $hn $pc]
:if ($chr != "." ) do={
:local pa [:find $ascii $chr]
:local hv [:pick $val $pa]
:set tmp ( $tmp . $hv )
:set cnt ($cnt + 1)
} else {
:local hnlh [:pick $hex $cnt]
:set hout ( $hout . "0" . $hnlh . $tmp)
:set cnt 0
:set tmp ""
}
}
:local hnlh [:pick $hex $cnt]
:set hout ( $hout . "0" . $hnlh . $tmp)
:local out ( "0x01" . $hout . "00")
:log info "$hn -> $out"
/ipv6 dhcp-client option set 0 value=$out code=39 name=option39
so, only 0-9, a-z , hyphen and dot
OpenWRT odhcpd work well with this script, and wireshark dump confirm that packet is valid
so, mikrotik name is visible in DHCPv6 server
if someone want to improve / clean / rewrite this script ...