diff --git a/release/src-rt-6.x.4708/Makefile b/release/src-rt-6.x.4708/Makefile index b9b268b230..38e4271654 100644 --- a/release/src-rt-6.x.4708/Makefile +++ b/release/src-rt-6.x.4708/Makefile @@ -1250,10 +1250,10 @@ r7000z: @$(MAKE) z ARM=y NVRAM_64K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" DPSTA=y r6400e: - @$(MAKE) e ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" DPSTA=y + @$(MAKE) e ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" NO_JFFS=y DPSTA=y r6400z: - @$(MAKE) z ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" DPSTA=y + @$(MAKE) z ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" NO_JFFS=y DPSTA=y r7000init: @$(MAKE) bin ARM=y NVRAM_64K=y NAND=y BCMSMP=y B=E IPV6SUPP=y OPENVPN=y OPENSSL11=y DPSTA=y BUILD_DESC="initial" NETGEAR_CHK="R7000" BOARDID_FILE="compatible_r7000.txt" FW_CFG_FILE="tomato_cfg.h" diff --git a/release/src-rt-6.x.4708/router/Makefile b/release/src-rt-6.x.4708/router/Makefile index ea4dd4592c..95f303e368 100644 --- a/release/src-rt-6.x.4708/router/Makefile +++ b/release/src-rt-6.x.4708/router/Makefile @@ -959,18 +959,20 @@ endif busybox: dummy @$(SEP) + $(call patch_files,busybox) @$(MAKE) -C busybox EXTRA_CFLAGS="-fPIC $(EXTRACFLAGS)" $(PARALLEL_BUILD) busybox-install: rm -rf $(INSTALLDIR)/busybox $(MAKE) -C busybox install EXTRA_CFLAGS="-fPIC $(EXTRACFLAGS)" CONFIG_PREFIX=$(INSTALLDIR)/busybox -busybox-clean: - -@$(MAKE) -C busybox distclean - busybox-config: $(MAKE) -C busybox menuconfig +busybox-clean: + -@$(MAKE) -C busybox distclean + $(call unpatch_files,busybox) + httpd: shared nvram$(BCMEX) mssl @$(SEP) @$(MAKE) -C httpd @@ -1696,7 +1698,8 @@ flac/stamp-h1: libogg LDFLAGS="-L$(TOP)/libogg/src/.libs -fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \ $(CONFIGURE) --enable-shared --enable-static --prefix='' --disable-rpath \ --disable-doxygen-docs --disable-xmms-plugin --disable-cpplibs --disable-thorough-tests \ - --without-libiconv-prefix --disable-altivec --disable-sse --disable-dependency-tracking + --without-libiconv-prefix --disable-altivec --disable-sse --disable-dependency-tracking \ + --with-ogg=$(TOP)/libogg/src/.libs @touch $@ flac: flac/stamp-h1 libogg diff --git a/release/src-rt-6.x.4708/router/busybox/.gitignore b/release/src-rt-6.x.4708/router/busybox/.gitignore index 4ea4cc391e..0a0c65bc3e 100644 --- a/release/src-rt-6.x.4708/router/busybox/.gitignore +++ b/release/src-rt-6.x.4708/router/busybox/.gitignore @@ -6,6 +6,8 @@ *.o.* *.a *.s +Kbuild +Config.in # # Never ignore these diff --git a/release/src-rt-6.x.4708/router/busybox/Makefile b/release/src-rt-6.x.4708/router/busybox/Makefile index ec1e614932..a519f3a7e3 100644 --- a/release/src-rt-6.x.4708/router/busybox/Makefile +++ b/release/src-rt-6.x.4708/router/busybox/Makefile @@ -471,8 +471,6 @@ libs-y := \ coreutils/libcoreutils/ \ debianutils/ \ e2fsprogs/ \ - e2fsprogs/e2p/ \ - e2fsprogs/ext2fs/ \ editors/ \ findutils/ \ init/ \ diff --git a/release/src-rt-6.x.4708/router/busybox/Makefile.flags b/release/src-rt-6.x.4708/router/busybox/Makefile.flags index 4a14f547f8..65021de25f 100644 --- a/release/src-rt-6.x.4708/router/busybox/Makefile.flags +++ b/release/src-rt-6.x.4708/router/busybox/Makefile.flags @@ -51,7 +51,7 @@ CFLAGS += $(call cc-option,-fno-builtin-strlen -finline-limit=0 -fomit-frame-poi # -fno-guess-branch-probability: prohibit pseudo-random guessing # of branch probabilities (hopefully makes bloatcheck more stable): CFLAGS += $(call cc-option,-fno-guess-branch-probability,) -CFLAGS += $(call cc-option,-funsigned-char -shared-libgcc,) +CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,) CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,) # Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary): CFLAGS += $(call cc-option,-fno-unwind-tables,) diff --git a/release/src-rt-6.x.4708/router/busybox/applets/usage_pod.c b/release/src-rt-6.x.4708/router/busybox/applets/usage_pod.c index a67e8b4ac3..0b1c4aadb8 100644 --- a/release/src-rt-6.x.4708/router/busybox/applets/usage_pod.c +++ b/release/src-rt-6.x.4708/router/busybox/applets/usage_pod.c @@ -71,7 +71,7 @@ int main(void) } else { printf(", "); } - printf("%s", usage_array[i].aname); + printf(usage_array[i].aname); col += len2; } printf("\n\n"); diff --git a/release/src-rt-6.x.4708/router/busybox/config_base b/release/src-rt-6.x.4708/router/busybox/config_base index d87cd021d1..2fd7bc940d 100644 --- a/release/src-rt-6.x.4708/router/busybox/config_base +++ b/release/src-rt-6.x.4708/router/busybox/config_base @@ -899,7 +899,6 @@ CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set CONFIG_DHCPD_LEASES_FILE="" CONFIG_UDHCPC=y -# CONFIG_UDHCPC_OLD is not set # CONFIG_FEATURE_UDHCPC_ARPING is not set # CONFIG_FEATURE_UDHCP_PORT is not set # CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set diff --git a/release/src-rt-6.x.4708/router/busybox/coreutils/df.c b/release/src-rt-6.x.4708/router/busybox/coreutils/df.c index ff1ea2bf8c..d79c11a6c0 100644 --- a/release/src-rt-6.x.4708/router/busybox/coreutils/df.c +++ b/release/src-rt-6.x.4708/router/busybox/coreutils/df.c @@ -178,8 +178,6 @@ int df_main(int argc UNUSED_PARAM, char **argv) device = mount_entry->mnt_fsname; mount_point = mount_entry->mnt_dir; fs_type = mount_entry->mnt_type; - if (strcmp(mount_point, "proc") == 0 || strcmp(mount_point, "ramfs") == 0) - continue; if (statfs(mount_point, &s) != 0) { bb_simple_perror_msg(mount_point); diff --git a/release/src-rt-6.x.4708/router/busybox/examples/depmod.pl b/release/src-rt-6.x.4708/router/busybox/examples/depmod.pl index 4c4d644adb..809dc08b39 100755 --- a/release/src-rt-6.x.4708/router/busybox/examples/depmod.pl +++ b/release/src-rt-6.x.4708/router/busybox/examples/depmod.pl @@ -205,7 +205,7 @@ foreach my $module ( keys %$mod ) { if($kseries eq '2.4') { print "$module:\t"; my @sorted = sort bydep keys %{$mod->{$module}}; - print join(" ",@sorted); + print join(" \\\n\t",@sorted); print "\n\n"; } else { my $shortmod = $module; diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/dhcp_if/finish b/release/src-rt-6.x.4708/router/busybox/examples/var_service/dhcp_if/finish old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/convert2ipconf b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/convert2ipconf old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/finish b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/finish old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/log/run b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/log/run old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/p_log b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/p_log old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/run b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/run old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/w_log b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/w_log old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/zcip_handler b/release/src-rt-6.x.4708/router/busybox/examples/var_service/zcip_if/zcip_handler old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/include/libbb.h b/release/src-rt-6.x.4708/router/busybox/include/libbb.h index ffe393d541..e39021eb19 100644 --- a/release/src-rt-6.x.4708/router/busybox/include/libbb.h +++ b/release/src-rt-6.x.4708/router/busybox/include/libbb.h @@ -906,10 +906,6 @@ char* hex2bin(char *dst, const char *src, int count) FAST_FUNC; /* Generate a UUID */ void generate_uuid(uint8_t *buf) FAST_FUNC; -/* expand UUID to human readable format */ -char *unparse_uuid(const uint8_t *uu, char *out) FAST_FUNC; -/* parse UUID */ -int parse_uuid(const char *in, uint8_t *uuid) FAST_FUNC; /* Last element is marked by mult == 0 */ struct suffix_mult { @@ -1834,7 +1830,7 @@ extern const char bb_busybox_exec_path[] ALIGN1; * but I want to save a few bytes here */ extern const char bb_PATH_root_path[] ALIGN1; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */ #define bb_default_root_path (bb_PATH_root_path + sizeof("PATH")) -#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin:/opt/sbin")) +#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin")) extern const int const_int_0; //extern const int const_int_1; diff --git a/release/src-rt-6.x.4708/router/busybox/include/volume_id.h b/release/src-rt-6.x.4708/router/busybox/include/volume_id.h index b61f100eb9..a83da899e4 100644 --- a/release/src-rt-6.x.4708/router/busybox/include/volume_id.h +++ b/release/src-rt-6.x.4708/router/busybox/include/volume_id.h @@ -20,14 +20,12 @@ char *get_devname_from_label(const char *spec); char *get_devname_from_uuid(const char *spec); -char *get_devname_from_device(dev_t dev); void display_uuid_cache(int scan_devices); /* Returns: - * 0 : no UUID= or LABEL= prefix found - * 1 : UUID= or LABEL= prefix found. In this case, - * *fsname is replaced if device with such UUID or LABEL is found - * -2: UUID= or LABEL= prefixes cannot be resolved + * 0: no UUID= or LABEL= prefix found + * 1: UUID= or LABEL= prefix found. In this case, + * *fsname is replaced if device with such UUID or LABEL is found */ int resolve_mount_spec(char **fsname); -int add_to_uuid_cache(const char *device, dev_t devno); +int add_to_uuid_cache(const char *device); diff --git a/release/src-rt-6.x.4708/router/busybox/libbb/Kbuild.src b/release/src-rt-6.x.4708/router/busybox/libbb/Kbuild.src index c8ebf97742..52a90e9a1e 100644 --- a/release/src-rt-6.x.4708/router/busybox/libbb/Kbuild.src +++ b/release/src-rt-6.x.4708/router/busybox/libbb/Kbuild.src @@ -171,7 +171,6 @@ lib-$(CONFIG_PING) += inet_cksum.o lib-$(CONFIG_TRACEROUTE) += inet_cksum.o lib-$(CONFIG_TRACEROUTE6) += inet_cksum.o lib-$(CONFIG_UDHCPC) += inet_cksum.o -lib-$(CONFIG_UDHCPC_OLD) += inet_cksum.o lib-$(CONFIG_UDHCPC6) += inet_cksum.o lib-$(CONFIG_UDHCPD) += inet_cksum.o diff --git a/release/src-rt-6.x.4708/router/busybox/libbb/bb_strtonum.c b/release/src-rt-6.x.4708/router/busybox/libbb/bb_strtonum.c index c92cc1c04a..949f26bee6 100644 --- a/release/src-rt-6.x.4708/router/busybox/libbb/bb_strtonum.c +++ b/release/src-rt-6.x.4708/router/busybox/libbb/bb_strtonum.c @@ -62,9 +62,7 @@ unsigned long long FAST_FUNC bb_strtoull(const char *arg, char **endp, int base) /* strtoul(" -4200000000") returns 94967296, errno 0 (!) */ /* I don't think that this is right. Preventing this... */ - //if (!isalnum(arg[0])) return ret_ERANGE(); - char first = (arg[0] != '-' ? arg[0] : arg[1]); - if (!isalnum(first)) return ret_ERANGE(); + if (!isalnum(arg[0])) return ret_ERANGE(); /* not 100% correct for lib func, but convenient for the caller */ errno = 0; @@ -102,7 +100,6 @@ unsigned long FAST_FUNC bb_strtoul(const char *arg, char **endp, int base) *endp = (char*) arg; if (!isalnum(arg[0])) return ret_ERANGE(); - errno = 0; v = strtoul(arg, endp, base); return handle_errors(v, endp); @@ -136,7 +133,6 @@ unsigned FAST_FUNC bb_strtou(const char *arg, char **endp, int base) *endp = (char*) arg; if (!isalnum(arg[0])) return ret_ERANGE(); - errno = 0; v = strtoul(arg, endp, base); if (v > UINT_MAX) return ret_ERANGE(); diff --git a/release/src-rt-6.x.4708/router/busybox/libbb/find_root_device.c b/release/src-rt-6.x.4708/router/busybox/libbb/find_root_device.c index 32c86cea8e..8436cd664f 100644 --- a/release/src-rt-6.x.4708/router/busybox/libbb/find_root_device.c +++ b/release/src-rt-6.x.4708/router/busybox/libbb/find_root_device.c @@ -29,14 +29,15 @@ static char *find_block_device_in_dir(struct arena *ap) char *retpath = NULL; int len, rem; - dir = opendir(ap->devpath); - if (!dir) - return NULL; - len = strlen(ap->devpath); rem = DEVNAME_MAX-2 - len; if (rem <= 0) return NULL; + + dir = opendir(ap->devpath); + if (!dir) + return NULL; + ap->devpath[len++] = '/'; while ((entry = readdir(dir)) != NULL) { diff --git a/release/src-rt-6.x.4708/router/busybox/libbb/messages.c b/release/src-rt-6.x.4708/router/busybox/libbb/messages.c index c6c49c561a..cb0836de88 100644 --- a/release/src-rt-6.x.4708/router/busybox/libbb/messages.c +++ b/release/src-rt-6.x.4708/router/busybox/libbb/messages.c @@ -40,7 +40,7 @@ const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL; /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, * but I want to save a few bytes here. Check libbb.h before changing! */ const char bb_PATH_root_path[] ALIGN1 = - "PATH=/sbin:/usr/sbin:/opt/sbin:/bin:/usr/bin:/opt/bin" BB_ADDITIONAL_PATH; + "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH; //const int const_int_1 = 1; diff --git a/release/src-rt-6.x.4708/router/busybox/libbb/progress.c b/release/src-rt-6.x.4708/router/busybox/libbb/progress.c index 0b4314426a..3c2f01667a 100644 --- a/release/src-rt-6.x.4708/router/busybox/libbb/progress.c +++ b/release/src-rt-6.x.4708/router/busybox/libbb/progress.c @@ -59,6 +59,13 @@ void FAST_FUNC bb_progress_init(bb_progress_t *p, const char *curfile) p->last_size = 0; } +/* File already had beg_size bytes. + * Then we started downloading. + * We downloaded "transferred" bytes so far. + * Download is expected to stop when total size (beg_size + transferred) + * will be "totalsize" bytes. + * If totalsize == 0, then it is unknown. + */ void FAST_FUNC bb_progress_update(bb_progress_t *p, uoff_t beg_size, uoff_t transferred, @@ -168,6 +175,7 @@ void FAST_FUNC bb_progress_update(bb_progress_t *p, } since_last_update = 0; /* we are un-stalled now */ } + elapsed -= p->start_sec; /* now it's "elapsed since start" */ if (since_last_update >= STALLTIME) { diff --git a/release/src-rt-6.x.4708/router/busybox/libbb/xfuncs.c b/release/src-rt-6.x.4708/router/busybox/libbb/xfuncs.c index 49cbe64afd..3f9a84ad49 100644 --- a/release/src-rt-6.x.4708/router/busybox/libbb/xfuncs.c +++ b/release/src-rt-6.x.4708/router/busybox/libbb/xfuncs.c @@ -327,49 +327,3 @@ int FAST_FUNC wait_for_exitstatus(pid_t pid) bb_perror_msg_and_die("waitpid"); return exit_status; } - -char * FAST_FUNC unparse_uuid(const uint8_t *uu, char *out) -{ - char uuid_string[32]; - - bin2hex(uuid_string, (char *)uu, 16); - /* f.e. UUID=dfd9c173-be52-4d27-99a5-c34c6c2ff55f */ - sprintf(out, "%.8s-%.4s-%.4s-%.4s-%.12s", - uuid_string, - uuid_string+8, - uuid_string+8+4, - uuid_string+8+4+4, - uuid_string+8+4+4+4 - ); - return out; -} - -static unsigned char fromhex(char c) -{ - if (isdigit(c)) - return (c - '0'); - return ((c|0x20) - 'a' + 10); -} - -/* Parse & verify UUID string */ -int FAST_FUNC parse_uuid(const char *s, uint8_t *uuid) -{ - int i; - - if (strlen(s) != 36 || s[8] != '-' || s[13] != '-' - || s[18] != '-' || s[23] != '-' - ) { - return -1; - } - for (i = 0; i < 16; i++) { - if (*s == '-') - s++; - if (!isxdigit(s[0]) || !isxdigit(s[1])) - return -2; - uuid[i] = ((fromhex(s[0]) << 4) | fromhex(s[1])); - s += 2; - } - - return 0; -} - diff --git a/release/src-rt-6.x.4708/router/busybox/modutils/insmod.c b/release/src-rt-6.x.4708/router/busybox/modutils/insmod.c index ff9d33a8cf..9c3c992a50 100644 --- a/release/src-rt-6.x.4708/router/busybox/modutils/insmod.c +++ b/release/src-rt-6.x.4708/router/busybox/modutils/insmod.c @@ -11,7 +11,6 @@ #include "libbb.h" #include "modutils.h" -#include /* 2.6 style insmod has no options and required filename * (not module name - .ko can't be omitted) */ @@ -36,34 +35,10 @@ //usage: ) //usage:#endif -static char *m_filename; - -static int FAST_FUNC check_module_name_match(const char *filename, - struct stat *statbuf UNUSED_PARAM, - void *userdata, int depth UNUSED_PARAM) -{ - char *fullname = (char *) userdata; - char *tmp; - - if (fullname[0] == '\0') - return FALSE; - - tmp = bb_get_last_path_component_nostrip(filename); - if (strcmp(tmp, fullname) == 0) { - /* Stop searching if we find a match */ - m_filename = xstrdup(filename); - return FALSE; - } - return TRUE; -} - int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int insmod_main(int argc UNUSED_PARAM, char **argv) { - struct stat st; char *filename; - FILE *fp = NULL; - int pos; int rc; /* Compat note: @@ -83,45 +58,9 @@ int insmod_main(int argc UNUSED_PARAM, char **argv) if (!filename) bb_show_usage(); - m_filename = NULL; - - pos = strlen(filename) - 2; - if (get_linux_version_code() < KERNEL_VERSION(2,6,0)) { - if (pos < 0) pos = 0; - if (strncmp(&filename[pos], ".o", 2) !=0) - filename = xasprintf("%s.o", filename); - } else { - if (--pos < 0) pos = 0; - if (strncmp(&filename[pos], ".ko", 3) !=0) - filename = xasprintf("%s.ko", filename); - } - - /* Get a filedesc for the module. Check if we have a complete path */ - if (stat(filename, &st) < 0 || !S_ISREG(st.st_mode) || - (fp = fopen_for_read(filename)) == NULL) { - /* Hmm. Could not open it. Search /lib/modules/ */ - int r; - char *module_dir; - - module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR); - if (!module_dir) - module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR); - r = recursive_action(module_dir, ACTION_RECURSE, - check_module_name_match, NULL, filename, 0); - free(module_dir); - if (r) - bb_error_msg_and_die("'%s': module not found", filename); - if (m_filename == NULL || ((fp = fopen_for_read(m_filename)) == NULL)) - bb_error_msg_and_die("'%s': module not found", filename); - filename = m_filename; - } - if (fp != NULL) - fclose(fp); - rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); if (rc) bb_error_msg("can't insert '%s': %s", filename, moderror(rc)); - - free(m_filename); + return rc; } diff --git a/release/src-rt-6.x.4708/router/busybox/modutils/modprobe.c b/release/src-rt-6.x.4708/router/busybox/modutils/modprobe.c index e4dd37e3a7..8130c40b77 100644 --- a/release/src-rt-6.x.4708/router/busybox/modutils/modprobe.c +++ b/release/src-rt-6.x.4708/router/busybox/modutils/modprobe.c @@ -417,7 +417,7 @@ static int do_modprobe(struct module_entry *m) if (option_mask32 & OPT_REMOVE) { /* modprobe -r */ if (m2->flags & MODULE_FLAG_LOADED) { - rc = bb_delete_module(m2->modname, O_NONBLOCK | O_EXCL); + rc = bb_delete_module(m2->modname, O_EXCL); if (rc) { if (first) { bb_perror_msg("can't unload module '%s'", diff --git a/release/src-rt-6.x.4708/router/busybox/modutils/modutils-24.c b/release/src-rt-6.x.4708/router/busybox/modutils/modutils-24.c index 60b7e0613f..fe46fc3fdf 100644 --- a/release/src-rt-6.x.4708/router/busybox/modutils/modutils-24.c +++ b/release/src-rt-6.x.4708/router/busybox/modutils/modutils-24.c @@ -3824,7 +3824,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options) /* Load module into memory and unzip if compressed */ image = xmalloc_open_zipped_read_close(m_filename, &image_size); if (!image) - return (-errno); + return EXIT_FAILURE; } m_name = xstrdup(bb_basename(m_filename)); @@ -3855,10 +3855,8 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options) "\twhile this kernel is version %s", flag_force_load ? "warning: " : "", m_name, m_strversion, uts.release); - if (!flag_force_load) { - exit_status = ESRCH; + if (!flag_force_load) goto out; - } } } #endif diff --git a/release/src-rt-6.x.4708/router/busybox/networking/interface.c b/release/src-rt-6.x.4708/router/busybox/networking/interface.c index d80a897382..e5723b4283 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/interface.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/interface.c @@ -885,7 +885,7 @@ static void ife_print6(struct interface *ptr) inet_pton(AF_INET6, addr6, (struct sockaddr *) &sap.sin6_addr); sap.sin6_family = AF_INET6; - printf(" inet6 addr: %s/%d", + printf(" inet6 addr: %s/%d", INET6_sprint((struct sockaddr *) &sap, 1), plen); printf(" Scope:"); @@ -936,7 +936,7 @@ static void ife_print(struct interface *ptr) if (hw == NULL) hw = get_hwntype(-1); - printf("%-10s Link encap:%s ", ptr->name, hw->title); + printf("%-9s Link encap:%s ", ptr->name, hw->title); /* For some hardware types (eg Ash, ATM) we don't print the hardware address if it's null. */ if (hw->print != NULL @@ -954,7 +954,7 @@ static void ife_print(struct interface *ptr) bb_putchar('\n'); if (ptr->has_ip) { - printf(" %s addr:%s ", ap->name, + printf(" %s addr:%s ", ap->name, ap->sprint(&ptr->addr, 1)); if (ptr->flags & IFF_POINTOPOINT) { printf(" P-t-P:%s ", ap->sprint(&ptr->dstaddr, 1)); @@ -967,7 +967,7 @@ static void ife_print(struct interface *ptr) ife_print6(ptr); - printf(" "); + printf(" "); /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ if (ptr->flags == 0) { @@ -1035,26 +1035,26 @@ static void ife_print(struct interface *ptr) * not for the aliases, although strictly speaking they're shared * by all addresses. */ - printf(" "); + printf(" "); printf("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n", ptr->stats.rx_packets, ptr->stats.rx_errors, ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors); if (can_compress) - printf(" compressed:%lu\n", + printf(" compressed:%lu\n", ptr->stats.rx_compressed); - printf(" "); + printf(" "); printf("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n", ptr->stats.tx_packets, ptr->stats.tx_errors, ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, ptr->stats.tx_carrier_errors); - printf(" collisions:%lu ", ptr->stats.collisions); + printf(" collisions:%lu ", ptr->stats.collisions); if (can_compress) printf("compressed:%lu ", ptr->stats.tx_compressed); if (ptr->tx_queue_len != -1) printf("txqueuelen:%d ", ptr->tx_queue_len); - printf("\n R"); + printf("\n R"); print_bytes_scaled(ptr->stats.rx_bytes, " T"); print_bytes_scaled(ptr->stats.tx_bytes, "\n"); } @@ -1062,7 +1062,7 @@ static void ife_print(struct interface *ptr) if (ptr->map.irq || ptr->map.mem_start || ptr->map.dma || ptr->map.base_addr ) { - printf(" "); + printf(" "); if (ptr->map.irq) printf("Interrupt:%d ", ptr->map.irq); if (ptr->map.base_addr >= 0x100) /* Only print devices using it for I/O maps */ diff --git a/release/src-rt-6.x.4708/router/busybox/networking/ntpd.c b/release/src-rt-6.x.4708/router/busybox/networking/ntpd.c index facfa9465b..1a3367be2b 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/ntpd.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/ntpd.c @@ -2048,6 +2048,7 @@ recv_and_process_client_pkt(void /*int fd*/) addr = xmalloc_sockaddr2dotted_noport(from); bb_error_msg("malformed packet received from %s: size %u", addr, (int)size); free(addr); + goto bail; } /* Respond only to client and symmetric active packets */ diff --git a/release/src-rt-6.x.4708/router/busybox/networking/ssl_helper-wolfssl/00cfg-wolfssl-3.6.8 b/release/src-rt-6.x.4708/router/busybox/networking/ssl_helper-wolfssl/00cfg-wolfssl-3.6.8 old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/networking/ssl_helper-wolfssl/ssl_helper.sh b/release/src-rt-6.x.4708/router/busybox/networking/ssl_helper-wolfssl/ssl_helper.sh old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/networking/telnetd.c b/release/src-rt-6.x.4708/router/busybox/networking/telnetd.c index e988631ab8..13c36aa464 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/telnetd.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/telnetd.c @@ -333,7 +333,6 @@ make_new_session( /* Restore default signal handling ASAP */ bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL); - signal(SIGINT, SIG_DFL); pid = getpid(); diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.c b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.c index 5ba97ff370..0cf4dab63c 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.c @@ -36,6 +36,9 @@ const struct dhcp_optflag dhcp_optflags[] = { { OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */ { OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */ { OPTION_U16 , 0x1a }, /* DHCP_MTU */ +//TODO: why do we request DHCP_BROADCAST? Can't we assume that +//in the unlikely case it is different from typical N.N.255.255, +//server would let us know anyway? { OPTION_IP | OPTION_REQ, 0x1c }, /* DHCP_BROADCAST */ { OPTION_IP_PAIR | OPTION_LIST , 0x21 }, /* DHCP_ROUTES */ { OPTION_STRING_HOST , 0x28 }, /* DHCP_NIS_DOMAIN */ diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.h b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.h index 344a592ff4..a526494d7c 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.h +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/common.h @@ -1,4 +1,4 @@ - /* vi: set sw=4 ts=4: */ +/* vi: set sw=4 ts=4: */ /* * Russ Dill September 2001 * Rewritten by Vladimir Oleynik (C) 2003 @@ -74,8 +74,6 @@ struct BUG_bad_sizeof_struct_ip_udp_dhcp_packet { char c[IP_UDP_DHCP_SIZE == 576 ? 1 : -1]; }; -extern int minpkt; // zzz - /*** Options ***/ @@ -305,7 +303,7 @@ void udhcp_sp_setup(void) FAST_FUNC; int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC; int udhcp_sp_read(const fd_set *rfds) FAST_FUNC; -int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac, uint16_t *mtu) FAST_FUNC; +int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) FAST_FUNC; int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC; diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.c b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.c index 1e673720c9..fc7b6216d7 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.c @@ -25,15 +25,9 @@ #include "dhcpd.h" #include "dhcpc.h" -#include -/*#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) -# include -# include -#else */ -# include -# include -/*#endif*/ +#include #include +#include #ifndef PACKET_AUXDATA # define PACKET_AUXDATA 8 @@ -66,7 +60,6 @@ static const char udhcpc_longopts[] ALIGN1 = "request\0" Required_argument "r" "script\0" Required_argument "s" "timeout\0" Required_argument "T" - "version\0" No_argument "v" "retries\0" Required_argument "t" "tryagain\0" Required_argument "A" "syslog\0" No_argument "S" @@ -102,9 +95,8 @@ enum { OPT_x = 1 << 18, OPT_f = 1 << 19, OPT_B = 1 << 20, - OPT_m = 1 << 21, // zzz /* The rest has variable bit positions, need to be clever */ - OPTBIT_LAST = 21, + OPTBIT_B = 20, USE_FOR_MMU( OPTBIT_b,) IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,) IF_FEATURE_UDHCP_PORT( OPTBIT_P,) @@ -121,7 +113,7 @@ static const uint8_t len_of_option_as_string[] ALIGN1 = { [OPTION_IP ] = sizeof("255.255.255.255 "), [OPTION_IP_PAIR ] = sizeof("255.255.255.255 ") * 2, [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "), - [OPTION_6RD ] = sizeof("132 128 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 255.255.255.255 "), + [OPTION_6RD ] = sizeof("132 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), [OPTION_STRING ] = 1, [OPTION_STRING_HOST ] = 1, #if ENABLE_FEATURE_UDHCP_RFC3397 @@ -615,10 +607,7 @@ static void add_client_options(struct dhcp_packet *packet) { int i, end, len; - len = sizeof(struct ip_udp_dhcp_packet); - if (client_config.client_mtu == 0 || - client_config.client_mtu > len) - udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(len)); + udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(IP_UDP_DHCP_SIZE)); /* Add a "param req" option with the list of options we'd like to have * from stubborn DHCP servers. Pull the data from the struct in common.c. @@ -648,10 +637,6 @@ static void add_client_options(struct dhcp_packet *packet) if ((option_mask32 & OPT_B) && packet->ciaddr == 0) packet->flags |= htons(BROADCAST_FLAG); - /* Request broadcast replies if we have no IP addr */ - if ((option_mask32 & OPT_B) && packet->ciaddr == 0) - packet->flags |= htons(BROADCAST_FLAG); - /* Add -x options if any */ { struct option_set *curr = client_config.options; @@ -712,7 +697,6 @@ static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t static NOINLINE int send_discover(uint32_t xid, uint32_t requested) { struct dhcp_packet packet; - static int msgs = 0; /* Fill in: op, htype, hlen, cookie, chaddr fields, * random xid field (we override it below), @@ -730,7 +714,6 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested) */ add_client_options(&packet); - if (msgs++ < 3) bb_error_msg("sending %s", "discover"); return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY); } @@ -1112,12 +1095,13 @@ static void perform_renew(void) bb_error_msg("performing DHCP renew"); switch (state) { case BOUND: - change_listen_mode(LISTEN_RAW); // zzz + change_listen_mode(LISTEN_KERNEL); case RENEWING: case REBINDING: -// state = RENEW_REQUESTED; // zzz -// break; + state = RENEW_REQUESTED; + break; case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ + udhcp_run_script(NULL, "deconfig"); case REQUESTING: case RELEASED: change_listen_mode(LISTEN_RAW); @@ -1248,7 +1232,6 @@ static void client_background(void) //usage: "\n -x lease:3600 - option 51 (lease time)" //usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)" //usage: "\n -F NAME Ask server to update DNS mapping for NAME" -//usage: "\n -H,-h NAME Send NAME as client hostname (default none)" //usage: "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')" //usage: "\n -C Don't send MAC as client identifier" //usage: IF_UDHCP_VERBOSE( @@ -1256,8 +1239,8 @@ static void client_background(void) //usage: ) //usage: ) //usage: "\nSignals:" -//usage: "\n USR1 Renew current lease" -//usage: "\n USR2 Release current lease" +//usage: "\n USR1 Renew lease" +//usage: "\n USR2 Release lease" int udhcpc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; @@ -1272,7 +1255,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) llist_t *list_x = NULL; int tryagain_timeout = 20; int discover_timeout = 3; - int discover_retries = 5; + int discover_retries = 3; uint32_t server_addr = server_addr; /* for compiler */ uint32_t requested_ip = 0; uint32_t xid = xid; /* for compiler */ @@ -1297,10 +1280,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) /* Parse command line */ /* O,x: list; -T,-t,-A take numeric param */ opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ; - IF_LONG_OPTS(applet_long_options = udhcpc_longopts;) opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB" - "m" // zzz USE_FOR_MMU("b") IF_FEATURE_UDHCPC_ARPING("a::") IF_FEATURE_UDHCP_PORT("P:") @@ -1371,14 +1352,10 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) udhcp_str2optset(optstr, &client_config.options); } - if (opt & OPT_m) // zzz - minpkt = 1; - if (udhcp_read_interface(client_config.interface, &client_config.ifindex, NULL, - client_config.client_mac, - &client_config.client_mtu) + client_config.client_mac) ) { return 1; } @@ -1485,8 +1462,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) if (udhcp_read_interface(client_config.interface, &client_config.ifindex, NULL, - client_config.client_mac, - &client_config.client_mtu) + client_config.client_mac) ) { goto ret0; /* iface is gone? */ } @@ -1545,7 +1521,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) /* 1/2 lease passed, enter renewing state */ state = RENEWING; client_config.first_secs = 0; /* make secs field count from 0 */ - change_listen_mode(LISTEN_RAW); // was: LISTEN_KERNEL -- zzz + change_listen_mode(LISTEN_KERNEL); log1("entering renew state"); /* fall right through */ case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ @@ -1602,12 +1578,23 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) switch (udhcp_sp_read(&rfds)) { case SIGUSR1: client_config.first_secs = 0; /* make secs field count from 0 */ -// already_waited_sec = 0; /* shibby - this broke tomato renew button */ + already_waited_sec = 0; perform_renew(); - if (state == RENEW_REQUESTED) -// if (timeout > tryagain_timeout) /* shibby - this broke tomato renew button */ -// timeout = tryagain_timeout; /* shibby - this broke tomato renew button */ + if (state == RENEW_REQUESTED) { + /* We might be either on the same network + * (in which case renew might work), + * or we might be on a completely different one + * (in which case renew won't ever succeed). + * For the second case, must make sure timeout + * is not too big, or else we can send + * futile renew requests for hours. + * (Ab)use -A TIMEOUT value (usually 20 sec) + * as a cap on the timeout. + */ + if (timeout > tryagain_timeout) + timeout = tryagain_timeout; goto case_RENEW_REQUESTED; + } /* Start things over */ packet_num = 0; /* Kill any timeouts, user wants this to hurry along */ diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.h b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.h index 02e56c98b1..9f423a5b24 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.h +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcpc.h @@ -9,7 +9,6 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN struct client_config_t { uint8_t client_mac[6]; /* Our mac address */ - uint16_t client_mtu; /* Our mtu */ IF_FEATURE_UDHCP_PORT(uint16_t port;) int ifindex; /* Index number of the interface to use */ uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */ diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcprelay.c b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcprelay.c index 11482d22f1..f52a0cf881 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcprelay.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/dhcprelay.c @@ -280,7 +280,7 @@ int dhcprelay_main(int argc, char **argv) max_socket = init_sockets(iface_list, num_sockets, fds); /* Get our IP on server_iface */ - if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL, NULL)) + if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL)) return 1; /* Main loop */ @@ -360,7 +360,7 @@ int dhcprelay_main(int argc, char **argv) // of the 'giaddr' field does not match one of the relay agent's // directly-connected logical interfaces, the BOOTREPLY messsage MUST be // silently discarded. - if (udhcp_read_interface(iface_list[i], NULL, &dhcp_msg.gateway_nip, NULL, NULL)) { + if (udhcp_read_interface(iface_list[i], NULL, &dhcp_msg.gateway_nip, NULL)) { /* Fall back to our IP on server iface */ // this makes more sense! dhcp_msg.gateway_nip = our_nip; diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/packet.c b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/packet.c index 6f0938de7a..0a31f26434 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/packet.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/packet.c @@ -12,8 +12,6 @@ #include #include -int minpkt = 0; // zzz - void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) { memset(packet, 0, sizeof(*packet)); @@ -151,9 +149,7 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt, * Thus, we retain enough padding to not go below 300 BOOTP bytes. * Some devices have filters which drop DHCP packets shorter than that. */ - - padding = minpkt ? DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options) : 0; - + padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options); if (padding > DHCP_SIZE - 300) padding = DHCP_SIZE - 300; @@ -225,7 +221,7 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, } udhcp_dump_packet(dhcp_pkt); - padding = minpkt ? DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options) : 0; + padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); if (padding > DHCP_SIZE - 300) padding = DHCP_SIZE - 300; result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); diff --git a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/socket.c b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/socket.c index 2a059db68a..4fd79f4238 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/udhcp/socket.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/udhcp/socket.c @@ -22,21 +22,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION -# include -# include -#else -# include -# include -# include -#endif - #include "common.h" +#include -int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac, uint16_t *mtu) +int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) { - /* char buffer instead of bona-fide struct avoids aliasing warning */ char ifr_buf[sizeof(struct ifreq)]; struct ifreq *const ifr = (void *)ifr_buf; @@ -80,15 +70,6 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } - if (mtu) { - if (ioctl_or_warn(fd, SIOCGIFMTU, ifr) != 0) { - close(fd); - return -1; - } - log1("Adapter mtu %d", ifr->ifr_mtu); - *mtu = ifr->ifr_mtu; - } - close(fd); return 0; } diff --git a/release/src-rt-6.x.4708/router/busybox/networking/wget.c b/release/src-rt-6.x.4708/router/busybox/networking/wget.c index f179ce7bfc..28c12540be 100644 --- a/release/src-rt-6.x.4708/router/busybox/networking/wget.c +++ b/release/src-rt-6.x.4708/router/busybox/networking/wget.c @@ -61,22 +61,16 @@ //config: Busybox itself contains no SSL code. wget will spawn //config: a helper program to talk over HTTPS. //config: -//config: If you select "openssl" helper, wget will effectively run: -//config: "openssl s_client -quiet -connect hostname:443 -//config: -servername hostname 2>/dev/null" and pipe its data -//config: through it. (-servername should only be used with FQDNs, -//config: not IP addresses.) +//config: OpenSSL has a simple SSL client for debug purposes. +//config: If you select "openssl" helper, wget will effectively call +//config: "openssl s_client -quiet -connect IP:443 2>/dev/null" +//config: and pipe its data through it. //config: Note inconvenient API: host resolution is done twice, //config: and there is no guarantee openssl's idea of IPv6 address //config: format is the same as ours. //config: Another problem is that s_client prints debug information //config: to stderr, and it needs to be suppressed. This means //config: all error messages get suppressed too. -//config: Also, if the s_client subcommand is not compiled in to -//config: the system's openssl binary (i.e. subcommand fails), or -//config: certain subcommand flags aren't available/supported, -//config: openssl returns exit code 0, making it difficult to -//config: detect a true error/failure. //config: openssl is also a big binary, often dynamically linked //config: against ~15 libraries. //config: @@ -355,25 +349,6 @@ static void set_alarm(void) # define clear_alarm() ((void)0) #endif -/* - * is_ip_address() attempts to verify whether or not a string - * contains an IPv4 or IPv6 address (vs. an FQDN). The result - * of inet_pton() can be used to determine this. - * - * TODO add proper error checking when inet_pton() returns -1 - * (some form of system error has occurred, and errno is set) - */ -static int is_ip_address(const char *string) -{ - struct sockaddr_in sa; - int result = inet_pton(AF_INET, string, &(sa.sin_addr)); - - if (ENABLE_FEATURE_IPV6 && result == 0) { - result = inet_pton(AF_INET6, string, &(sa.sin_addr)); - } - return (result != 0); -} - static FILE *open_socket(len_and_sockaddr *lsa) { int fd; @@ -654,8 +629,6 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_ static int spawn_https_helper_openssl(const char *host, unsigned port) { char *allocated = NULL; - char *servername; - char *colon_ptr; int sp[2]; int pid; IF_FEATURE_WGET_SSL_HELPER(volatile int child_failed = 0;) @@ -664,39 +637,15 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) /* Kernel can have AF_UNIX support disabled */ bb_perror_msg_and_die("socketpair"); - /* - * Per RFC 6066 Section 3, the only permitted values in the - * TLS server_name (SNI) field are FQDNs (DNS hostnames). - * IPv4 nor IPv6 addresses are supported, nor is use of an - * alternate port number. - * - * The host argument to spawn_https_helper_openssl() can - * contain things like: test.com, test.com:8080, 1.2.3.4, or - * 1.2.3.4:8888. The strchr() check determines if the user - * passed something like test.com:8080 or 1.2.3.4:8888. - * - * The rest of the code ensures that servername only gets - * set to the hostname portion, and that the -servername - * argument to openssl s_client is only used if the hostname - * itself is an actual FQDN, not an IPv4/IPv6 address. - */ if (!strchr(host, ':')) host = allocated = xasprintf("%s:%u", host, port); - servername = xstrdup(host); - colon_ptr = strrchr(servername, ':'); - *colon_ptr = '\0'; - - if (is_ip_address(servername)) - servername = NULL; - fflush_all(); pid = xvfork(); if (pid == 0) { /* Child */ - char *argv[8]; + char *argv[6]; - memset(&argv, 0, sizeof(argv)); close(sp[0]); xmove_fd(sp[1], 0); xdup2(0, 1); @@ -712,12 +661,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) argv[2] = (char*)"-quiet"; argv[3] = (char*)"-connect"; argv[4] = (char*)host; - - if (servername) { - argv[5] = (char*)"-servername"; - argv[6] = (char*)servername; - } - + argv[5] = NULL; BB_EXECVP(argv[0], argv); xmove_fd(3, 2); # if ENABLE_FEATURE_WGET_SSL_HELPER @@ -731,7 +675,6 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) /* Parent */ free(allocated); - free(servername); close(sp[1]); # if ENABLE_FEATURE_WGET_SSL_HELPER if (child_failed) { diff --git a/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/extract_od_binary.sh b/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/extract_od_binary.sh old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/hdc.dir/build b/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/hdc.dir/build old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/hdc.dir/init b/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/hdc.dir/init old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/make-hdc-img.sh b/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/make-hdc-img.sh old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/parallel-build-hdc-img.sh b/release/src-rt-6.x.4708/router/busybox/qemu_multiarch_testing/parallel-build-hdc-img.sh old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/scripts/kconfig/lxdialog/colors.h b/release/src-rt-6.x.4708/router/busybox/scripts/kconfig/lxdialog/colors.h index 66bc93f529..db071df12b 100644 --- a/release/src-rt-6.x.4708/router/busybox/scripts/kconfig/lxdialog/colors.h +++ b/release/src-rt-6.x.4708/router/busybox/scripts/kconfig/lxdialog/colors.h @@ -117,11 +117,11 @@ #define TAG_SELECTED_BG COLOR_BLUE #define TAG_SELECTED_HL TRUE -#define TAG_KEY_FG COLOR_RED +#define TAG_KEY_FG COLOR_YELLOW #define TAG_KEY_BG COLOR_WHITE #define TAG_KEY_HL TRUE -#define TAG_KEY_SELECTED_FG COLOR_GREEN +#define TAG_KEY_SELECTED_FG COLOR_YELLOW #define TAG_KEY_SELECTED_BG COLOR_BLUE #define TAG_KEY_SELECTED_HL TRUE diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob3.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob_and_assign.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob_and_assign.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob_redir.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-glob/glob_redir.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc3.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc4.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-heredoc/heredoc4.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/command.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/command.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/command2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/command2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/exec.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/exec.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/for.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/for.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func3.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func4.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func4.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func5.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func5.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_args1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_args1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_bash1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_bash1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_local1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_local1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_local2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/func_local2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/local2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/local2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/tickquote1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-misc/tickquote1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-do-not-expand-tilde-in-parameter-expansion-in-quotes.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-do-not-expand-tilde-in-parameter-expansion-in-quotes.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-do-not-quote-backslashes-in-parameter-expansions-outside-quotes.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-do-not-quote-backslashes-in-parameter-expansions-outside-quotes.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-expand-tilde-in-parameter-expansion.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-expand-tilde-in-parameter-expansion.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-1.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-2.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-3.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-4.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-4.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-5.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-pattern-replacement-in-parameter-expansion-5.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-runtime-quote-detection.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-runtime-quote-detection.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-utf8-length.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var-utf8-length.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var3.tests b/release/src-rt-6.x.4708/router/busybox/shell/ash_test/ash-vars/var3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-bugs/var3.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-bugs/var3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-glob/glob3.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-glob/glob3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-misc/for.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-misc/for.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-misc/nommu3.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-misc/nommu3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-do-not-collapse-arithmetic-expansion-at-parse-time.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-do-not-expand-tilde-in-parameter-expansion-in-quotes.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-do-not-expand-tilde-in-parameter-expansion-in-quotes.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-do-not-quote-backslashes-in-parameter-expansions-outside-quotes.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-do-not-quote-backslashes-in-parameter-expansions-outside-quotes.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-1.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-1.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-2.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-2.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-3.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-3.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-4.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-4.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-5.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-pattern-replacement-in-parameter-expansion-5.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-runtime-quote-detection.tests b/release/src-rt-6.x.4708/router/busybox/shell/hush_test/hush-vars/var-runtime-quote-detection.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/sysklogd/klogd.c b/release/src-rt-6.x.4708/router/busybox/sysklogd/klogd.c index 304d8c16a8..4db72110d9 100644 --- a/release/src-rt-6.x.4708/router/busybox/sysklogd/klogd.c +++ b/release/src-rt-6.x.4708/router/busybox/sysklogd/klogd.c @@ -146,7 +146,7 @@ static void klogd_close(void) #endif -char log_buffer[6 * 1024 + 1]; /* Big enough to not lose msgs at bootup */ +#define log_buffer bb_common_bufsiz1 enum { KLOGD_LOGBUF_SIZE = COMMON_BUFSIZE, OPT_LEVEL = (1 << 0), @@ -173,7 +173,6 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) char *opt_c; int opt; int used; - unsigned int cnt; setup_common_bufsiz(); @@ -234,12 +233,10 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) write_pidfile(CONFIG_PID_FILE_PATH "/klogd.pid"); used = 0; - cnt = 0; while (!bb_got_signal) { int n; int priority; char *start; - char *eor; /* "2 -- Read from the log." */ start = log_buffer + used; @@ -251,7 +248,6 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) break; } start[n] = '\0'; - eor = &start[n]; /* Process each newline-terminated line in the buffer */ start = log_buffer; @@ -285,13 +281,8 @@ int klogd_main(int argc UNUSED_PARAM, char **argv) start++; } /* Log (only non-empty lines) */ - if (*start) { + if (*start) syslog(priority, "%s", start); - /* give syslog time to catch up */ - ++cnt; - if ((cnt & 0x07) == 0 && (cnt < 300 || (eor - start) > 200)) - usleep(50 * 1000); - } if (!newline) break; diff --git a/release/src-rt-6.x.4708/router/busybox/testsuite/dc.tests b/release/src-rt-6.x.4708/router/busybox/testsuite/dc.tests old mode 100644 new mode 100755 diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/blkid.c b/release/src-rt-6.x.4708/router/busybox/util-linux/blkid.c index 697c445e07..1bbc803112 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/blkid.c +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/blkid.c @@ -22,7 +22,7 @@ int blkid_main(int argc UNUSED_PARAM, char **argv) while (*++argv) { /* Note: bogus device names don't cause any error messages */ - add_to_uuid_cache(*argv, 0); + add_to_uuid_cache(*argv); scan_devices = 0; } diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/fdisk.c b/release/src-rt-6.x.4708/router/busybox/util-linux/fdisk.c index a2cdad692d..f49ce95a4d 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/fdisk.c +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/fdisk.c @@ -423,8 +423,8 @@ static sector_t bb_BLKGETSIZE_sectors(int fd) unsigned long longsectors; if (ioctl(fd, BLKGETSIZE64, &v64) == 0) { - /* Got bytes, convert to sectors */ - v64 /= sector_size; + /* Got bytes, convert to 512 byte sectors */ + v64 >>= 9; if (v64 != (sector_t)v64) { ret_trunc: /* Not only DOS, but all other partition tables @@ -1939,7 +1939,7 @@ check_consistency(const struct partition *p, int partition) static void list_disk_geometry(void) { - ullong bytes = ((ullong)total_number_of_sectors * sector_size); + ullong bytes = ((ullong)total_number_of_sectors << 9); long megabytes = bytes / 1000000; if (megabytes < 10000) @@ -1952,7 +1952,7 @@ list_disk_geometry(void) g_heads, g_sectors, g_cylinders); if (units_per_sector == 1) printf(", total %"SECT_FMT"u sectors", - total_number_of_sectors); + total_number_of_sectors / (sector_size/512)); printf("\nUnits = %s of %u * %u = %u bytes\n\n", str_units(PLURAL), units_per_sector, sector_size, units_per_sector * sector_size); diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/mkswap.c b/release/src-rt-6.x.4708/router/busybox/util-linux/mkswap.c index 2983d04ebc..dcb53f0087 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/mkswap.c +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/mkswap.c @@ -125,9 +125,17 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv) hdr->last_page = (uoff_t)len / pagesize; if (ENABLE_FEATURE_MKSWAP_UUID) { - char uuid_string[37]; + char uuid_string[32]; generate_uuid((void*)hdr->sws_uuid); - printf("UUID=%s\n", unparse_uuid((uint8_t *)hdr->sws_uuid, uuid_string)); + bin2hex(uuid_string, hdr->sws_uuid, 16); + /* f.e. UUID=dfd9c173-be52-4d27-99a5-c34c6c2ff55f */ + printf("UUID=%.8s" "-%.4s-%.4s-%.4s-%.12s\n", + uuid_string, + uuid_string+8, + uuid_string+8+4, + uuid_string+8+4+4, + uuid_string+8+4+4+4 + ); } safe_strncpy(hdr->sws_volume, label, 16); diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/mount.c b/release/src-rt-6.x.4708/router/busybox/util-linux/mount.c index 56bc5b197f..cef4f74159 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/mount.c +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/mount.c @@ -1872,7 +1872,6 @@ static int nfsmount(struct mntent *mp, unsigned long vfsflags, char *filteropts) return ret; } - #endif // !ENABLE_FEATURE_MOUNT_NFS // Mount one directory. Handles CIFS, NFS, loopback, autobind, and filesystem diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/Kbuild.src b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/Kbuild.src index ff19fabc4d..6b4fb74700 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/Kbuild.src +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/Kbuild.src @@ -7,41 +7,3 @@ lib-y:= INSERT - -lib-$(CONFIG_BLKID) += get_devname.o -lib-$(CONFIG_FINDFS) += get_devname.o -lib-$(CONFIG_FEATURE_MOUNT_LABEL) += get_devname.o - -lib-$(CONFIG_VOLUMEID) += volume_id.o util.o util2.o -lib-$(CONFIG_FEATURE_VOLUMEID_BTRFS) += btrfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o -lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o -lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o -### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o -### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o -### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o -### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o -### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o -### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o -### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o -lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o -lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o -lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o -### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o -### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o -### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o -lib-$(CONFIG_FEATURE_VOLUMEID_NILFS) += nilfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_EXFAT) += exfat.o -lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.o -### lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o -lib-$(CONFIG_FEATURE_VOLUMEID_XFS) += xfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.o -### lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_ROMFS) += romfs.o -lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.o -### lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o -lib-$(CONFIG_FEATURE_VOLUMEID_LUKS) += luks.o -lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/get_devname.c b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/get_devname.c index bcf429d3b6..6b97df1138 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/get_devname.c +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/get_devname.c @@ -20,7 +20,7 @@ static struct uuidCache_s { struct uuidCache_s *next; - dev_t devno; +// int major, minor; char *device; char *label; char *uc_uuid; /* prefix makes it easier to grep for */ @@ -30,8 +30,8 @@ static struct uuidCache_s { #if !ENABLE_FEATURE_BLKID_TYPE #define get_label_uuid(fd, label, uuid, type) \ get_label_uuid(fd, label, uuid) -#define uuidcache_addentry(device, devno, label, uuid, type) \ - uuidcache_addentry(device, devno, label, uuid) +#define uuidcache_addentry(device, label, uuid, type) \ + uuidcache_addentry(device, label, uuid) #endif /* Returns !0 on error. @@ -76,7 +76,7 @@ get_label_uuid(int fd, char **label, char **uuid, const char **type) /* NB: we take ownership of (malloc'ed) label and uuid */ static void -uuidcache_addentry(char *device, dev_t devno, char *label, char *uuid, const char *type) +uuidcache_addentry(char *device, /*int major, int minor,*/ char *label, char *uuid, const char *type) { struct uuidCache_s *last; @@ -89,7 +89,8 @@ uuidcache_addentry(char *device, dev_t devno, char *label, char *uuid, const cha last = last->next; } /*last->next = NULL; - xzalloc did it*/ - last->devno = devno; +// last->major = major; +// last->minor = minor; last->device = device; last->label = label; last->uc_uuid = uuid; @@ -117,7 +118,7 @@ uuidcache_check_device(const char *device, if (major(statbuf->st_rdev) == 2) return TRUE; - add_to_uuid_cache(device, statbuf->st_rdev); + add_to_uuid_cache(device); return TRUE; } @@ -151,10 +152,10 @@ uuidcache_init(int scan_devices) #define UUID 1 #define VOL 2 -#define DEVNO 3 +#ifdef UNUSED static char * -get_spec_by_x(int n, const char *t, dev_t *devnoPtr) +get_spec_by_x(int n, const char *t, int *majorPtr, int *minorPtr) { struct uuidCache_s *uc; @@ -162,29 +163,66 @@ get_spec_by_x(int n, const char *t, dev_t *devnoPtr) while (uc) { switch (n) { case UUID: - /* case of hex numbers doesn't matter */ - if (strcasecmp(t, uc->uc_uuid) == 0) - goto found; + if (strcmp(t, uc->uc_uuid) == 0) { + *majorPtr = uc->major; + *minorPtr = uc->minor; + return uc->device; + } break; case VOL: - if (uc->label[0] && strcmp(t, uc->label) == 0) - goto found; - break; - case DEVNO: - if (uc->devno == (*devnoPtr)) - goto found; + if (strcmp(t, uc->label) == 0) { + *majorPtr = uc->major; + *minorPtr = uc->minor; + return uc->device; + } break; } uc = uc->next; } return NULL; +} + +static unsigned char +fromhex(char c) +{ + if (isdigit(c)) + return (c - '0'); + return ((c|0x20) - 'a' + 10); +} + +static char * +get_spec_by_uuid(const char *s, int *major, int *minor) +{ + unsigned char uuid[16]; + int i; + + if (strlen(s) != 36 || s[8] != '-' || s[13] != '-' + || s[18] != '-' || s[23] != '-' + ) { + goto bad_uuid; + } + for (i = 0; i < 16; i++) { + if (*s == '-') + s++; + if (!isxdigit(s[0]) || !isxdigit(s[1])) + goto bad_uuid; + uuid[i] = ((fromhex(s[0]) << 4) | fromhex(s[1])); + s += 2; + } + return get_spec_by_x(UUID, (char *)uuid, major, minor); -found: - if (devnoPtr) - *devnoPtr = uc->devno; - return xstrdup(uc->device); + bad_uuid: + fprintf(stderr, _("mount: bad UUID")); + return 0; } +static char * +get_spec_by_volume_label(const char *s, int *major, int *minor) +{ + return get_spec_by_x(VOL, s, major, minor); +} +#endif // UNUSED + /* Used by blkid */ void display_uuid_cache(int scan_devices) { @@ -206,7 +244,7 @@ void display_uuid_cache(int scan_devices) } } -int add_to_uuid_cache(const char *device, dev_t devno) +int add_to_uuid_cache(const char *device) { char *uuid = uuid; /* for compiler */ char *label = label; @@ -222,47 +260,57 @@ int add_to_uuid_cache(const char *device, dev_t devno) /* get_label_uuid() closes fd in all cases (success & failure) */ if (get_label_uuid(fd, &label, &uuid, &type) == 0) { /* uuidcache_addentry() takes ownership of all four params */ - uuidcache_addentry(xstrdup(device), devno, label, uuid, type); + uuidcache_addentry(xstrdup(device), /*ma, mi,*/ label, uuid, type); return 1; } return 0; } -/* Used by mount and findfs & old_e2fsprogs */ +/* Used by mount and findfs */ char *get_devname_from_label(const char *spec) { - return get_spec_by_x(VOL, spec, NULL); + struct uuidCache_s *uc; + + uc = uuidcache_init(/*scan_devices:*/ 1); + while (uc) { + if (uc->label[0] && strcmp(spec, uc->label) == 0) { + return xstrdup(uc->device); + } + uc = uc->next; + } + return NULL; } char *get_devname_from_uuid(const char *spec) { - return get_spec_by_x(UUID, spec, NULL); -} + struct uuidCache_s *uc; -char *get_devname_from_device(dev_t dev) -{ - return get_spec_by_x(DEVNO, NULL, &dev); + uc = uuidcache_init(/*scan_devices:*/ 1); + while (uc) { + /* case of hex numbers doesn't matter */ + if (strcasecmp(spec, uc->uc_uuid) == 0) { + return xstrdup(uc->device); + } + uc = uc->next; + } + return NULL; } int resolve_mount_spec(char **fsname) { - char *tmp = NULL; + char *tmp = *fsname; if (is_prefixed_with(*fsname, "UUID=")) tmp = get_devname_from_uuid(*fsname + 5); else if (is_prefixed_with(*fsname, "LABEL=")) tmp = get_devname_from_label(*fsname + 6); - else { - *fsname = xstrdup(*fsname); + if (tmp == *fsname) return 0; /* no UUID= or LABEL= prefix found */ - } - - if (!tmp) - return -2; /* device defined by UUID= or LABEL= wasn't found */ - *fsname = tmp; + if (tmp) + *fsname = tmp; return 1; } diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util.c b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util.c index 1a68436ca2..061545fde7 100644 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util.c +++ b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util.c @@ -20,7 +20,6 @@ #include "volume_id_internal.h" -#ifdef UTIL2 void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) { unsigned i, j; @@ -58,9 +57,7 @@ void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum end } str[j] = '\0'; } -#endif -#ifndef UTIL2 #ifdef UNUSED static const char *usage_to_string(enum volume_id_usage usage_id) { @@ -115,9 +112,6 @@ static size_t strnlen(const char *s, size_t maxlen) } #endif -#endif -#ifdef UTIL2 - void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) { unsigned i; @@ -269,4 +263,3 @@ void volume_id_free_buffer(struct volume_id *id) id->seekbuf_len = 0; id->seekbuf_off = 0; /* paranoia */ } -#endif diff --git a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util2.c b/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util2.c deleted file mode 100644 index f567d1e04c..0000000000 --- a/release/src-rt-6.x.4708/router/busybox/util-linux/volume_id/util2.c +++ /dev/null @@ -1,7 +0,0 @@ -/* util.c is now split apart, for the benefit of Tomato. So it can - * pull in just enough busybox code to read disc labels, without - * dragging in other un-needed stuff. - * It would be better if Tomato could use "busybox.so", but busybox - * can't currently build a shared .so configuration. */ -#define UTIL2 -#include "util.c" diff --git a/release/src-rt-6.x.4708/router/config/Makefile b/release/src-rt-6.x.4708/router/config/Makefile index 3e03583ecc..6064310e77 100644 --- a/release/src-rt-6.x.4708/router/config/Makefile +++ b/release/src-rt-6.x.4708/router/config/Makefile @@ -101,7 +101,7 @@ endif .PHONY: ncurses ncurses: - @echo "main() {}" > lxtemp.c + @echo "int main() { return 0; }" > lxtemp.c @if $(HOSTCC) lxtemp.c $(LIBS) ; then \ rm -f lxtemp.c a.out; \ else \ diff --git a/release/src-rt-6.x.4708/router/config/mconf.c b/release/src-rt-6.x.4708/router/config/mconf.c index d2e7d250e5..da82e85d6d 100644 --- a/release/src-rt-6.x.4708/router/config/mconf.c +++ b/release/src-rt-6.x.4708/router/config/mconf.c @@ -90,7 +90,7 @@ static char filename[PATH_MAX+1] = ".config"; static int indent = 0; static struct termios ios_org; static int rows, cols; -struct menu *current_menu; +extern struct menu *current_menu; static int child_count; static int single_menu_mode; diff --git a/release/src-rt-6.x.4708/router/httpd/gencert.sh b/release/src-rt-6.x.4708/router/httpd/gencert.sh index 5859d062ca..b0239ef821 100644 --- a/release/src-rt-6.x.4708/router/httpd/gencert.sh +++ b/release/src-rt-6.x.4708/router/httpd/gencert.sh @@ -10,11 +10,7 @@ while [ -f "$PIDFILE" -a $WAITTIMER -lt 14 ]; do done touch $PIDFILE -[ -f /usr/sbin/openssl11 ] && { - OPENSSL=/usr/sbin/openssl11 -} || { - OPENSSL=/usr/sbin/openssl -} +OPENSSL=/usr/sbin/openssl LANCN=$(nvram get https_crt_cn) LANIP=$(nvram get lan_ipaddr) diff --git a/release/src-rt-6.x.4708/router/httpd/openvpn.c b/release/src-rt-6.x.4708/router/httpd/openvpn.c index 3824e4a80e..014161e0e6 100644 --- a/release/src-rt-6.x.4708/router/httpd/openvpn.c +++ b/release/src-rt-6.x.4708/router/httpd/openvpn.c @@ -61,11 +61,7 @@ static void prepareCAGeneration(int serverNum) if (nvram_match(buffer, "")) { syslog(LOG_WARNING, "No CA KEY was saved for server %d, regenerating", serverNum); sprintf(buffer2, "\"/C=GB/ST=Yorks/L=York/O=FreshTomato/OU=IT/CN=server.%s\"", nvram_safe_get("wan_domain")); -#ifdef TCONFIG_OPENSSL11 - sprintf(buffer, "openssl11 req -days 3650 -nodes -new -x509 -keyout /tmp/openssl/cakey.pem -out /tmp/openssl/cacert.pem -subj %s >>/tmp/openssl/openssl.log 2>&1", buffer2); -#else sprintf(buffer, "openssl req -days 3650 -nodes -new -x509 -keyout /tmp/openssl/cakey.pem -out /tmp/openssl/cacert.pem -subj %s >>/tmp/openssl/openssl.log 2>&1", buffer2); -#endif syslog(LOG_WARNING, buffer); system(buffer); } else { @@ -100,27 +96,15 @@ static void generateKey(const char *prefix) put_to_file("/tmp/openssl/serial", "00"); sprintf(subj_buf, "\"/C=GB/ST=Yorks/L=York/O=FreshTomato/OU=IT/CN=%s.%s\"", prefix, nvram_safe_get("wan_domain")); -#ifdef TCONFIG_OPENSSL11 - sprintf(buffer, "openssl11 req -nodes -new -keyout /tmp/openssl/%s.key -out /tmp/openssl/%s.csr %s -subj %s >>/tmp/openssl/openssl.log 2>&1", prefix, prefix, str, subj_buf); -#else sprintf(buffer, "openssl req -nodes -new -keyout /tmp/openssl/%s.key -out /tmp/openssl/%s.csr %s -subj %s >>/tmp/openssl/openssl.log 2>&1", prefix, prefix, str, subj_buf); -#endif syslog(LOG_WARNING, buffer); system(buffer); -#ifdef TCONFIG_OPENSSL11 - sprintf(buffer, "openssl11 ca -batch -policy policy_anything -days 3650 -out /tmp/openssl/%s.crt -in /tmp/openssl/%s.csr %s -subj %s >>/tmp/openssl/openssl.log 2>&1", prefix, prefix, str, subj_buf); -#else sprintf(buffer, "openssl ca -batch -policy policy_anything -days 3650 -out /tmp/openssl/%s.crt -in /tmp/openssl/%s.csr %s -subj %s >>/tmp/openssl/openssl.log 2>&1", prefix, prefix, str, subj_buf); -#endif syslog(LOG_WARNING, buffer); system(buffer); -#ifdef TCONFIG_OPENSSL11 - sprintf(buffer, "openssl11 x509 -in /tmp/openssl/%s.crt -inform PEM -out /tmp/openssl/%s.crt -outform PEM >>/tmp/openssl/openssl.log 2>&1", prefix, prefix); -#else sprintf(buffer, "openssl x509 -in /tmp/openssl/%s.crt -inform PEM -out /tmp/openssl/%s.crt -outform PEM >>/tmp/openssl/openssl.log 2>&1", prefix, prefix); -#endif syslog(LOG_WARNING, buffer); system(buffer); } @@ -192,17 +176,9 @@ void wo_ovpn_genkey(char *url) if (!strcmp(modeStr, "static")) { web_pipecmd("openvpn --genkey --secret /tmp/genvpnkey >/dev/null 2>&1 && cat /tmp/genvpnkey | tail -n +4 && rm /tmp/genvpnkey", WOF_NONE); } else if (!strcmp(modeStr, "dh")) { -#ifdef TCONFIG_OPENSSL11 - web_pipecmd("openssl11 dhparam -out /tmp/dh1024.pem 1024 >/dev/null 2>&1 && cat /tmp/dh1024.pem && rm /tmp/dh1024.pem", WOF_NONE); -#else web_pipecmd("openssl dhparam -out /tmp/dh1024.pem 1024 >/dev/null 2>&1 && cat /tmp/dh1024.pem && rm /tmp/dh1024.pem", WOF_NONE); -#endif } else if (!strcmp(modeStr, "stop")) { -#ifdef TCONFIG_OPENSSL11 - killall("openssl11", SIGTERM); -#else killall("openssl", SIGTERM); -#endif } else { strlcpy(buffer, webcgi_safeget("_server", ""), sizeof(buffer)); serverStr = js_string(buffer); /* quicky scrub */ diff --git a/release/src-rt-6.x.4708/router/miniupnpd/Makefile.freshtomato b/release/src-rt-6.x.4708/router/miniupnpd/Makefile.freshtomato index 914ffd93bf..e3f7ae8460 100644 --- a/release/src-rt-6.x.4708/router/miniupnpd/Makefile.freshtomato +++ b/release/src-rt-6.x.4708/router/miniupnpd/Makefile.freshtomato @@ -124,12 +124,12 @@ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack) endif # ($(TEST),1) -TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1) -ifeq ($(TEST),1) -LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid) -else -$(info please install uuid-dev package / libuuid) -endif # ($(TEST),1) +#TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1) +#ifeq ($(TEST),1) +#LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l uuid) +#else +#$(info please install uuid-dev package / libuuid) +#endif # ($(TEST),1) GLIBC_VERSION := $(shell ldd --version | head -n 1 | sed 's/^.* //') GLIBC_VERSION_MAJOR = $(shell echo $(GLIBC_VERSION) | cut -f 1 -d . ) diff --git a/release/src-rt-6.x.4708/router/openvpn/ChangeLog b/release/src-rt-6.x.4708/router/openvpn/ChangeLog index f516b5afa4..567e0d127b 100644 --- a/release/src-rt-6.x.4708/router/openvpn/ChangeLog +++ b/release/src-rt-6.x.4708/router/openvpn/ChangeLog @@ -1,6 +1,23 @@ OpenVPN Change Log Copyright (C) 2002-2020 OpenVPN Inc +2020.09.10 -- Version 2.5_beta4 + +Gert Doering (3): + Document that --push-remove is generally more suitable than --push-reset + Fix error detection / abort in --inetd corner case. + Fix TUNSETGROUP compatibility with very old Linux systems. + +Lev Stipakov (1): + openvpnmsica: make adapter renaming non-fatal + +Selva Nair (1): + In tap.c use DiInstallDevice to install the driver on a new adapter + +Vladislav Grishenko (1): + Fix best gateway selection over netlink + + 2020.08.31 -- Version 2.5_beta3 Arne Schwabe (1): diff --git a/release/src-rt-6.x.4708/router/openvpn/config-msvc.h b/release/src-rt-6.x.4708/router/openvpn/config-msvc.h index 8ef48979b0..f199bb2ce8 100644 --- a/release/src-rt-6.x.4708/router/openvpn/config-msvc.h +++ b/release/src-rt-6.x.4708/router/openvpn/config-msvc.h @@ -112,6 +112,7 @@ #define HAVE_EC_GROUP_ORDER_BITS 1 #define OPENSSL_NO_EC 1 #define HAVE_EVP_CIPHER_CTX_RESET 1 +#define HAVE_DIINSTALLDEVICE 1 #define PATH_SEPARATOR '\\' #define PATH_SEPARATOR_STR "\\" diff --git a/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/advanced-options.rst b/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/advanced-options.rst index 9b96e406eb..bedc8841c0 100644 --- a/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/advanced-options.rst +++ b/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/advanced-options.rst @@ -11,8 +11,11 @@ Standalone Debug Options --show-gateway --show-gateway IPv6-target - If an IPv6 target address is passed as argument, the IPv6 route for this - host is reported. + For IPv6 this queries the route towards ::/128, or the specified IPv6 + target address if passed as argument. + For IPv4 on Linux, Windows, MacOS and BSD it looks for a 0.0.0.0/0 route. + If there are more specific routes, the result will not always be matching + the route of the IPv4 packets to the VPN gateway. Advanced Expert Options diff --git a/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/server-options.rst b/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/server-options.rst index f1f0667a94..2009953c24 100644 --- a/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/server-options.rst +++ b/release/src-rt-6.x.4708/router/openvpn/doc/man-sections/server-options.rst @@ -530,6 +530,14 @@ fast hardware. SSL/TLS authentication must be used in this mode. ``--client-config-dir`` configuration file. This option will ignore ``--push`` options at the global config file level. + *NOTE*: ``--push-reset`` is very thorough: it will remove almost + all options from the list of to-be-pushed options. In many cases, + some of these options will need to be re-configured afterwards - + specifically, ``--topology subnet`` and ``--route-gateway`` will get + lost and this will break client configs in many cases. Thus, for most + purposes, ``--push-remove`` is better suited to selectively remove + push options for individual clients. + --server args A helper directive designed to simplify the configuration of OpenVPN's server mode. This directive will set up an OpenVPN server which will diff --git a/release/src-rt-6.x.4708/router/openvpn/src/openvpn/networking_sitnl.c b/release/src-rt-6.x.4708/router/openvpn/src/openvpn/networking_sitnl.c index 713a213a1a..2bc70a5046 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/openvpn/networking_sitnl.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/openvpn/networking_sitnl.c @@ -345,6 +345,13 @@ sitnl_send(struct nlmsghdr *payload, pid_t peer, unsigned int groups, * continue; * } */ + + if (h->nlmsg_type == NLMSG_DONE) + { + ret = 0; + goto out; + } + if (h->nlmsg_type == NLMSG_ERROR) { err = (struct nlmsgerr *)NLMSG_DATA(h); @@ -360,7 +367,11 @@ sitnl_send(struct nlmsghdr *payload, pid_t peer, unsigned int groups, ret = 0; if (cb) { - ret = cb(h, arg_cb); + int r = cb(h, arg_cb); + if (r <= 0) + { + ret = r; + } } } else @@ -375,8 +386,12 @@ sitnl_send(struct nlmsghdr *payload, pid_t peer, unsigned int groups, if (cb) { - ret = cb(h, arg_cb); - goto out; + int r = cb(h, arg_cb); + if (r <= 0) + { + ret = r; + goto out; + } } else { @@ -410,6 +425,7 @@ typedef struct { int addr_size; inet_address_t gw; char iface[IFNAMSIZ]; + bool default_only; } route_res_t; static int @@ -421,6 +437,12 @@ sitnl_route_save(struct nlmsghdr *n, void *arg) int len = n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)); unsigned int ifindex = 0; + /* filter-out non-zero dst prefixes */ + if (res->default_only && r->rtm_dst_len != 0) + { + return 1; + } + while (RTA_OK(rta, len)) { switch (rta->rta_type) @@ -477,11 +499,25 @@ sitnl_route_best_gw(sa_family_t af_family, const inet_address_t *dst, { case AF_INET: res.addr_size = sizeof(in_addr_t); - req.n.nlmsg_flags |= NLM_F_DUMP; + /* + * kernel can't return 0.0.0.0/8 host route, dump all + * the routes and filter for 0.0.0.0/0 in cb() + */ + if (!dst || !dst->ipv4) + { + req.n.nlmsg_flags |= NLM_F_DUMP; + res.default_only = true; + } + else + { + req.r.rtm_dst_len = 32; + } break; case AF_INET6: res.addr_size = sizeof(struct in6_addr); + /* kernel can return ::/128 host route */ + req.r.rtm_dst_len = 128; break; default: diff --git a/release/src-rt-6.x.4708/router/openvpn/src/openvpn/socket.c b/release/src-rt-6.x.4708/router/openvpn/src/openvpn/socket.c index c486327bae..76bdbfc583 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/openvpn/socket.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/openvpn/socket.c @@ -1141,8 +1141,8 @@ create_socket(struct link_socket *sock, struct addrinfo *addr) #if defined(TARGET_LINUX) if (sock->bind_dev) { - msg (M_INFO, "Using bind-dev %s", sock->bind_dev); - if (setsockopt (sock->sd, SOL_SOCKET, SO_BINDTODEVICE, sock->bind_dev, strlen (sock->bind_dev) + 1) != 0) + msg(M_INFO, "Using bind-dev %s", sock->bind_dev); + if (setsockopt(sock->sd, SOL_SOCKET, SO_BINDTODEVICE, sock->bind_dev, strlen(sock->bind_dev) + 1) != 0) { msg(M_WARN|M_ERRNO, "WARN: setsockopt SO_BINDTODEVICE=%s failed", sock->bind_dev); } @@ -2030,8 +2030,14 @@ phase2_inetd(struct link_socket *sock, const struct frame *frame, } else { - msg(M_WARN, "inetd(%s): getsockname(%d) failed, using AF_INET", + int saved_errno = errno; + msg(M_WARN|M_ERRNO, "inetd(%s): getsockname(%d) failed, using AF_INET", proto2ascii(sock->info.proto, sock->info.af, false), (int)sock->sd); + /* if not called with a socket on stdin, --inetd cannot work */ + if (saved_errno == ENOTSOCK) + { + msg(M_FATAL, "ERROR: socket required for --inetd operation"); + } } } #else /* ifdef HAVE_GETSOCKNAME */ @@ -2047,7 +2053,6 @@ phase2_inetd(struct link_socket *sock, const struct frame *frame, false, sock->inetd == INETD_NOWAIT, signal_received); - } ASSERT(!remote_changed); } diff --git a/release/src-rt-6.x.4708/router/openvpn/src/openvpn/tun.c b/release/src-rt-6.x.4708/router/openvpn/src/openvpn/tun.c index 923131ad5e..651cb87178 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/openvpn/tun.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/openvpn/tun.c @@ -1993,6 +1993,11 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun #ifdef ENABLE_FEATURE_TUN_PERSIST +/* TUNSETGROUP appeared in 2.6.23 */ +#ifndef TUNSETGROUP +# define TUNSETGROUP _IOW('T', 206, int) +#endif + void tuncfg(const char *dev, const char *dev_type, const char *dev_node, int persist_mode, const char *username, const char *groupname, @@ -2032,7 +2037,7 @@ tuncfg(const char *dev, const char *dev_type, const char *dev_node, } else if (ioctl(tt->fd, TUNSETGROUP, platform_state_group.gr->gr_gid) < 0) { - msg(M_ERR, "Cannot ioctl TUNSETOWNER(%s) %s", groupname, dev); + msg(M_ERR, "Cannot ioctl TUNSETGROUP(%s) %s", groupname, dev); } } close_tun(tt, ctx); diff --git a/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/dllmain.c b/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/dllmain.c index 201fd9af46..34946ed8cf 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/dllmain.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/dllmain.c @@ -193,6 +193,6 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) } } - MsiProcessMessage(s->hInstall, INSTALLMESSAGE_ERROR, hRecordProg); + MsiProcessMessage(s->hInstall, (flags & M_WARN) ? INSTALLMESSAGE_INFO : INSTALLMESSAGE_ERROR, hRecordProg); MsiCloseHandle(hRecordProg); } diff --git a/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/openvpnmsica.c b/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/openvpnmsica.c index 31e90bd2db..f203f736ae 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/openvpnmsica.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/openvpnmsica/openvpnmsica.c @@ -1096,12 +1096,9 @@ ProcessDeferredAction(_In_ MSIHANDLE hInstall) dwResult = tap_create_adapter(NULL, NULL, szHardwareId, &bRebootRequired, &guidAdapter); if (dwResult == ERROR_SUCCESS) { - /* Set adapter name. */ - dwResult = tap_set_adapter_name(&guidAdapter, szName); - if (dwResult != ERROR_SUCCESS) - { - tap_delete_adapter(NULL, &guidAdapter, &bRebootRequired); - } + /* Set adapter name. May fail on some machines, but that is not critical - use silent + flag to mute messagebox and print error only to log */ + tap_set_adapter_name(&guidAdapter, szName, TRUE); } } else if (wcsncmp(szArg[i], L"deleteN=", 8) == 0) diff --git a/release/src-rt-6.x.4708/router/openvpn/src/tapctl/main.c b/release/src-rt-6.x.4708/router/openvpn/src/tapctl/main.c index 31bb2ec728..d5bc72909b 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/tapctl/main.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/tapctl/main.c @@ -237,7 +237,7 @@ _tmain(int argc, LPCTSTR argv[]) } /* Rename the adapter. */ - dwResult = tap_set_adapter_name(&guidAdapter, szName); + dwResult = tap_set_adapter_name(&guidAdapter, szName, FALSE); if (dwResult != ERROR_SUCCESS) { StringFromIID((REFIID)&guidAdapter, &szAdapterId); diff --git a/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.c b/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.c index 7cb3dedcb3..dd4a10a314 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.c +++ b/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.c @@ -33,18 +33,69 @@ #include #include #include +#include #ifdef _MSC_VER #pragma comment(lib, "advapi32.lib") #pragma comment(lib, "ole32.lib") #pragma comment(lib, "setupapi.lib") +#pragma comment(lib, "newdev.lib") #endif + const static GUID GUID_DEVCLASS_NET = { 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; const static TCHAR szAdapterRegKeyPathTemplate[] = TEXT("SYSTEM\\CurrentControlSet\\Control\\Network\\%") TEXT(PRIsLPOLESTR) TEXT("\\%") TEXT(PRIsLPOLESTR) TEXT("\\Connection"); #define ADAPTER_REGKEY_PATH_MAX (_countof(TEXT("SYSTEM\\CurrentControlSet\\Control\\Network\\")) - 1 + 38 + _countof(TEXT("\\")) - 1 + 38 + _countof(TEXT("\\Connection"))) +/** + * Dynamically load a library and find a function in it + * + * @param libname Name of the library to load + * @param funcname Name of the function to find + * @param m Pointer to a module. On return this is set to the + * the handle to the loaded library. The caller must + * free it by calling FreeLibrary() if not NULL. + * + * @return Pointer to the function + * NULL on error -- use GetLastError() to find the error code. + * + **/ +static void * +find_function(const WCHAR *libname, const char *funcname, HMODULE *m) +{ + WCHAR libpath[MAX_PATH]; + void *fptr = NULL; + + /* Make sure the dll is loaded from the system32 folder */ + if (!GetSystemDirectoryW(libpath, _countof(libpath))) + { + return NULL; + } + + size_t len = _countof(libpath) - wcslen(libpath) - 1; + if (len < wcslen(libname) + 1) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return NULL; + } + wcsncat(libpath, L"\\", len); + wcsncat(libpath, libname, len-1); + + *m = LoadLibraryW(libpath); + if (*m == NULL) + { + return NULL; + } + fptr = GetProcAddress(*m, funcname); + if (!fptr) + { + FreeLibrary(*m); + *m = NULL; + return NULL; + } + return fptr; +} /** * Returns length of string of strings @@ -678,6 +729,7 @@ tap_create_adapter( _Out_ LPGUID pguidAdapter) { DWORD dwResult; + HMODULE libnewdev = NULL; if (szHwId == NULL || pbRebootRequired == NULL @@ -746,129 +798,7 @@ tap_create_adapter( goto cleanup_hDevInfoList; } - /* Search for the driver. */ - if (!SetupDiBuildDriverInfoList( - hDevInfoList, - &devinfo_data, - SPDIT_CLASSDRIVER)) - { - dwResult = GetLastError(); - msg(M_NONFATAL, "%s: SetupDiBuildDriverInfoList failed", __FUNCTION__); - goto cleanup_hDevInfoList; - } - DWORDLONG dwlDriverVersion = 0; - DWORD drvinfo_detail_data_size = sizeof(SP_DRVINFO_DETAIL_DATA) + 0x100; - SP_DRVINFO_DETAIL_DATA *drvinfo_detail_data = (SP_DRVINFO_DETAIL_DATA *)malloc(drvinfo_detail_data_size); - if (drvinfo_detail_data == NULL) - { - msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, drvinfo_detail_data_size); - dwResult = ERROR_OUTOFMEMORY; goto cleanup_DriverInfoList; - } - - for (DWORD dwIndex = 0;; dwIndex++) - { - /* Get a driver from the list. */ - SP_DRVINFO_DATA drvinfo_data = { .cbSize = sizeof(SP_DRVINFO_DATA) }; - if (!SetupDiEnumDriverInfo( - hDevInfoList, - &devinfo_data, - SPDIT_CLASSDRIVER, - dwIndex, - &drvinfo_data)) - { - if (GetLastError() == ERROR_NO_MORE_ITEMS) - { - break; - } - else - { - /* Something is wrong with this driver. Skip it. */ - msg(M_WARN | M_ERRNO, "%s: SetupDiEnumDriverInfo(%u) failed", __FUNCTION__, dwIndex); - continue; - } - } - - /* Get driver info details. */ - DWORD dwSize; - drvinfo_detail_data->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); - if (!SetupDiGetDriverInfoDetail( - hDevInfoList, - &devinfo_data, - &drvinfo_data, - drvinfo_detail_data, - drvinfo_detail_data_size, - &dwSize)) - { - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - /* (Re)allocate buffer. */ - if (drvinfo_detail_data) - { - free(drvinfo_detail_data); - } - - drvinfo_detail_data_size = dwSize; - drvinfo_detail_data = (SP_DRVINFO_DETAIL_DATA *)malloc(drvinfo_detail_data_size); - if (drvinfo_detail_data == NULL) - { - msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, drvinfo_detail_data_size); - dwResult = ERROR_OUTOFMEMORY; goto cleanup_DriverInfoList; - } - - /* Re-get driver info details. */ - drvinfo_detail_data->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); - if (!SetupDiGetDriverInfoDetail( - hDevInfoList, - &devinfo_data, - &drvinfo_data, - drvinfo_detail_data, - drvinfo_detail_data_size, - &dwSize)) - { - /* Something is wrong with this driver. Skip it. */ - continue; - } - } - else - { - /* Something is wrong with this driver. Skip it. */ - msg(M_WARN | M_ERRNO, "%s: SetupDiGetDriverInfoDetail(\"%hs\") failed", __FUNCTION__, drvinfo_data.Description); - continue; - } - } - - /* Check the driver version and hardware ID. */ - if (dwlDriverVersion < drvinfo_data.DriverVersion - && drvinfo_detail_data->HardwareID - && _tcszistr(drvinfo_detail_data->HardwareID, szHwId)) - { - /* Newer version and matching hardware ID found. Select the driver. */ - if (!SetupDiSetSelectedDriver( - hDevInfoList, - &devinfo_data, - &drvinfo_data)) - { - /* Something is wrong with this driver. Skip it. */ - msg(M_WARN | M_ERRNO, "%s: SetupDiSetSelectedDriver(\"%hs\") failed", __FUNCTION__, drvinfo_data.Description); - continue; - } - - dwlDriverVersion = drvinfo_data.DriverVersion; - } - } - if (drvinfo_detail_data) - { - free(drvinfo_detail_data); - } - - if (dwlDriverVersion == 0) - { - dwResult = ERROR_NOT_FOUND; - msg(M_NONFATAL, "%s: No driver for device \"%" PRIsLPTSTR "\" installed.", __FUNCTION__, szHwId); - goto cleanup_DriverInfoList; - } - - /* Call appropriate class installer. */ + /* Register the device instance with the PnP Manager */ if (!SetupDiCallClassInstaller( DIF_REGISTERDEVICE, hDevInfoList, @@ -876,43 +806,38 @@ tap_create_adapter( { dwResult = GetLastError(); msg(M_NONFATAL, "%s: SetupDiCallClassInstaller(DIF_REGISTERDEVICE) failed", __FUNCTION__); - goto cleanup_DriverInfoList; + goto cleanup_hDevInfoList; } - /* Register device co-installers if any. */ - if (!SetupDiCallClassInstaller( - DIF_REGISTER_COINSTALLERS, - hDevInfoList, - &devinfo_data)) - { - dwResult = GetLastError(); - msg(M_WARN | M_ERRNO, "%s: SetupDiCallClassInstaller(DIF_REGISTER_COINSTALLERS) failed", __FUNCTION__); - } + /* Install the device using DiInstallDevice() + * We instruct the system to use the best driver in the driver store + * by setting the drvinfo argument of DiInstallDevice as NULL. This + * assumes a driver is already installed in the driver store. + */ +#ifdef HAVE_DIINSTALLDEVICE + if (!DiInstallDevice(hwndParent, hDevInfoList, &devinfo_data, NULL, 0, pbRebootRequired)) +#else + /* mingw does not resolve DiInstallDevice, so load it at run time. */ + typedef BOOL (WINAPI *DiInstallDeviceFn) (HWND, HDEVINFO, SP_DEVINFO_DATA *, + SP_DRVINFO_DATA *, DWORD, BOOL *); + DiInstallDeviceFn installfn + = find_function (L"newdev.dll", "DiInstallDevice", &libnewdev); - /* Install adapters if any. */ - if (!SetupDiCallClassInstaller( - DIF_INSTALLINTERFACES, - hDevInfoList, - &devinfo_data)) + if (!installfn) { dwResult = GetLastError(); - msg(M_WARN | M_ERRNO, "%s: SetupDiCallClassInstaller(DIF_INSTALLINTERFACES) failed", __FUNCTION__); + msg(M_NONFATAL | M_ERRNO, "%s: Failed to locate DiInstallDevice()", __FUNCTION__); + goto cleanup_hDevInfoList; } - /* Install the device. */ - if (!SetupDiCallClassInstaller( - DIF_INSTALLDEVICE, - hDevInfoList, - &devinfo_data)) + if (!installfn(hwndParent, hDevInfoList, &devinfo_data, NULL, 0, pbRebootRequired)) +#endif { dwResult = GetLastError(); - msg(M_NONFATAL | M_ERRNO, "%s: SetupDiCallClassInstaller(DIF_INSTALLDEVICE) failed", __FUNCTION__); + msg(M_NONFATAL | M_ERRNO, "%s: DiInstallDevice failed", __FUNCTION__); goto cleanup_remove_device; } - /* Check if a system reboot is required. (Ignore errors) */ - check_reboot(hDevInfoList, &devinfo_data, pbRebootRequired); - /* Get network adapter ID from registry. Retry for max 30sec. */ dwResult = get_net_adapter_guid(hDevInfoList, &devinfo_data, 30, pguidAdapter); @@ -958,13 +883,11 @@ cleanup_remove_device: } } -cleanup_DriverInfoList: - SetupDiDestroyDriverInfoList( - hDevInfoList, - &devinfo_data, - SPDIT_CLASSDRIVER); - cleanup_hDevInfoList: + if (libnewdev) + { + FreeLibrary(libnewdev); + } SetupDiDestroyDeviceInfoList(hDevInfoList); return dwResult; } @@ -1140,9 +1063,12 @@ ExecCommand(const WCHAR* cmdline) DWORD tap_set_adapter_name( _In_ LPCGUID pguidAdapter, - _In_ LPCTSTR szName) + _In_ LPCTSTR szName, + _In_ BOOL bSilent) { DWORD dwResult; + int msg_flag = bSilent ? M_WARN : M_NONFATAL; + msg_flag |= M_ERRNO; if (pguidAdapter == NULL || szName == NULL) { @@ -1176,7 +1102,7 @@ tap_set_adapter_name( if (dwResult != ERROR_SUCCESS) { SetLastError(dwResult); /* MSDN does not mention RegOpenKeyEx() to set GetLastError(). But we do have an error code. Set last error manually. */ - msg(M_NONFATAL | M_ERRNO, "%s: RegOpenKeyEx(HKLM, \"%" PRIsLPTSTR "\") failed", __FUNCTION__, szRegKey); + msg(msg_flag, "%s: RegOpenKeyEx(HKLM, \"%" PRIsLPTSTR "\") failed", __FUNCTION__, szRegKey); goto cleanup_szAdapterId; } @@ -1185,7 +1111,7 @@ tap_set_adapter_name( if (dwResult != ERROR_SUCCESS) { SetLastError(dwResult); - msg(M_NONFATAL | M_ERRNO, "%s: Error reading adapter name", __FUNCTION__); + msg(msg_flag, "%s: Error reading adapter name", __FUNCTION__); goto cleanup_hKey; } @@ -1203,7 +1129,7 @@ tap_set_adapter_name( if (dwResult != ERROR_SUCCESS) { SetLastError(dwResult); - msg(M_NONFATAL | M_ERRNO, "%s: Error renaming adapter", __FUNCTION__); + msg(msg_flag, "%s: Error renaming adapter", __FUNCTION__); goto cleanup_hKey; } diff --git a/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.h b/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.h index 102de32d62..63d791c985 100644 --- a/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.h +++ b/release/src-rt-6.x.4708/router/openvpn/src/tapctl/tap.h @@ -118,12 +118,16 @@ tap_enable_adapter( * * @param szName New adapter name - must be unique * + * @param bSilent If true, MSI installer won't display message box and + * only print error to log. + * * @return ERROR_SUCCESS on success; Win32 error code otherwise **/ DWORD tap_set_adapter_name( _In_ LPCGUID pguidAdapter, - _In_ LPCTSTR szName); + _In_ LPCTSTR szName, + _In_ BOOL bSilent); /** diff --git a/release/src-rt-6.x.4708/router/openvpn/version.m4 b/release/src-rt-6.x.4708/router/openvpn/version.m4 index db690c7d6e..903c87a82c 100644 --- a/release/src-rt-6.x.4708/router/openvpn/version.m4 +++ b/release/src-rt-6.x.4708/router/openvpn/version.m4 @@ -3,12 +3,12 @@ define([PRODUCT_NAME], [OpenVPN]) define([PRODUCT_TARNAME], [openvpn]) define([PRODUCT_VERSION_MAJOR], [2]) define([PRODUCT_VERSION_MINOR], [5]) -define([PRODUCT_VERSION_PATCH], [_beta3]) +define([PRODUCT_VERSION_PATCH], [_beta4]) m4_append([PRODUCT_VERSION], [PRODUCT_VERSION_MAJOR]) m4_append([PRODUCT_VERSION], [PRODUCT_VERSION_MINOR], [[.]]) m4_append([PRODUCT_VERSION], [PRODUCT_VERSION_PATCH], [[]]) define([PRODUCT_BUGREPORT], [openvpn-users@lists.sourceforge.net]) -define([PRODUCT_VERSION_RESOURCE], [2,5,0,3]) +define([PRODUCT_VERSION_RESOURCE], [2,5,0,4]) dnl define the TAP version define([PRODUCT_TAP_WIN_COMPONENT_ID], [tap0901]) define([PRODUCT_TAP_WIN_MIN_MAJOR], [9]) diff --git a/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile b/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile index 162f55e0dd..2e46bdce07 100644 --- a/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile +++ b/release/src-rt-6.x.4708/router/openvpn_plugin_auth_nvram/Makefile @@ -1,14 +1,20 @@ include ../common.mak -CFLAGS = -Os -Wall $(EXTRACFLAGS) -CFLAGS += -I$(SRCBASE)/include -I$(TOP)/openvpn/include -LDFLAGS = -L$(TOP)/nvram${BCMEX} -lnvram -OBJS = openvpn_plugin_auth_nvram.o +CFLAGS = -Os -Wall $(EXTRACFLAGS) +CFLAGS += -I$(SRCBASE)/include -I$(TOP)/$(OPENSSLDIR)/include -I$(TOP)/openvpn/include + +ifeq ($(TCONFIG_BCMARM),y) +LDFLAGS = -L$(TOP)/nvram${BCMEX} -lnvram -L$(TOP)/$(OPENSSLDIR) -L$(TOP)/openvpn +else +LDFLAGS = -L$(TOP)/nvram -lnvram -L$(TOP)/$(OPENSSLDIR) -L$(TOP)/openvpn +endif ifeq ($(TCONFIG_BCMARM),y) LIBS += -lgcc_s endif +OBJS = openvpn_plugin_auth_nvram.o + all: openvpn_plugin_auth_nvram.so openvpn_plugin_auth_nvram.so: $(OBJS) diff --git a/release/src-rt-6.x.4708/router/patches/busybox/101-tomato-specific.patch b/release/src-rt-6.x.4708/router/patches/busybox/101-tomato-specific.patch new file mode 100644 index 0000000000..8c09ca88de --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/101-tomato-specific.patch @@ -0,0 +1,154 @@ +--- busybox/Makefile ++++ busybox/Makefile +@@ -471,6 +471,8 @@ + coreutils/libcoreutils/ \ + debianutils/ \ + e2fsprogs/ \ ++ e2fsprogs/e2p/ \ ++ e2fsprogs/ext2fs/ \ + editors/ \ + findutils/ \ + init/ \ +--- busybox/modutils/modprobe.c ++++ busybox/modutils/modprobe.c +@@ -417,7 +417,7 @@ + if (option_mask32 & OPT_REMOVE) { + /* modprobe -r */ + if (m2->flags & MODULE_FLAG_LOADED) { +- rc = bb_delete_module(m2->modname, O_EXCL); ++ rc = bb_delete_module(m2->modname, O_NONBLOCK | O_EXCL); + if (rc) { + if (first) { + bb_perror_msg("can't unload module '%s'", +--- busybox/networking/udhcp/dhcpc.c ++++ busybox/networking/udhcp/dhcpc.c +@@ -60,6 +60,7 @@ + "request\0" Required_argument "r" + "script\0" Required_argument "s" + "timeout\0" Required_argument "T" ++ "version\0" No_argument "v" + "retries\0" Required_argument "t" + "tryagain\0" Required_argument "A" + "syslog\0" No_argument "S" +@@ -113,7 +114,7 @@ + [OPTION_IP ] = sizeof("255.255.255.255 "), + [OPTION_IP_PAIR ] = sizeof("255.255.255.255 ") * 2, + [OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "), +- [OPTION_6RD ] = sizeof("132 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "), ++ [OPTION_6RD ] = sizeof("132 128 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 255.255.255.255 "), + [OPTION_STRING ] = 1, + [OPTION_STRING_HOST ] = 1, + #if ENABLE_FEATURE_UDHCP_RFC3397 +@@ -1095,11 +1096,11 @@ + bb_error_msg("performing DHCP renew"); + switch (state) { + case BOUND: +- change_listen_mode(LISTEN_KERNEL); ++ change_listen_mode(LISTEN_RAW); + case RENEWING: + case REBINDING: +- state = RENEW_REQUESTED; +- break; ++ //state = RENEW_REQUESTED; ++ //break; + case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ + udhcp_run_script(NULL, "deconfig"); + case REQUESTING: +@@ -1232,6 +1233,7 @@ + //usage: "\n -x lease:3600 - option 51 (lease time)" + //usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)" + //usage: "\n -F NAME Ask server to update DNS mapping for NAME" ++//usage: "\n -H,-h NAME Send NAME as client hostname (default none)" + //usage: "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')" + //usage: "\n -C Don't send MAC as client identifier" + //usage: IF_UDHCP_VERBOSE( +@@ -1521,7 +1523,7 @@ + /* 1/2 lease passed, enter renewing state */ + state = RENEWING; + client_config.first_secs = 0; /* make secs field count from 0 */ +- change_listen_mode(LISTEN_KERNEL); ++ change_listen_mode(LISTEN_RAW); + log1("entering renew state"); + /* fall right through */ + case RENEW_REQUESTED: /* manual (SIGUSR1) renew */ +@@ -1578,7 +1580,7 @@ + switch (udhcp_sp_read(&rfds)) { + case SIGUSR1: + client_config.first_secs = 0; /* make secs field count from 0 */ +- already_waited_sec = 0; ++ //already_waited_sec = 0; /* breaks tomato renew button */ + perform_renew(); + if (state == RENEW_REQUESTED) { + /* We might be either on the same network +@@ -1591,8 +1593,8 @@ + * (Ab)use -A TIMEOUT value (usually 20 sec) + * as a cap on the timeout. + */ +- if (timeout > tryagain_timeout) +- timeout = tryagain_timeout; ++ //if (timeout > tryagain_timeout) /* breaks tomato renew button */ ++ //timeout = tryagain_timeout; /* breaks tomato renew button */ + goto case_RENEW_REQUESTED; + } + /* Start things over */ +--- busybox/libbb/bb_strtonum.c ++++ busybox/libbb/bb_strtonum.c +@@ -62,7 +62,8 @@ + + /* strtoul(" -4200000000") returns 94967296, errno 0 (!) */ + /* I don't think that this is right. Preventing this... */ +- if (!isalnum(arg[0])) return ret_ERANGE(); ++ char first = (arg[0] != '-' ? arg[0] : arg[1]); ++ if (!isalnum(first)) return ret_ERANGE(); + + /* not 100% correct for lib func, but convenient for the caller */ + errno = 0; +--- busybox/util-linux/volume_id/util2.c ++++ busybox/util-linux/volume_id/util2.c +@@ -0,0 +1,11 @@ ++/* util.c is now split apart, for the benefit of Tomato. So it can ++ * pull in just enough busybox code to read disc labels, without ++ * dragging in other un-needed stuff. ++ * It would be better if Tomato could use "busybox.so", but busybox ++ * can't currently build a shared .so configuration. ++ */ ++ ++//kbuild:lib-$(CONFIG_VOLUMEID) += util2.o ++ ++#define UTIL2 ++#include "util.c" +--- busybox/util-linux/volume_id/util.c ++++ busybox/util-linux/volume_id/util.c +@@ -20,6 +20,7 @@ + + #include "volume_id_internal.h" + ++#ifdef UTIL2 + void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) + { + unsigned i, j; +@@ -57,7 +58,9 @@ + } + str[j] = '\0'; + } ++#endif + ++#ifndef UTIL2 + #ifdef UNUSED + static const char *usage_to_string(enum volume_id_usage usage_id) + { +@@ -112,6 +115,9 @@ + } + #endif + ++#endif ++#ifdef UTIL2 ++ + void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) + { + unsigned i; +@@ -263,3 +269,4 @@ + id->seekbuf_len = 0; + id->seekbuf_off = 0; /* paranoia */ + } ++#endif diff --git a/release/src-rt-6.x.4708/router/patches/busybox/102-add-missing-s-to-printf.patch b/release/src-rt-6.x.4708/router/patches/busybox/102-add-missing-s-to-printf.patch new file mode 100644 index 0000000000..d35eb6595a --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/102-add-missing-s-to-printf.patch @@ -0,0 +1,11 @@ +--- busybox/applets/usage_pod.c ++++ busybox/applets/usage_pod.c +@@ -71,7 +71,7 @@ + } else { + printf(", "); + } +- printf(usage_array[i].aname); ++ printf("%s", usage_array[i].aname); + col += len2; + } + printf("\n\n"); diff --git a/release/src-rt-6.x.4708/router/patches/busybox/103-cosmetics-from-tomato-miscset-branch.patch b/release/src-rt-6.x.4708/router/patches/busybox/103-cosmetics-from-tomato-miscset-branch.patch new file mode 100644 index 0000000000..95ce0c6087 --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/103-cosmetics-from-tomato-miscset-branch.patch @@ -0,0 +1,11 @@ +--- busybox/coreutils/df.c ++++ busybox/coreutils/df.c +@@ -178,6 +178,8 @@ + device = mount_entry->mnt_fsname; + mount_point = mount_entry->mnt_dir; + fs_type = mount_entry->mnt_type; ++ if (strcmp(mount_point, "proc") == 0 || strcmp(mount_point, "ramfs") == 0) ++ continue; + + if (statfs(mount_point, &s) != 0) { + bb_simple_perror_msg(mount_point); diff --git a/release/src-rt-6.x.4708/router/patches/busybox/104-add-opt-bin-and-opt-sbin-to-PATH.patch b/release/src-rt-6.x.4708/router/patches/busybox/104-add-opt-bin-and-opt-sbin-to-PATH.patch new file mode 100644 index 0000000000..6dc98456bf --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/104-add-opt-bin-and-opt-sbin-to-PATH.patch @@ -0,0 +1,22 @@ +--- busybox/include/libbb.h ++++ busybox/include/libbb.h +@@ -1830,7 +1830,7 @@ + * but I want to save a few bytes here */ + extern const char bb_PATH_root_path[] ALIGN1; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */ + #define bb_default_root_path (bb_PATH_root_path + sizeof("PATH")) +-#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin")) ++#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin:/opt/sbin")) + + extern const int const_int_0; + //extern const int const_int_1; +--- busybox/libbb/messages.c ++++ busybox/libbb/messages.c +@@ -40,7 +40,7 @@ + /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, + * but I want to save a few bytes here. Check libbb.h before changing! */ + const char bb_PATH_root_path[] ALIGN1 = +- "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH; ++ "PATH=/sbin:/usr/sbin:/opt/sbin:/bin:/usr/bin:/opt/bin" BB_ADDITIONAL_PATH; + + + //const int const_int_1 = 1; diff --git a/release/src-rt-6.x.4708/router/patches/busybox/105-no_static_libgcc.patch b/release/src-rt-6.x.4708/router/patches/busybox/105-no_static_libgcc.patch new file mode 100644 index 0000000000..9a87118f52 --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/105-no_static_libgcc.patch @@ -0,0 +1,11 @@ +--- busybox/Makefile.flags ++++ busybox/Makefile.flags +@@ -51,7 +51,7 @@ + # -fno-guess-branch-probability: prohibit pseudo-random guessing + # of branch probabilities (hopefully makes bloatcheck more stable): + CFLAGS += $(call cc-option,-fno-guess-branch-probability,) +-CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,) ++CFLAGS += $(call cc-option,-funsigned-char -shared-libgcc,) + CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,) + # Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary): + CFLAGS += $(call cc-option,-fno-unwind-tables,) diff --git a/release/src-rt-6.x.4708/router/patches/busybox/106-insmod-fixes-modules-with-short-names-return-codes.patch b/release/src-rt-6.x.4708/router/patches/busybox/106-insmod-fixes-modules-with-short-names-return-codes.patch new file mode 100644 index 0000000000..8fcf3a5fb6 --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/106-insmod-fixes-modules-with-short-names-return-codes.patch @@ -0,0 +1,114 @@ +--- busybox/modutils/insmod.c ++++ busybox/modutils/insmod.c +@@ -11,6 +11,7 @@ + + #include "libbb.h" + #include "modutils.h" ++#include + + /* 2.6 style insmod has no options and required filename + * (not module name - .ko can't be omitted) */ +@@ -35,10 +36,34 @@ + //usage: ) + //usage:#endif + ++static char *m_filename; ++ ++static int FAST_FUNC check_module_name_match(const char *filename, ++ struct stat *statbuf UNUSED_PARAM, ++ void *userdata, int depth UNUSED_PARAM) ++{ ++ char *fullname = (char *) userdata; ++ char *tmp; ++ ++ if (fullname[0] == '\0') ++ return FALSE; ++ ++ tmp = bb_get_last_path_component_nostrip(filename); ++ if (strcmp(tmp, fullname) == 0) { ++ /* Stop searching if we find a match */ ++ m_filename = xstrdup(filename); ++ return FALSE; ++ } ++ return TRUE; ++} ++ + int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; + int insmod_main(int argc UNUSED_PARAM, char **argv) + { ++ struct stat st; + char *filename; ++ FILE *fp = NULL; ++ int pos; + int rc; + + /* Compat note: +@@ -58,9 +83,45 @@ + if (!filename) + bb_show_usage(); + ++ m_filename = NULL; ++ ++ pos = strlen(filename) - 2; ++ if (get_linux_version_code() < KERNEL_VERSION(2,6,0)) { ++ if (pos < 0) pos = 0; ++ if (strncmp(&filename[pos], ".o", 2) !=0) ++ filename = xasprintf("%s.o", filename); ++ } else { ++ if (--pos < 0) pos = 0; ++ if (strncmp(&filename[pos], ".ko", 3) !=0) ++ filename = xasprintf("%s.ko", filename); ++ } ++ ++ /* Get a filedesc for the module. Check if we have a complete path */ ++ if (stat(filename, &st) < 0 || !S_ISREG(st.st_mode) || ++ (fp = fopen_for_read(filename)) == NULL) { ++ /* Hmm. Could not open it. Search /lib/modules/ */ ++ int r; ++ char *module_dir; ++ ++ module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR); ++ if (!module_dir) ++ module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR); ++ r = recursive_action(module_dir, ACTION_RECURSE, ++ check_module_name_match, NULL, filename, 0); ++ free(module_dir); ++ if (r) ++ bb_error_msg_and_die("'%s': module not found", filename); ++ if (m_filename == NULL || ((fp = fopen_for_read(m_filename)) == NULL)) ++ bb_error_msg_and_die("'%s': module not found", filename); ++ filename = m_filename; ++ } ++ if (fp != NULL) ++ fclose(fp); ++ + rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0)); + if (rc) + bb_error_msg("can't insert '%s': %s", filename, moderror(rc)); + ++ free(m_filename); + return rc; + } +--- busybox/modutils/modutils-24.c ++++ busybox/modutils/modutils-24.c +@@ -3824,7 +3824,7 @@ + /* Load module into memory and unzip if compressed */ + image = xmalloc_open_zipped_read_close(m_filename, &image_size); + if (!image) +- return EXIT_FAILURE; ++ return (-errno); + } + + m_name = xstrdup(bb_basename(m_filename)); +@@ -3855,8 +3855,10 @@ + "\twhile this kernel is version %s", + flag_force_load ? "warning: " : "", + m_name, m_strversion, uts.release); +- if (!flag_force_load) ++ if (!flag_force_load) { ++ exit_status = ESRCH; + goto out; ++ } + } + } + #endif diff --git a/release/src-rt-6.x.4708/router/patches/busybox/107-fix-formating.patch b/release/src-rt-6.x.4708/router/patches/busybox/107-fix-formating.patch new file mode 100644 index 0000000000..f145cfbb4b --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/107-fix-formating.patch @@ -0,0 +1,79 @@ +--- busybox/networking/interface.c ++++ busybox/networking/interface.c +@@ -885,7 +885,7 @@ + inet_pton(AF_INET6, addr6, + (struct sockaddr *) &sap.sin6_addr); + sap.sin6_family = AF_INET6; +- printf(" inet6 addr: %s/%d", ++ printf(" inet6 addr: %s/%d", + INET6_sprint((struct sockaddr *) &sap, 1), + plen); + printf(" Scope:"); +@@ -936,7 +936,7 @@ + if (hw == NULL) + hw = get_hwntype(-1); + +- printf("%-9s Link encap:%s ", ptr->name, hw->title); ++ printf("%-10s Link encap:%s ", ptr->name, hw->title); + /* For some hardware types (eg Ash, ATM) we don't print the + hardware address if it's null. */ + if (hw->print != NULL +@@ -954,7 +954,7 @@ + bb_putchar('\n'); + + if (ptr->has_ip) { +- printf(" %s addr:%s ", ap->name, ++ printf(" %s addr:%s ", ap->name, + ap->sprint(&ptr->addr, 1)); + if (ptr->flags & IFF_POINTOPOINT) { + printf(" P-t-P:%s ", ap->sprint(&ptr->dstaddr, 1)); +@@ -967,7 +967,7 @@ + + ife_print6(ptr); + +- printf(" "); ++ printf(" "); + /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ + + if (ptr->flags == 0) { +@@ -1035,26 +1035,26 @@ + * not for the aliases, although strictly speaking they're shared + * by all addresses. + */ +- printf(" "); ++ printf(" "); + + printf("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n", + ptr->stats.rx_packets, ptr->stats.rx_errors, + ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, + ptr->stats.rx_frame_errors); + if (can_compress) +- printf(" compressed:%lu\n", ++ printf(" compressed:%lu\n", + ptr->stats.rx_compressed); +- printf(" "); ++ printf(" "); + printf("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n", + ptr->stats.tx_packets, ptr->stats.tx_errors, + ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, + ptr->stats.tx_carrier_errors); +- printf(" collisions:%lu ", ptr->stats.collisions); ++ printf(" collisions:%lu ", ptr->stats.collisions); + if (can_compress) + printf("compressed:%lu ", ptr->stats.tx_compressed); + if (ptr->tx_queue_len != -1) + printf("txqueuelen:%d ", ptr->tx_queue_len); +- printf("\n R"); ++ printf("\n R"); + print_bytes_scaled(ptr->stats.rx_bytes, " T"); + print_bytes_scaled(ptr->stats.tx_bytes, "\n"); + } +@@ -1062,7 +1062,7 @@ + if (ptr->map.irq || ptr->map.mem_start + || ptr->map.dma || ptr->map.base_addr + ) { +- printf(" "); ++ printf(" "); + if (ptr->map.irq) + printf("Interrupt:%d ", ptr->map.irq); + if (ptr->map.base_addr >= 0x100) /* Only print devices using it for I/O maps */ diff --git a/release/src-rt-6.x.4708/router/patches/busybox/108-enable-correct-behavior-of-ctrl-c-within-a-telnet-session.patch b/release/src-rt-6.x.4708/router/patches/busybox/108-enable-correct-behavior-of-ctrl-c-within-a-telnet-session.patch new file mode 100644 index 0000000000..5767573d8e --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/108-enable-correct-behavior-of-ctrl-c-within-a-telnet-session.patch @@ -0,0 +1,10 @@ +--- busybox/networking/telnetd.c ++++ busybox/networking/telnetd.c +@@ -333,6 +333,7 @@ + + /* Restore default signal handling ASAP */ + bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL); ++ signal(SIGINT, SIG_DFL); + + pid = getpid(); + diff --git a/release/src-rt-6.x.4708/router/patches/busybox/109-udhcpc-anounce-max-dhcp-pkt-size-according-to-client-mtu.patch b/release/src-rt-6.x.4708/router/patches/busybox/109-udhcpc-anounce-max-dhcp-pkt-size-according-to-client-mtu.patch new file mode 100644 index 0000000000..14f1d451ac --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/109-udhcpc-anounce-max-dhcp-pkt-size-according-to-client-mtu.patch @@ -0,0 +1,114 @@ +--- busybox/networking/udhcp/common.h ++++ busybox/networking/udhcp/common.h +@@ -303,7 +303,7 @@ + int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC; + int udhcp_sp_read(const fd_set *rfds) FAST_FUNC; + +-int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) FAST_FUNC; ++int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac, uint16_t *mtu) FAST_FUNC; + + int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC; + +--- busybox/networking/udhcp/dhcpc.c ++++ busybox/networking/udhcp/dhcpc.c +@@ -608,7 +608,10 @@ + { + int i, end, len; + +- udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(IP_UDP_DHCP_SIZE)); ++ len = sizeof(struct ip_udp_dhcp_packet); ++ if (client_config.client_mtu == 0 || ++ client_config.client_mtu > len) ++ udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(len)); + + /* Add a "param req" option with the list of options we'd like to have + * from stubborn DHCP servers. Pull the data from the struct in common.c. +@@ -1357,7 +1360,8 @@ + if (udhcp_read_interface(client_config.interface, + &client_config.ifindex, + NULL, +- client_config.client_mac) ++ client_config.client_mac, ++ &client_config.client_mtu) + ) { + return 1; + } +@@ -1464,7 +1468,8 @@ + if (udhcp_read_interface(client_config.interface, + &client_config.ifindex, + NULL, +- client_config.client_mac) ++ client_config.client_mac, ++ &client_config.client_mtu) + ) { + goto ret0; /* iface is gone? */ + } +--- busybox/networking/udhcp/dhcpc.h ++++ busybox/networking/udhcp/dhcpc.h +@@ -9,6 +9,7 @@ + + struct client_config_t { + uint8_t client_mac[6]; /* Our mac address */ ++ uint16_t client_mtu; /* Our mtu */ + IF_FEATURE_UDHCP_PORT(uint16_t port;) + int ifindex; /* Index number of the interface to use */ + uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */ +--- busybox/networking/udhcp/dhcpd.c ++++ busybox/networking/udhcp/dhcpd.c +@@ -384,7 +384,8 @@ + if (udhcp_read_interface(server_config.interface, + &server_config.ifindex, + (server_config.server_nip == 0 ? &server_config.server_nip : NULL), +- server_config.server_mac) ++ server_config.server_mac, ++ NULL) + ) { + retval = 1; + goto ret; +--- busybox/networking/udhcp/dhcprelay.c ++++ busybox/networking/udhcp/dhcprelay.c +@@ -280,7 +280,7 @@ + max_socket = init_sockets(iface_list, num_sockets, fds); + + /* Get our IP on server_iface */ +- if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL)) ++ if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL, NULL)) + return 1; + + /* Main loop */ +@@ -360,7 +360,7 @@ + // of the 'giaddr' field does not match one of the relay agent's + // directly-connected logical interfaces, the BOOTREPLY messsage MUST be + // silently discarded. +- if (udhcp_read_interface(iface_list[i], NULL, &dhcp_msg.gateway_nip, NULL)) { ++ if (udhcp_read_interface(iface_list[i], NULL, &dhcp_msg.gateway_nip, NULL, NULL)) { + /* Fall back to our IP on server iface */ + // this makes more sense! + dhcp_msg.gateway_nip = our_nip; +--- busybox/networking/udhcp/socket.c ++++ busybox/networking/udhcp/socket.c +@@ -25,7 +25,7 @@ + #include "common.h" + #include + +-int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) ++int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac, uint16_t *mtu) + { + /* char buffer instead of bona-fide struct avoids aliasing warning */ + char ifr_buf[sizeof(struct ifreq)]; +@@ -70,6 +70,15 @@ + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + } + ++ if (mtu) { ++ if (ioctl_or_warn(fd, SIOCGIFMTU, ifr) != 0) { ++ close(fd); ++ return -1; ++ } ++ log1("Adapter mtu %d", ifr->ifr_mtu); ++ *mtu = ifr->ifr_mtu; ++ } ++ + close(fd); + return 0; + } diff --git a/release/src-rt-6.x.4708/router/patches/busybox/110-dhcpc-make-packets-truncate-optional.patch b/release/src-rt-6.x.4708/router/patches/busybox/110-dhcpc-make-packets-truncate-optional.patch new file mode 100644 index 0000000000..aadab5298c --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/110-dhcpc-make-packets-truncate-optional.patch @@ -0,0 +1,73 @@ +--- busybox/networking/udhcp/common.h ++++ busybox/networking/udhcp/common.h +@@ -74,6 +74,8 @@ + char c[IP_UDP_DHCP_SIZE == 576 ? 1 : -1]; + }; + ++extern int minpkt; ++ + + /*** Options ***/ + +--- busybox/networking/udhcp/dhcpc.c ++++ busybox/networking/udhcp/dhcpc.c +@@ -96,8 +96,9 @@ + OPT_x = 1 << 18, + OPT_f = 1 << 19, + OPT_B = 1 << 20, ++ OPT_m = 1 << 21, + /* The rest has variable bit positions, need to be clever */ +- OPTBIT_B = 20, ++ OPTBIT_LAST = 21, + USE_FOR_MMU( OPTBIT_b,) + IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,) + IF_FEATURE_UDHCP_PORT( OPTBIT_P,) +@@ -1287,6 +1288,7 @@ + opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ; + IF_LONG_OPTS(applet_long_options = udhcpc_longopts;) + opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB" ++ "m" + USE_FOR_MMU("b") + IF_FEATURE_UDHCPC_ARPING("a::") + IF_FEATURE_UDHCP_PORT("P:") +@@ -1357,6 +1359,9 @@ + udhcp_str2optset(optstr, &client_config.options); + } + ++ if (opt & OPT_m) ++ minpkt = 1; ++ + if (udhcp_read_interface(client_config.interface, + &client_config.ifindex, + NULL, +--- busybox/networking/udhcp/packet.c ++++ busybox/networking/udhcp/packet.c +@@ -12,6 +12,8 @@ + #include + #include + ++int minpkt = 0; ++ + void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) + { + memset(packet, 0, sizeof(*packet)); +@@ -149,7 +151,9 @@ + * Thus, we retain enough padding to not go below 300 BOOTP bytes. + * Some devices have filters which drop DHCP packets shorter than that. + */ +- padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options); ++ ++ padding = (minpkt ? DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options) : 0); ++ + if (padding > DHCP_SIZE - 300) + padding = DHCP_SIZE - 300; + +@@ -221,7 +225,7 @@ + } + + udhcp_dump_packet(dhcp_pkt); +- padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); ++ padding = (minpkt ? DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options) : 0); + if (padding > DHCP_SIZE - 300) + padding = DHCP_SIZE - 300; + result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); diff --git a/release/src-rt-6.x.4708/router/patches/busybox/111-udhcpc_reduce_msgs.patch b/release/src-rt-6.x.4708/router/patches/busybox/111-udhcpc_reduce_msgs.patch new file mode 100644 index 0000000000..cc5debd012 --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/111-udhcpc_reduce_msgs.patch @@ -0,0 +1,20 @@ +--- busybox/networking/udhcp/dhcpc.c ++++ busybox/networking/udhcp/dhcpc.c +@@ -702,6 +702,7 @@ + static NOINLINE int send_discover(uint32_t xid, uint32_t requested) + { + struct dhcp_packet packet; ++ static int msgs = 0; + + /* Fill in: op, htype, hlen, cookie, chaddr fields, + * random xid field (we override it below), +@@ -719,7 +720,8 @@ + */ + add_client_options(&packet); + +- bb_error_msg("sending %s", "discover"); ++ if (msgs++ < 3) ++ bb_error_msg("sending %s", "discover"); + return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY); + } + diff --git a/release/src-rt-6.x.4708/router/patches/busybox/112-udhcpc_renew_no_deconfig.patch b/release/src-rt-6.x.4708/router/patches/busybox/112-udhcpc_renew_no_deconfig.patch new file mode 100644 index 0000000000..1ad2d181bc --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/112-udhcpc_renew_no_deconfig.patch @@ -0,0 +1,10 @@ +--- busybox/networking/udhcp/dhcpc.c ++++ busybox/networking/udhcp/dhcpc.c +@@ -1108,7 +1108,6 @@ + //state = RENEW_REQUESTED; + //break; + case RENEW_REQUESTED: /* impatient are we? fine, square 1 */ +- udhcp_run_script(NULL, "deconfig"); + case REQUESTING: + case RELEASED: + change_listen_mode(LISTEN_RAW); diff --git a/release/src-rt-6.x.4708/router/patches/busybox/117-wget-add-TLS-SNI-support-via-openssl-s_client.patch b/release/src-rt-6.x.4708/router/patches/busybox/117-wget-add-TLS-SNI-support-via-openssl-s_client.patch new file mode 100644 index 0000000000..f9f4419fc4 --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/117-wget-add-TLS-SNI-support-via-openssl-s_client.patch @@ -0,0 +1,127 @@ +--- busybox/networking/wget.c ++++ busybox/networking/wget.c +@@ -61,16 +61,22 @@ + //config: Busybox itself contains no SSL code. wget will spawn + //config: a helper program to talk over HTTPS. + //config: +-//config: OpenSSL has a simple SSL client for debug purposes. +-//config: If you select "openssl" helper, wget will effectively call +-//config: "openssl s_client -quiet -connect IP:443 2>/dev/null" +-//config: and pipe its data through it. ++//config: If you select "openssl" helper, wget will effectively run: ++//config: "openssl s_client -quiet -connect hostname:443 ++//config: -servername hostname 2>/dev/null" and pipe its data ++//config: through it. (-servername should only be used with FQDNs, ++//config: not IP addresses.) + //config: Note inconvenient API: host resolution is done twice, + //config: and there is no guarantee openssl's idea of IPv6 address + //config: format is the same as ours. + //config: Another problem is that s_client prints debug information + //config: to stderr, and it needs to be suppressed. This means + //config: all error messages get suppressed too. ++//config: Also, if the s_client subcommand is not compiled in to ++//config: the system's openssl binary (i.e. subcommand fails), or ++//config: certain subcommand flags aren't available/supported, ++//config: openssl returns exit code 0, making it difficult to ++//config: detect a true error/failure. + //config: openssl is also a big binary, often dynamically linked + //config: against ~15 libraries. + //config: +@@ -349,6 +355,25 @@ + # define clear_alarm() ((void)0) + #endif + ++/* ++ * is_ip_address() attempts to verify whether or not a string ++ * contains an IPv4 or IPv6 address (vs. an FQDN). The result ++ * of inet_pton() can be used to determine this. ++ * ++ * TODO add proper error checking when inet_pton() returns -1 ++ * (some form of system error has occurred, and errno is set) ++ */ ++static int is_ip_address(const char *string) ++{ ++ struct sockaddr_in sa; ++ int result = inet_pton(AF_INET, string, &(sa.sin_addr)); ++ ++ if (ENABLE_FEATURE_IPV6 && result == 0) { ++ result = inet_pton(AF_INET6, string, &(sa.sin_addr)); ++ } ++ return (result != 0); ++} ++ + static FILE *open_socket(len_and_sockaddr *lsa) + { + int fd; +@@ -629,6 +654,8 @@ + static int spawn_https_helper_openssl(const char *host, unsigned port) + { + char *allocated = NULL; ++ char *servername; ++ char *colon_ptr; + int sp[2]; + int pid; + IF_FEATURE_WGET_SSL_HELPER(volatile int child_failed = 0;) +@@ -637,15 +664,39 @@ + /* Kernel can have AF_UNIX support disabled */ + bb_perror_msg_and_die("socketpair"); + ++ /* ++ * Per RFC 6066 Section 3, the only permitted values in the ++ * TLS server_name (SNI) field are FQDNs (DNS hostnames). ++ * IPv4 nor IPv6 addresses are supported, nor is use of an ++ * alternate port number. ++ * ++ * The host argument to spawn_https_helper_openssl() can ++ * contain things like: test.com, test.com:8080, 1.2.3.4, or ++ * 1.2.3.4:8888. The strchr() check determines if the user ++ * passed something like test.com:8080 or 1.2.3.4:8888. ++ * ++ * The rest of the code ensures that servername only gets ++ * set to the hostname portion, and that the -servername ++ * argument to openssl s_client is only used if the hostname ++ * itself is an actual FQDN, not an IPv4/IPv6 address. ++ */ + if (!strchr(host, ':')) + host = allocated = xasprintf("%s:%u", host, port); + ++ servername = xstrdup(host); ++ colon_ptr = strrchr(servername, ':'); ++ *colon_ptr = '\0'; ++ ++ if (is_ip_address(servername)) ++ servername = NULL; ++ + fflush_all(); + pid = xvfork(); + if (pid == 0) { + /* Child */ +- char *argv[6]; ++ char *argv[8]; + ++ memset(&argv, 0, sizeof(argv)); + close(sp[0]); + xmove_fd(sp[1], 0); + xdup2(0, 1); +@@ -661,7 +712,12 @@ + argv[2] = (char*)"-quiet"; + argv[3] = (char*)"-connect"; + argv[4] = (char*)host; +- argv[5] = NULL; ++ ++ if (servername) { ++ argv[5] = (char*)"-servername"; ++ argv[6] = (char*)servername; ++ } ++ + BB_EXECVP(argv[0], argv); + xmove_fd(3, 2); + # if ENABLE_FEATURE_WGET_SSL_HELPER +@@ -675,6 +731,7 @@ + + /* Parent */ + free(allocated); ++ free(servername); + close(sp[1]); + # if ENABLE_FEATURE_WGET_SSL_HELPER + if (child_failed) { diff --git a/release/src-rt-6.x.4708/router/patches/busybox/118-workaround-for-the-syslogd-bug-at-startup.patch b/release/src-rt-6.x.4708/router/patches/busybox/118-workaround-for-the-syslogd-bug-at-startup.patch new file mode 100644 index 0000000000..4715230ebb --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/118-workaround-for-the-syslogd-bug-at-startup.patch @@ -0,0 +1,55 @@ +--- busybox/sysklogd/klogd.c ++++ busybox/sysklogd/klogd.c +@@ -146,7 +146,7 @@ + + #endif + +-#define log_buffer bb_common_bufsiz1 ++char log_buffer[7 * 1024 + 1]; /* big enough not to lose msgs at bootup */ + enum { + KLOGD_LOGBUF_SIZE = COMMON_BUFSIZE, + OPT_LEVEL = (1 << 0), +@@ -173,6 +173,7 @@ + char *opt_c; + int opt; + int used; ++ unsigned int cnt; + + setup_common_bufsiz(); + +@@ -233,10 +234,12 @@ + write_pidfile(CONFIG_PID_FILE_PATH "/klogd.pid"); + + used = 0; ++ cnt = 0; + while (!bb_got_signal) { + int n; + int priority; + char *start; ++ char *eor; + + /* "2 -- Read from the log." */ + start = log_buffer + used; +@@ -248,6 +251,7 @@ + break; + } + start[n] = '\0'; ++ eor = &start[n]; + + /* Process each newline-terminated line in the buffer */ + start = log_buffer; +@@ -281,8 +285,13 @@ + start++; + } + /* Log (only non-empty lines) */ +- if (*start) ++ if (*start) { + syslog(priority, "%s", start); ++ /* give syslog time to catch up */ ++ ++cnt; ++ if ((cnt & 0x07) == 0 && (cnt < 300 || (eor - start) > 200)) ++ usleep(50 * 1000); ++ } + + if (!newline) + break; diff --git a/release/src-rt-6.x.4708/router/patches/busybox/119-change-colors-for-config-menus.patch b/release/src-rt-6.x.4708/router/patches/busybox/119-change-colors-for-config-menus.patch new file mode 100644 index 0000000000..ecd15250ab --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/119-change-colors-for-config-menus.patch @@ -0,0 +1,16 @@ +--- busybox/scripts/kconfig/lxdialog/colors.h ++++ busybox/scripts/kconfig/lxdialog/colors.h +@@ -117,11 +117,11 @@ + #define TAG_SELECTED_BG COLOR_BLUE + #define TAG_SELECTED_HL TRUE + +-#define TAG_KEY_FG COLOR_YELLOW ++#define TAG_KEY_FG COLOR_RED + #define TAG_KEY_BG COLOR_WHITE + #define TAG_KEY_HL TRUE + +-#define TAG_KEY_SELECTED_FG COLOR_YELLOW ++#define TAG_KEY_SELECTED_FG COLOR_GREEN + #define TAG_KEY_SELECTED_BG COLOR_BLUE + #define TAG_KEY_SELECTED_HL TRUE + diff --git a/release/src-rt-6.x.4708/router/patches/busybox/120-old_e2fsprogs-eliminate-usage-of-old-blkid-and-uuid.patch b/release/src-rt-6.x.4708/router/patches/busybox/120-old_e2fsprogs-eliminate-usage-of-old-blkid-and-uuid.patch new file mode 100644 index 0000000000..206c6a01ea --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/busybox/120-old_e2fsprogs-eliminate-usage-of-old-blkid-and-uuid.patch @@ -0,0 +1,344 @@ +--- busybox/include/libbb.h ++++ busybox/include/libbb.h +@@ -906,6 +906,10 @@ + + /* Generate a UUID */ + void generate_uuid(uint8_t *buf) FAST_FUNC; ++/* expand UUID to human readable format */ ++char *unparse_uuid(const uint8_t *uu, char *out) FAST_FUNC; ++/* parse UUID */ ++int parse_uuid(const char *in, uint8_t *uuid) FAST_FUNC; + + /* Last element is marked by mult == 0 */ + struct suffix_mult { +--- busybox/include/volume_id.h ++++ busybox/include/volume_id.h +@@ -20,12 +20,14 @@ + + char *get_devname_from_label(const char *spec); + char *get_devname_from_uuid(const char *spec); ++char *get_devname_from_device(dev_t dev); + void display_uuid_cache(int scan_devices); + + /* Returns: +- * 0: no UUID= or LABEL= prefix found +- * 1: UUID= or LABEL= prefix found. In this case, +- * *fsname is replaced if device with such UUID or LABEL is found ++ * 0 : no UUID= or LABEL= prefix found ++ * 1 : UUID= or LABEL= prefix found. In this case, ++ * *fsname is replaced if device with such UUID or LABEL is found ++ * -2: UUID= or LABEL= prefixes cannot be resolved + */ + int resolve_mount_spec(char **fsname); +-int add_to_uuid_cache(const char *device); ++int add_to_uuid_cache(const char *device, dev_t devno); +--- busybox/libbb/xfuncs.c ++++ busybox/libbb/xfuncs.c +@@ -327,3 +327,49 @@ + bb_perror_msg_and_die("waitpid"); + return exit_status; + } ++ ++char * FAST_FUNC unparse_uuid(const uint8_t *uu, char *out) ++{ ++ char uuid_string[32]; ++ ++ bin2hex(uuid_string, (char *)uu, 16); ++ /* f.e. UUID=dfd9c173-be52-4d27-99a5-c34c6c2ff55f */ ++ sprintf(out, "%.8s-%.4s-%.4s-%.4s-%.12s", ++ uuid_string, ++ uuid_string+8, ++ uuid_string+8+4, ++ uuid_string+8+4+4, ++ uuid_string+8+4+4+4 ++ ); ++ return out; ++} ++ ++static unsigned char fromhex(char c) ++{ ++ if (isdigit(c)) ++ return (c - '0'); ++ return ((c|0x20) - 'a' + 10); ++} ++ ++/* Parse & verify UUID string */ ++int FAST_FUNC parse_uuid(const char *s, uint8_t *uuid) ++{ ++ int i; ++ ++ if (strlen(s) != 36 || s[8] != '-' || s[13] != '-' ++ || s[18] != '-' || s[23] != '-' ++ ) { ++ return -1; ++ } ++ for (i = 0; i < 16; i++) { ++ if (*s == '-') ++ s++; ++ if (!isxdigit(s[0]) || !isxdigit(s[1])) ++ return -2; ++ uuid[i] = ((fromhex(s[0]) << 4) | fromhex(s[1])); ++ s += 2; ++ } ++ ++ return 0; ++} ++ +--- busybox/util-linux/mkswap.c ++++ busybox/util-linux/mkswap.c +@@ -125,17 +125,9 @@ + hdr->last_page = (uoff_t)len / pagesize; + + if (ENABLE_FEATURE_MKSWAP_UUID) { +- char uuid_string[32]; ++ char uuid_string[37]; + generate_uuid((void*)hdr->sws_uuid); +- bin2hex(uuid_string, hdr->sws_uuid, 16); +- /* f.e. UUID=dfd9c173-be52-4d27-99a5-c34c6c2ff55f */ +- printf("UUID=%.8s" "-%.4s-%.4s-%.4s-%.12s\n", +- uuid_string, +- uuid_string+8, +- uuid_string+8+4, +- uuid_string+8+4+4, +- uuid_string+8+4+4+4 +- ); ++ printf("UUID=%s\n", unparse_uuid((uint8_t *)hdr->sws_uuid, uuid_string)); + } + safe_strncpy(hdr->sws_volume, label, 16); + +--- busybox/util-linux/volume_id/get_devname.c ++++ busybox/util-linux/volume_id/get_devname.c +@@ -20,7 +20,7 @@ + + static struct uuidCache_s { + struct uuidCache_s *next; +-// int major, minor; ++ dev_t devno; + char *device; + char *label; + char *uc_uuid; /* prefix makes it easier to grep for */ +@@ -30,8 +30,8 @@ + #if !ENABLE_FEATURE_BLKID_TYPE + #define get_label_uuid(fd, label, uuid, type) \ + get_label_uuid(fd, label, uuid) +-#define uuidcache_addentry(device, label, uuid, type) \ +- uuidcache_addentry(device, label, uuid) ++#define uuidcache_addentry(device, devno, label, uuid, type) \ ++ uuidcache_addentry(device, devno, label, uuid) + #endif + + /* Returns !0 on error. +@@ -76,7 +76,7 @@ + + /* NB: we take ownership of (malloc'ed) label and uuid */ + static void +-uuidcache_addentry(char *device, /*int major, int minor,*/ char *label, char *uuid, const char *type) ++uuidcache_addentry(char *device, dev_t devno, char *label, char *uuid, const char *type) + { + struct uuidCache_s *last; + +@@ -89,8 +89,7 @@ + last = last->next; + } + /*last->next = NULL; - xzalloc did it*/ +-// last->major = major; +-// last->minor = minor; ++ last->devno = devno; + last->device = device; + last->label = label; + last->uc_uuid = uuid; +@@ -118,7 +117,7 @@ + if (major(statbuf->st_rdev) == 2) + return TRUE; + +- add_to_uuid_cache(device); ++ add_to_uuid_cache(device, statbuf->st_rdev); + + return TRUE; + } +@@ -152,10 +151,10 @@ + + #define UUID 1 + #define VOL 2 ++#define DEVNO 3 + +-#ifdef UNUSED + static char * +-get_spec_by_x(int n, const char *t, int *majorPtr, int *minorPtr) ++get_spec_by_x(int n, const char *t, dev_t *devnoPtr) + { + struct uuidCache_s *uc; + +@@ -163,65 +162,28 @@ + while (uc) { + switch (n) { + case UUID: +- if (strcmp(t, uc->uc_uuid) == 0) { +- *majorPtr = uc->major; +- *minorPtr = uc->minor; +- return uc->device; +- } ++ /* case of hex numbers doesn't matter */ ++ if (strcasecmp(t, uc->uc_uuid) == 0) ++ goto found; + break; + case VOL: +- if (strcmp(t, uc->label) == 0) { +- *majorPtr = uc->major; +- *minorPtr = uc->minor; +- return uc->device; +- } ++ if (uc->label[0] && strcmp(t, uc->label) == 0) ++ goto found; ++ break; ++ case DEVNO: ++ if (uc->devno == (*devnoPtr)) ++ goto found; + break; + } + uc = uc->next; + } + return NULL; +-} +- +-static unsigned char +-fromhex(char c) +-{ +- if (isdigit(c)) +- return (c - '0'); +- return ((c|0x20) - 'a' + 10); +-} +- +-static char * +-get_spec_by_uuid(const char *s, int *major, int *minor) +-{ +- unsigned char uuid[16]; +- int i; +- +- if (strlen(s) != 36 || s[8] != '-' || s[13] != '-' +- || s[18] != '-' || s[23] != '-' +- ) { +- goto bad_uuid; +- } +- for (i = 0; i < 16; i++) { +- if (*s == '-') +- s++; +- if (!isxdigit(s[0]) || !isxdigit(s[1])) +- goto bad_uuid; +- uuid[i] = ((fromhex(s[0]) << 4) | fromhex(s[1])); +- s += 2; +- } +- return get_spec_by_x(UUID, (char *)uuid, major, minor); +- +- bad_uuid: +- fprintf(stderr, _("mount: bad UUID")); +- return 0; +-} + +-static char * +-get_spec_by_volume_label(const char *s, int *major, int *minor) +-{ +- return get_spec_by_x(VOL, s, major, minor); ++found: ++ if (devnoPtr) ++ *devnoPtr = uc->devno; ++ return xstrdup(uc->device); + } +-#endif // UNUSED + + /* Used by blkid */ + void display_uuid_cache(int scan_devices) +@@ -244,7 +206,7 @@ + } + } + +-int add_to_uuid_cache(const char *device) ++int add_to_uuid_cache(const char *device, dev_t devno) + { + char *uuid = uuid; /* for compiler */ + char *label = label; +@@ -260,57 +222,47 @@ + /* get_label_uuid() closes fd in all cases (success & failure) */ + if (get_label_uuid(fd, &label, &uuid, &type) == 0) { + /* uuidcache_addentry() takes ownership of all four params */ +- uuidcache_addentry(xstrdup(device), /*ma, mi,*/ label, uuid, type); ++ uuidcache_addentry(xstrdup(device), devno, label, uuid, type); + return 1; + } + return 0; + } + + +-/* Used by mount and findfs */ ++/* Used by mount and findfs & old_e2fsprogs */ + + char *get_devname_from_label(const char *spec) + { +- struct uuidCache_s *uc; +- +- uc = uuidcache_init(/*scan_devices:*/ 1); +- while (uc) { +- if (uc->label[0] && strcmp(spec, uc->label) == 0) { +- return xstrdup(uc->device); +- } +- uc = uc->next; +- } +- return NULL; ++ return get_spec_by_x(VOL, spec, NULL); + } + + char *get_devname_from_uuid(const char *spec) + { +- struct uuidCache_s *uc; ++ return get_spec_by_x(UUID, spec, NULL); ++} + +- uc = uuidcache_init(/*scan_devices:*/ 1); +- while (uc) { +- /* case of hex numbers doesn't matter */ +- if (strcasecmp(spec, uc->uc_uuid) == 0) { +- return xstrdup(uc->device); +- } +- uc = uc->next; +- } +- return NULL; ++char *get_devname_from_device(dev_t dev) ++{ ++ return get_spec_by_x(DEVNO, NULL, &dev); + } + + int resolve_mount_spec(char **fsname) + { +- char *tmp = *fsname; ++ char *tmp = NULL; + + if (is_prefixed_with(*fsname, "UUID=")) + tmp = get_devname_from_uuid(*fsname + 5); + else if (is_prefixed_with(*fsname, "LABEL=")) + tmp = get_devname_from_label(*fsname + 6); + +- if (tmp == *fsname) ++ else { ++ *fsname = xstrdup(*fsname); + return 0; /* no UUID= or LABEL= prefix found */ ++ } + +- if (tmp) +- *fsname = tmp; ++ if (!tmp) ++ return -2; /* device defined by UUID= or LABEL= wasn't found */ ++ ++ *fsname = tmp; + return 1; + } +--- busybox/util-linux/blkid.c ++++ busybox/util-linux/blkid.c +@@ -22,7 +22,7 @@ + + while (*++argv) { + /* Note: bogus device names don't cause any error messages */ +- add_to_uuid_cache(*argv); ++ add_to_uuid_cache(*argv, 0); + scan_devices = 0; + } + diff --git a/release/src-rt-6.x.4708/router/patches/miniupnpd/104-disable-libuuid-checking.patch b/release/src-rt-6.x.4708/router/patches/miniupnpd/104-disable-libuuid-checking.patch new file mode 100644 index 0000000000..19d780f0fc --- /dev/null +++ b/release/src-rt-6.x.4708/router/patches/miniupnpd/104-disable-libuuid-checking.patch @@ -0,0 +1,35 @@ +--- miniupnpd/genconfig.sh ++++ miniupnpd/genconfig.sh +@@ -426,19 +426,19 @@ + esac + + # UUID API +-case $OS_NAME in +- OpenWRT) +- echo "#define LIB_UUID" >> ${CONFIGFILE} +- ;; +- *) +- if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then +- echo "#define BSD_UUID" >> ${CONFIGFILE} +- fi +- if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then +- echo "#define LIB_UUID" >> ${CONFIGFILE} +- fi +- ;; +-esac ++#case $OS_NAME in ++# OpenWRT) ++# echo "#define LIB_UUID" >> ${CONFIGFILE} ++# ;; ++# *) ++# if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then ++# echo "#define BSD_UUID" >> ${CONFIGFILE} ++# fi ++# if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then ++# echo "#define LIB_UUID" >> ${CONFIGFILE} ++# fi ++# ;; ++#esac + + # set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above + if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then diff --git a/release/src-rt-6.x.4708/router/rc/firewall.c b/release/src-rt-6.x.4708/router/rc/firewall.c index c99d65c611..dabb59267d 100644 --- a/release/src-rt-6.x.4708/router/rc/firewall.c +++ b/release/src-rt-6.x.4708/router/rc/firewall.c @@ -1135,7 +1135,7 @@ static void filter_input(void) if (remotemanage) { ipt_write("-N wwwlimit\n" "-A wwwlimit -m recent --set --name www\n" - "-A wwwlimit -m recent --update --hitcount 11 --seconds 5 --name www -j %s\n", + "-A wwwlimit -m recent --update --hitcount 15 --seconds 5 --name www -j %s\n", chain_in_drop); ipt_write("-A INPUT -p tcp --dport %s -m state --state NEW -j wwwlimit\n", nvram_safe_get("http_wanport")); } diff --git a/release/src-rt-6.x.4708/router/shared/defaults.c b/release/src-rt-6.x.4708/router/shared/defaults.c index 4b50c4de7e..1d9d5e531f 100644 --- a/release/src-rt-6.x.4708/router/shared/defaults.c +++ b/release/src-rt-6.x.4708/router/shared/defaults.c @@ -1142,7 +1142,11 @@ struct nvram_tuple router_defaults[] = { { "vpn_server1_comp", "adaptive" , 0 }, { "vpn_server1_cipher", "AES-128-CBC" , 0 }, { "vpn_server1_ncp_enable", "1" , 0 }, +#if 0 { "vpn_server1_ncp_ciphers", "AES-256-GCM:AES-128-GCM:AES-256-CBC:AES-128-CBC", 0 }, +#else + { "vpn_server1_ncp_ciphers", "AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC", 0 }, +#endif { "vpn_server1_digest", "default" , 0 }, { "vpn_server1_dhcp", "1" , 0 }, { "vpn_server1_r1", "192.168.1.50" , 0 }, @@ -1182,7 +1186,11 @@ struct nvram_tuple router_defaults[] = { { "vpn_server2_comp", "adaptive" , 0 }, { "vpn_server2_cipher", "AES-128-CBC" , 0 }, { "vpn_server2_ncp_enable", "1" , 0 }, +#if 0 { "vpn_server2_ncp_ciphers", "AES-256-GCM:AES-128-GCM:AES-256-CBC:AES-128-CBC", 0 }, +#else + { "vpn_server2_ncp_ciphers", "AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC", 0 }, +#endif { "vpn_server2_digest", "default" , 0 }, { "vpn_server2_dhcp", "1" , 0 }, { "vpn_server2_r1", "192.168.1.50" , 0 },