ericpaulbishop / gargoyle

Gargoyle Router Management Utility
http://www.gargoyle-router.com
468 stars 221 forks source link

Saving IPv6 suffix in DHCP #954

Closed mickeyreg closed 2 years ago

mickeyreg commented 2 years ago

Hi,

If DHCP server for IPv6 is configured then I can write IPv6 Suffix in the form "::32". With this short sufix everything works fine, value 32 is saved to configuration file. But if I want to set "::32:32" than value 3232 is written to the configration file. If I really want to set this value I need to write "::32:0032". It could be acceptable, but when the configuration file is read, then value 320032 is read properly and in the form text "::32:32" is displayed and after saving it is coverted to 3232 so after the next read in the form we have "::3232". I hope somebody understood me :)

Ok. I wanted to try change it alone and I changed the file /www/js/dhcp.js in my router. On GitHub it is the file: /package/gargoyle/files/www/js/dhcp.js. I've changed (lines 79-82):

if(hostid != "-")
{
    uci.set("dhcp",cfgid,"hostid",hostid.replace(/:/g,""));
}

to:

if (hostid != "-") {
    var elements = hostid.split(":");
    var idlen = elements.length;
    if (idlen == 4) {
        ucihostid = elements[2] + ("0000" + elements[3]).slice(-4);
    } else {
        ucihostid = hostid.replace(/:/g, "");
    }
    uci.set("dhcp", cfgid, "hostid", ucihostid)
}

Maybe it does not look well, but seems to work properly :)

Regards, Mickey

lantis1008 commented 2 years ago

Thanks very much for reporting this and providing a solution!