Skip to content

Commit

Permalink
Merge branch 'master' into mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
RMerl committed Jan 2, 2020
2 parents d7b8788 + 8070a50 commit 4fecf77
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 8 deletions.
23 changes: 23 additions & 0 deletions Changelog-NG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,33 @@ Asuswrt-Merlin 384/NG Changelog
be identical to when the original wan-start script was
being run (wan-start should be considered deprecated
and will be removed in a future release)
- NEW: Implemented an official API for addon developers to
better integrate with the router. This includes up
to ten different pages that can be added anywhere within
the webui, and a dedicated storage repository for your
settings, which can be interacted with through your
custom web page. See the Wiki for more information:

(first draft of the documentation, need to be reorganized)
https://github.com/RMerl/asuswrt-merlin/wiki/Addons-API

- UPDATED: Merged with GPL 385-10002 (from RT-AC68U)
- UPDATED: odhcp6c to 1.1-97-ge199804 (themiron)
- UPDATED: curl to 7.67.0.


384.14_2 (1-1-2020)
- FIXED: Missing cifs kernel module
- FIXED: stubby was linked with OpenSSL 1.0 instead of 1.1
- FIXED: some routers were reporting the Internet connection being
disconnected. If you were affected and you had flashed
a customized bootloader, then please reflash your original
bootloader, as your modded bootloader is invalid, and other
potential issues may appear over time.
- FIXED: Random traffic spikes logged in Traffic Monitor (regression
from 384_81351)


384.14 (14-Dec-2019)
- NEW: Implement option to prevent Firefox's automatic usage of DoH.
By default, this will only apply if you have DNSPrivacy
Expand Down
53 changes: 53 additions & 0 deletions release/src/router/httpd/data_arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
#include <search.h>
#endif

#include <json.h>

