Skip to content

Commit

Permalink
rc: Fix for IPv6-PD subnet requests
Browse files Browse the repository at this point in the history
Allows requesting bigger IPv6 subnets(/60, /56 & /48) from your ISP.
  • Loading branch information
RMerl committed Mar 8, 2022
1 parent 86a9ff6 commit faf82c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 10 additions & 4 deletions release/src/router/rc/udhcpc.c
Expand Up @@ -1695,12 +1695,15 @@ bound6(char *wan_ifname, int bound)
goto skip;

prefix_changed = (!nvram_match(ipv6_nvname("ipv6_prefix"), addr) ||
nvram_get_int(ipv6_nvname("ipv6_prefix_length")) != size);
nvram_get_int(ipv6_nvname("ipv6_prefix_len_wan")) != size);
if (prefix_changed) {
eval("ip", "-6", "addr", "flush", "scope", "global", "dev", lan_ifname);
nvram_set(ipv6_nvname("ipv6_rtr_addr"), "");
nvram_set(ipv6_nvname("ipv6_prefix"), addr);
nvram_set_int(ipv6_nvname("ipv6_prefix_length"), size);
nvram_set_int(ipv6_nvname("ipv6_prefix_length"), 64);
logmessage("dhcp6 client", "WAN Prefix Size Requested:/%d, Received:/%d",
nvram_get_int(ipv6_nvname("ipv6_prefix_len_wan")), size);
nvram_set_int(ipv6_nvname("ipv6_prefix_len_wan"), size);
}
if (*addr)
add_ip6_lanaddr();
Expand Down Expand Up @@ -1985,7 +1988,7 @@ start_dhcp6c(void)
struct duid duid;
char duid_arg[sizeof(duid)*2+1];
char prefix_arg[sizeof("128:xxxxxxxx")];
int service;
int service, i;
#ifdef RTCONFIG_SOFTWIRE46
int wan_proto;
#endif
Expand Down Expand Up @@ -2031,7 +2034,10 @@ start_dhcp6c(void)
((unsigned long)(duid.ea[3] & 0x0f) << 16) |
((unsigned long)(duid.ea[4]) << 8) |
((unsigned long)(duid.ea[5])) : 1;
snprintf(prefix_arg, sizeof(prefix_arg), "%d:%lx", 0, iaid);
i = (nvram_get_int(ipv6_nvname("ipv6_prefix_len_wan")) ? : 64);
if ((i < 48) || (i > 64))
i = 0;
snprintf(prefix_arg, sizeof(prefix_arg), "%d:%lx", i, iaid);
dhcp6c_argv[index++] = "-P";
dhcp6c_argv[index++] = prefix_arg;
}
Expand Down
4 changes: 4 additions & 0 deletions release/src/router/www/Advanced_IPv61_Content.asp
Expand Up @@ -489,10 +489,14 @@ function showInputfield2(s, v){
inputCtrl(document.form.ipv61_prefix_length, enable);
if(enable){
document.getElementById("ipv61_wan_setting").style.display="none";
inputCtrl(document.form.ipv61_prefix_len_wan, enable);
document.getElementById("ipv61_ipaddr_r").style.display = "none";
document.getElementById("ipv61_prefix_length_r").style.display = "none";
}else{
document.getElementById("ipv61_wan_setting").style.display="";
inputCtrl(document.form.ipv61_prefix_len_wan, !enable);
document.getElementById("ipv61_ipaddr_r").style.display = "";
document.getElementById("ipv61_prefix_length_r").style.display = "";
document.getElementById("ipv61_prefix_length_span").innerHTML = "";
Expand Down
4 changes: 4 additions & 0 deletions release/src/router/www/Advanced_IPv6_Content.asp
Expand Up @@ -599,9 +599,13 @@ function showInputfield2(s, v){
inputCtrl(document.form.ipv6_prefix_length, enable);
if(enable){
document.getElementById("ipv6_wan_setting").style.display="none";
inputCtrl(document.form.ipv6_prefix_len_wan, enable);
document.getElementById("ipv6_ipaddr_r").style.display = "none";
document.getElementById("ipv6_prefix_length_r").style.display = "none";
}else{
document.getElementById("ipv6_wan_setting").style.display="";
inputCtrl(document.form.ipv6_prefix_len_wan, !enable);
document.getElementById("ipv6_ipaddr_r").style.display = "";
document.getElementById("ipv6_prefix_length_r").style.display = "";
document.getElementById("ipv6_prefix_length_span").innerHTML = "";
Expand Down

0 comments on commit faf82c7

Please sign in to comment.