Skip to content

Commit

Permalink
rc: fix DHCP renewal failure related to bwdpi firewall rules
Browse files Browse the repository at this point in the history
Workaround provided by Asus, will require more testing.
  • Loading branch information
RMerl committed Oct 20, 2020
1 parent abec638 commit bde9b9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions release/src/router/rc/firewall.c
Original file line number Diff line number Diff line change
Expand Up @@ -5786,7 +5786,7 @@ mangle_setting(char *wan_if, char *wan_ip, char *lan_if, char *lan_ip, char *log
eval("iptables", "-t", "mangle", "-N", "BWDPI_FILTER");
eval("iptables", "-t", "mangle", "-F", "BWDPI_FILTER");
eval("iptables", "-t", "mangle", "-A", "BWDPI_FILTER", "-i", wan_if, "-p", "udp", "--sport", "68", "--dport", "67", "-j", "DROP");
eval("iptables", "-t", "mangle", "-A", "BWDPI_FILTER", "-i", wan_if, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
// eval("iptables", "-t", "mangle", "-A", "BWDPI_FILTER", "-i", wan_if, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
eval("iptables", "-t", "mangle", "-A", "PREROUTING", "-i", wan_if, "-p", "udp", "-j", "BWDPI_FILTER");
}
#endif
Expand Down Expand Up @@ -6036,7 +6036,7 @@ mangle_setting2(char *lan_if, char *lan_ip, char *logaccept, char *logdrop)
continue;
//#endif
eval("iptables", "-t", "mangle", "-A", "BWDPI_FILTER", "-i", wan_if, "-p", "udp", "--sport", "68", "--dport", "67", "-j", "DROP");
eval("iptables", "-t", "mangle", "-A", "BWDPI_FILTER", "-i", wan_if, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
// eval("iptables", "-t", "mangle", "-A", "BWDPI_FILTER", "-i", wan_if, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
eval("iptables", "-t", "mangle", "-A", "PREROUTING", "-i", wan_if, "-p", "udp", "-j", "BWDPI_FILTER");
}
}
Expand Down
16 changes: 15 additions & 1 deletion release/src/router/rc/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -10876,6 +10876,7 @@ static void QOS_CONTROL()
#ifdef RTCONFIG_LANTIQ
char ppa_cmd[255] = {0};
#endif
char dev_wan[16];

add_iQosRules(get_wan_ifname(wan_primary_ifunit()));
#if defined(RTCONFIG_BWDPI)
Expand All @@ -10892,6 +10893,10 @@ static void QOS_CONTROL()
_dprintf("%s : add ppa wan interface: %s\n", __FUNCTION__, ppa_cmd);
}
#endif

// add workaround to make IPoE protocol works
strlcpy(dev_wan, get_wan_ifname(wan_primary_ifunit()), sizeof(dev_wan));
eval("iptables", "-t", "mangle", "-D", "BWDPI_FILTER", "-i", dev_wan, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
}

void check_services(void)
Expand Down Expand Up @@ -14010,16 +14015,21 @@ _dprintf("multipath(%s): unit_now: (%d, %d, %s), unit_next: (%d, %d, %s).\n", mo
(defined(RTCONFIG_RALINK) && !defined(RTCONFIG_DSL) && !defined(RTN13U))
reinit_hwnat(-1);
#endif
// TODO: check if I must reapply my codel patch differently since 18991?
QOS_CONTROL();
}
nvram_set("restart_qo", "0");
}
#if defined(RTCONFIG_BWDPI)
else if (strcmp(script, "wrs") == 0)
{
char dev_wan[16];

if(action & RC_SERVICE_STOP) stop_dpi_engine_service(0);
if(action & RC_SERVICE_START) start_dpi_engine_service();

// add workaround to make IPoE protocol works
strlcpy(dev_wan, get_wan_ifname(wan_primary_ifunit()), sizeof(dev_wan));
eval("iptables", "-t", "mangle", "-D", "BWDPI_FILTER", "-i", dev_wan, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
}
else if (strcmp(script, "wrs_force") == 0)
{
Expand All @@ -14029,13 +14039,17 @@ _dprintf("multipath(%s): unit_now: (%d, %d, %s), unit_next: (%d, %d, %s).\n", mo
{
if(action & RC_SERVICE_START){
char *sig_update_argv[] = {"sig_update.sh", NULL};
char dev_wan[16];
_eval(sig_update_argv, NULL, 0, NULL);
if(nvram_get_int("sig_state_flag")){
char *sig_upgrade_argv[] = {"sig_upgrade.sh", NULL};
_eval(sig_upgrade_argv, NULL, 0, NULL);
}
stop_dpi_engine_service(0);
start_dpi_engine_service();

// add workaround to make IPoE protocol works
eval("iptables", "-t", "mangle", "-D", "BWDPI_FILTER", "-i", dev_wan, "-p", "udp", "--sport", "67", "--dport", "68", "-j", "DROP");
}
}
else if (strcmp(script, "dpi_disable") == 0)
Expand Down

0 comments on commit bde9b9e

Please sign in to comment.