int
ej_get_leases_array(int eid, webs_t wp, int argc, char_t **argv)
{
Expand Down Expand Up @@ -1211,3 +1213,54 @@ void _fix_TM_ipv6(char* str) {
strcat(str,"00");
}
#endif


int ej_get_custom_settings(int eid, webs_t wp, int argc, char **argv_) {

struct json_object *settings_obj;
int ret = 0;
char line[3040];
char name[30];
char value[3000];
FILE *fp;

fp = fopen("/jffs/addons/custom_settings.txt", "r");
if (fp == NULL) {
ret += websWrite(wp," new Object()");
return 0;
}

settings_obj = json_object_new_object();
while (fgets(line, sizeof(line), fp)) {
if (sscanf(line,"%29s%*[ ]%2999s%*[ \n]",name, value) == 2) {
json_object_object_add(settings_obj, name, json_object_new_string(value));
}
}
fclose(fp);

ret += websWrite(wp, "%s", json_object_to_json_string(settings_obj));

json_object_put(settings_obj);
return ret;
}


void write_custom_settings(char *jstring) {
char line[3040];
FILE *fp;
struct json_object *settings_obj;

settings_obj = json_tokener_parse(jstring);
if (!settings_obj) return;

fp = fopen("/jffs/addons/custom_settings.txt", "w");
if (!fp) return;

json_object_object_foreach(settings_obj, key, val) {
snprintf(line, sizeof(line), "%s %s\n", key, json_object_get_string(val));
fwrite(line, 1, strlen(line), fp);
}
fclose(fp);

json_object_put(settings_obj);
}
2 changes: 2 additions & 0 deletions release/src/router/httpd/data_arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ void _fix_TM_ipv6(char* str);
#endif

int ej_connlist_array(int eid, webs_t wp, int argc, char **argv);
extern int ej_get_custom_settings(int eid, webs_t wp, int argc, char **argv_);
extern void write_custom_settings(char *jstring);
6 changes: 6 additions & 0 deletions release/src/router/httpd/web.c
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,11 @@ int validate_apply(webs_t wp, json_object *root) {
nvram_modified = 1;
}
#endif
else if(!strcmp(name, "amng_custom")) {
write_custom_settings(value);
_dprintf("set amng_custom to %s\n", value);
nvram_modified = 1;
}

#ifdef RTCONFIG_DISK_MONITOR
else if(!strncmp(name, "diskmon_", 8)) {
Expand Down Expand Up @@ -24831,6 +24836,7 @@ struct ej_handler ej_handlers[] = {
{ "get_route_array", ej_get_route_array},
{ "get_tcclass_array", ej_tcclass_dump_array},
{ "get_connlist_array", ej_connlist_array},
{ "get_custom_settings", ej_get_custom_settings},
#ifdef RTCONFIG_BCMWL6
{ "get_wl_status", ej_wl_status_2g_array},
#endif
Expand Down
2 changes: 1 addition & 1 deletion release/src/router/others/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pc_delete() {
# in use.

get_webui_page() {
for i in 1 2 3 4 5
for i in 1 2 3 4 5 6 7 8 9 10
do
page=/www/ext/user$i.asp
if [ ! -f $page ]
Expand Down
8 changes: 2 additions & 6 deletions release/src/router/rc/firewall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,9 +1677,7 @@ void nat_setting(char *wan_if, char *wan_ip, char *wanx_if, char *wanx_ip, char

#ifdef RTCONFIG_NTPD
if (nvram_get_int("ntpd_enable") && nvram_get_int("ntpd_server_redir")) {
fprintf(fp, "-A PREROUTING -i %s -p udp -m udp --dport 123 -j REDIRECT --to-port 123\n"
"-A PREROUTING -i %s -p tcp -m tcp --dport 123 -j REDIRECT --to-port 123\n",
lan_if, lan_if);
fprintf(fp, "-A PREROUTING -i %s -p udp -m udp --dport 123 -j REDIRECT --to-port 123\n", lan_if);
}
#endif

Expand Down Expand Up @@ -2055,9 +2053,7 @@ void nat_setting2(char *lan_if, char *lan_ip, char *logaccept, char *logdrop) //

#ifdef RTCONFIG_NTPD
if (nvram_get_int("ntpd_enable") && nvram_get_int("ntpd_server_redir")) {
fprintf(fp, "-A PREROUTING -i %s -p udp -m udp --dport 123 -j REDIRECT --to-port 123\n"
"-A PREROUTING -i %s -p tcp -m tcp --dport 123 -j REDIRECT --to-port 123\n",
lan_if, lan_if);
fprintf(fp, "-A PREROUTING -i %s -p udp -m udp --dport 123 -j REDIRECT --to-port 123\n", lan_if);
}
#endif

Expand Down
1 change: 1 addition & 0 deletions release/src/router/rc/jffs2.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ void start_jffs2(void)

if (!check_if_dir_exist("/jffs/scripts/")) mkdir("/jffs/scripts/", 0755);
if (!check_if_dir_exist("/jffs/configs/")) mkdir("/jffs/configs/", 0755);
if (!check_if_dir_exist("/jffs/addons/")) mkdir("/jffs/addons/", 0755);
if (!check_if_dir_exist(UPLOAD_CERT_FOLDER)) mkdir(UPLOAD_CERT_FOLDER, 0600);
}

Expand Down
2 changes: 1 addition & 1 deletion release/src/router/rom/apps_scripts/getrealip.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# use STUN to find the external IP.

servers="default stun.l.google.com:19302 stun.iptel.org stun.stunprotocol.org stun.xten.com"
servers="stun.l.google.com:19302 stun.stunprotocol.org"
prefixes="wan0_ wan1_"

which ministun >/dev/null || exit 1
Expand Down
1 change: 1 addition & 0 deletions release/src/router/shared/defaults.c
Original file line number Diff line number Diff line change
Expand Up @@ -3704,6 +3704,7 @@ struct nvram_tuple router_defaults[] = {
{ "ntpd_enable", "0", CKN_STR1, CKN_TYPE_DEFAULT, CKN_ACC_LEVEL_DEFAULT, CKN_ENC_DEFAULT, 0 },
{ "ntpd_server_redir", "0", CKN_STR1, CKN_TYPE_DEFAULT, CKN_ACC_LEVEL_DEFAULT, CKN_ENC_DEFAULT, 0 },
#endif
{ "amng_custom", "", CKN_STR8192, CKN_TYPE_DEFAULT, CKN_ACC_LEVEL_DEFAULT, CKN_ENC_DEFAULT, 0 }, // Dummy variable

/* End of Merlin-specific settings */

Expand Down
6 changes: 6 additions & 0 deletions release/src/router/www/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,9 @@ endif
ln -sf user/user3.asp $(INSTALLDIR)/www/user3.asp
ln -sf user/user4.asp $(INSTALLDIR)/www/user4.asp
ln -sf user/user5.asp $(INSTALLDIR)/www/user5.asp
ln -sf user/user6.asp $(INSTALLDIR)/www/user6.asp
ln -sf user/user7.asp $(INSTALLDIR)/www/user7.asp
ln -sf user/user8.asp $(INSTALLDIR)/www/user8.asp
ln -sf user/user9.asp $(INSTALLDIR)/www/user9.asp
ln -sf user/user10.asp $(INSTALLDIR)/www/user10.asp

0 comments on commit 4fecf77

Please sign in to comment.