From 6525b7aa7fbb97336a7656a5408d6505c2ac7ca3 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 4 Aug 2016 13:20:41 +0200 Subject: main/busybox: upgrade to 1.25.0 --- ...ash-backport-fix-for-here-document-issues.patch | 165 ------- main/busybox/0001-ash-exec-busybox.static.patch | 25 + ...or-during-recursive-processing-of-here-do.patch | 80 ---- ...size-instead-of-f_bsize-for-correct-sizes.patch | 71 --- .../0001-diff-add-support-for-no-dereference.patch | 63 --- ...ip-fix-compression-level-bug.-Closes-9131.patch | 41 -- ...ss-interface-device-name-for-ipv6-route-c.patch | 47 -- ...-ifupdown-use-x-hostname-NAME-with-udhcpc.patch | 38 -- ...bb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch | 30 -- ...ng-make-ping-work-without-root-privileges.patch | 197 -------- ...location-to-correspond-to-upstream-for-vi.patch | 40 ++ ...-udhcpc-set-default-discover-retries-to-5.patch | 26 ++ ...ng-make-ping-work-without-root-privileges.patch | 197 ++++++++ .../0005-fbsplash-support-console-switching.patch | 187 ++++++++ ...pport-image-and-bar-alignment-and-positio.patch | 185 ++++++++ ...upport-generating-kmod-binary-index-files.patch | 501 +++++++++++++++++++++ .../0008-login-move-check_securetty-to-libbb.patch | 103 +++++ ..._blank-argument-for-ask_and_check_passwor.patch | 70 +++ .../busybox/0010-su-FEATURE_SU_NULLOK_SECURE.patch | 71 +++ ...size-instead-of-f_bsize-for-correct-sizes.patch | 73 +++ ...ip-fix-compression-level-bug.-Closes-9131.patch | 41 ++ ...ne-hostname-resolution-if-fails-on-startu.patch | 197 ++++++++ ...d-only-to-client-and-symmetric-active-pac.patch | 41 ++ .../0015-diff-add-support-for-no-dereference.patch | 63 +++ ...e-virtual-y-size-in-mmap-size-calculation.patch | 32 -- .../1001-fbsplash-support-console-switching.patch | 186 -------- ...pport-image-and-bar-alignment-and-positio.patch | 184 -------- ...rge-module_entry-and-module_info-to-commo.patch | 445 ------------------ ...upport-generating-kmod-binary-index-files.patch | 495 -------------------- ...-argument-parsing-and-printing-of-firmwar.patch | 87 ---- .../3001-login-move-check_securetty-to-libbb.patch | 103 ----- ..._blank-argument-for-ask_and_check_passwor.patch | 70 --- .../busybox/3003-su-FEATURE_SU_NULLOK_SECURE.patch | 76 ---- ...ntpd-step-when-offset-1-sec-not-0.125-sec.patch | 153 ------- main/busybox/4002-ntpd-shorter-message.patch | 26 -- ...rint-packet-delay-in-clock-update-message.patch | 37 -- ...pd-more-informative-poll-lowering-message.patch | 28 -- ...-use-a-peer-more-than-once-say-if-two-pee.patch | 57 --- ...r-does-not-reply-anymore-try-re-resolving.patch | 67 --- ...ne-hostname-resolution-if-fails-on-startu.patch | 171 ------- main/busybox/APKBUILD | 232 ++++------ main/busybox/bb-app-location.patch | 22 - main/busybox/busybox-1.11.1-bb.patch | 12 - main/busybox/busybox-1.24.2-CVE-2016-2147.patch | 72 --- main/busybox/busybox-1.24.2-CVE-2016-2148.patch | 55 --- main/busybox/busyboxconfig | 75 +-- main/busybox/glibc.patch | 20 - main/busybox/loginutils-sha512.patch | 78 ---- main/busybox/udhcpc-discover-retries.patch | 13 - 49 files changed, 1941 insertions(+), 3407 deletions(-) delete mode 100644 main/busybox/0001-ash-backport-fix-for-here-document-issues.patch create mode 100644 main/busybox/0001-ash-exec-busybox.static.patch delete mode 100644 main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch delete mode 100644 main/busybox/0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch delete mode 100644 main/busybox/0001-diff-add-support-for-no-dereference.patch delete mode 100644 main/busybox/0001-gzip-fix-compression-level-bug.-Closes-9131.patch delete mode 100644 main/busybox/0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch delete mode 100644 main/busybox/0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch delete mode 100644 main/busybox/0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch delete mode 100644 main/busybox/0001-ping-make-ping-work-without-root-privileges.patch create mode 100644 main/busybox/0002-set-applet-location-to-correspond-to-upstream-for-vi.patch create mode 100644 main/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch create mode 100644 main/busybox/0004-ping-make-ping-work-without-root-privileges.patch create mode 100644 main/busybox/0005-fbsplash-support-console-switching.patch create mode 100644 main/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch create mode 100644 main/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch create mode 100644 main/busybox/0008-login-move-check_securetty-to-libbb.patch create mode 100644 main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch create mode 100644 main/busybox/0010-su-FEATURE_SU_NULLOK_SECURE.patch create mode 100644 main/busybox/0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch create mode 100644 main/busybox/0012-gzip-fix-compression-level-bug.-Closes-9131.patch create mode 100644 main/busybox/0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch create mode 100644 main/busybox/0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch create mode 100644 main/busybox/0015-diff-add-support-for-no-dereference.patch delete mode 100644 main/busybox/1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch delete mode 100644 main/busybox/1001-fbsplash-support-console-switching.patch delete mode 100644 main/busybox/1002-fbsplash-support-image-and-bar-alignment-and-positio.patch delete mode 100644 main/busybox/2001-modutils-merge-module_entry-and-module_info-to-commo.patch delete mode 100644 main/busybox/2002-depmod-support-generating-kmod-binary-index-files.patch delete mode 100644 main/busybox/2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch delete mode 100644 main/busybox/3001-login-move-check_securetty-to-libbb.patch delete mode 100644 main/busybox/3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch delete mode 100644 main/busybox/3003-su-FEATURE_SU_NULLOK_SECURE.patch delete mode 100644 main/busybox/4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch delete mode 100644 main/busybox/4002-ntpd-shorter-message.patch delete mode 100644 main/busybox/4003-ntpd-print-packet-delay-in-clock-update-message.patch delete mode 100644 main/busybox/4004-ntpd-more-informative-poll-lowering-message.patch delete mode 100644 main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch delete mode 100644 main/busybox/4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch delete mode 100644 main/busybox/4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch delete mode 100644 main/busybox/bb-app-location.patch delete mode 100644 main/busybox/busybox-1.11.1-bb.patch delete mode 100644 main/busybox/busybox-1.24.2-CVE-2016-2147.patch delete mode 100644 main/busybox/busybox-1.24.2-CVE-2016-2148.patch delete mode 100644 main/busybox/glibc.patch delete mode 100644 main/busybox/loginutils-sha512.patch delete mode 100644 main/busybox/udhcpc-discover-retries.patch diff --git a/main/busybox/0001-ash-backport-fix-for-here-document-issues.patch b/main/busybox/0001-ash-backport-fix-for-here-document-issues.patch deleted file mode 100644 index 7c9d8a98356..00000000000 --- a/main/busybox/0001-ash-backport-fix-for-here-document-issues.patch +++ /dev/null @@ -1,165 +0,0 @@ -From c0eb20351d14932c5535789bce0251ab8718df77 Mon Sep 17 00:00:00 2001 -From: Ron Yorston -Date: Thu, 29 Oct 2015 11:31:39 +0000 -Subject: [PATCH] ash: backport fix for here document issues - -Reported-by: Natanael Copa -Signed-off-by: Ron Yorston ---- - shell/ash.c | 72 +++++++++++++------------------ - shell/ash_test/ash-heredoc/heredoc2.right | 2 + - shell/ash_test/ash-heredoc/heredoc2.tests | 7 +++ - 3 files changed, 39 insertions(+), 42 deletions(-) - create mode 100644 shell/ash_test/ash-heredoc/heredoc2.right - create mode 100644 shell/ash_test/ash-heredoc/heredoc2.tests - -diff --git a/shell/ash.c b/shell/ash.c -index 8a1628e..f13dd2a 100644 ---- a/shell/ash.c -+++ b/shell/ash.c -@@ -10516,7 +10516,7 @@ static union node *andor(void); - static union node *pipeline(void); - static union node *parse_command(void); - static void parseheredoc(void); --static char nexttoken_ends_list(void); -+static int peektoken(void); - static int readtoken(void); - - static union node * -@@ -10525,11 +10525,27 @@ list(int nlflag) - union node *n1, *n2, *n3; - int tok; - -- checkkwd = CHKNL | CHKKWD | CHKALIAS; -- if (nlflag == 2 && nexttoken_ends_list()) -- return NULL; - n1 = NULL; - for (;;) { -+ switch (peektoken()) { -+ case TNL: -+ if (!(nlflag & 1)) -+ break; -+ parseheredoc(); -+ return n1; -+ -+ case TEOF: -+ if (!n1 && (nlflag & 1)) -+ n1 = NODE_EOF; -+ parseheredoc(); -+ return n1; -+ } -+ -+ checkkwd = CHKNL | CHKKWD | CHKALIAS; -+ if (nlflag == 2 && tokname_array[peektoken()][0]) -+ return n1; -+ nlflag |= 2; -+ - n2 = andor(); - tok = readtoken(); - if (tok == TBACKGND) { -@@ -10555,37 +10571,15 @@ list(int nlflag) - n1 = n3; - } - switch (tok) { -+ case TNL: -+ case TEOF: -+ tokpushback = 1; -+ /* fall through */ - case TBACKGND: - case TSEMI: -- tok = readtoken(); -- /* fall through */ -- case TNL: -- if (tok == TNL) { -- parseheredoc(); -- if (nlflag == 1) -- return n1; -- } else { -- tokpushback = 1; -- } -- checkkwd = CHKNL | CHKKWD | CHKALIAS; -- if (nexttoken_ends_list()) { -- /* Testcase: "< +Date: Thu, 4 Aug 2016 11:03:07 +0200 +Subject: [PATCH 01/15] ash: exec busybox.static + +--- + shell/ash.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/shell/ash.c b/shell/ash.c +index faa45a8..1348ece 100644 +--- a/shell/ash.c ++++ b/shell/ash.c +@@ -7380,6 +7380,8 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char ** + } + /* re-exec ourselves with the new arguments */ + execve(bb_busybox_exec_path, argv, envp); ++ execve("/bin/busybox.static",argv,envp); ++ execve("/bin/busybox",argv,envp); + /* If they called chroot or otherwise made the binary no longer + * executable, fall through */ + } +-- +2.9.1 + diff --git a/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch b/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch deleted file mode 100644 index 3e89a16aba8..00000000000 --- a/main/busybox/0001-ash-fix-error-during-recursive-processing-of-here-do.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0df7bfd74aadd258d040c25fbe9e63d0298fa63b Mon Sep 17 00:00:00 2001 -From: Ron Yorston -Date: Thu, 29 Oct 2015 16:44:56 +0000 -Subject: [PATCH] ash: fix error during recursive processing of here document - -Save the value of the checkkwd flag to prevent it being clobbered -during recursion. - -Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git -by Herbert Xu. - -function old new delta -readtoken 190 203 +13 ------------------------------------------------------------------------------- -(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes - -Signed-off-by: Ron Yorston ---- - shell/ash.c | 5 +++-- - shell/ash_test/ash-heredoc/heredoc3.right | 1 + - shell/ash_test/ash-heredoc/heredoc3.tests | 9 +++++++++ - 3 files changed, 13 insertions(+), 2 deletions(-) - create mode 100644 shell/ash_test/ash-heredoc/heredoc3.right - create mode 100755 shell/ash_test/ash-heredoc/heredoc3.tests - -diff --git a/shell/ash.c b/shell/ash.c -index f13dd2a..753eacf 100644 ---- a/shell/ash.c -+++ b/shell/ash.c -@@ -11887,6 +11887,7 @@ static int - readtoken(void) - { - int t; -+ int kwd = checkkwd; - #if DEBUG - smallint alreadyseen = tokpushback; - #endif -@@ -11900,7 +11901,7 @@ readtoken(void) - /* - * eat newlines - */ -- if (checkkwd & CHKNL) { -+ if (kwd & CHKNL) { - while (t == TNL) { - parseheredoc(); - t = xxreadtoken(); -@@ -11914,7 +11915,7 @@ readtoken(void) - /* - * check for keywords - */ -- if (checkkwd & CHKKWD) { -+ if (kwd & CHKKWD) { - const char *const *pp; - - pp = findkwd(wordtext); -diff --git a/shell/ash_test/ash-heredoc/heredoc3.right b/shell/ash_test/ash-heredoc/heredoc3.right -new file mode 100644 -index 0000000..ce01362 ---- /dev/null -+++ b/shell/ash_test/ash-heredoc/heredoc3.right -@@ -0,0 +1 @@ -+hello -diff --git a/shell/ash_test/ash-heredoc/heredoc3.tests b/shell/ash_test/ash-heredoc/heredoc3.tests -new file mode 100755 -index 0000000..96c227c ---- /dev/null -+++ b/shell/ash_test/ash-heredoc/heredoc3.tests -@@ -0,0 +1,9 @@ -+echo hello >greeting -+cat </dev/null -+rm greeting --- -2.6.1 - diff --git a/main/busybox/0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch b/main/busybox/0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch deleted file mode 100644 index 4726bf99d72..00000000000 --- a/main/busybox/0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 5e48c741b536ae813995957634592474424cde48 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Thu, 23 Jun 2016 10:08:23 +0200 -Subject: [PATCH] df: use f_frsize instead of f_bsize for correct sizes - -Use the correct field f_frsize instead of f_bsize. - -The statfs f_bsize is the "Optimal transfer block size" while the -f_frsize is the "Fragment size (since Linux 2.6)". On some FUSE -filesystems those may differ. - -Fixes bug 9046 - -URL: https://bugs.busybox.net/show_bug.cgi?id=9046 -Signed-off-by: Natanael Copa ---- - coreutils/df.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/coreutils/df.c b/coreutils/df.c -index d79c11a..06b2920 100644 ---- a/coreutils/df.c -+++ b/coreutils/df.c -@@ -188,7 +188,7 @@ int df_main(int argc UNUSED_PARAM, char **argv) - if (opt & OPT_INODE) { - s.f_blocks = s.f_files; - s.f_bavail = s.f_bfree = s.f_ffree; -- s.f_bsize = 1; -+ s.f_frsize = 1; - - if (df_disp_hr) - df_disp_hr = 1; -@@ -246,26 +246,26 @@ int df_main(int argc UNUSED_PARAM, char **argv) - - #if ENABLE_FEATURE_HUMAN_READABLE - printf(" %9s ", -- /* f_blocks x f_bsize / df_disp_hr, show one fractional, -+ /* f_blocks x f_frsize / df_disp_hr, show one fractional, - * use suffixes if df_disp_hr == 0 */ -- make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr)); -+ make_human_readable_str(s.f_blocks, s.f_frsize, df_disp_hr)); - - printf(" %9s " + 1, -- /* EXPR x f_bsize / df_disp_hr, show one fractional, -+ /* EXPR x f_frsize / df_disp_hr, show one fractional, - * use suffixes if df_disp_hr == 0 */ - make_human_readable_str((s.f_blocks - s.f_bfree), -- s.f_bsize, df_disp_hr)); -+ s.f_frsize, df_disp_hr)); - - printf("%9s %3u%% %s\n", -- /* f_bavail x f_bsize / df_disp_hr, show one fractional, -+ /* f_bavail x f_frsize / df_disp_hr, show one fractional, - * use suffixes if df_disp_hr == 0 */ -- make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), -+ make_human_readable_str(s.f_bavail, s.f_frsize, df_disp_hr), - blocks_percent_used, mount_point); - #else - printf(" %9lu %9lu %9lu %3u%% %s\n", -- kscale(s.f_blocks, s.f_bsize), -- kscale(s.f_blocks - s.f_bfree, s.f_bsize), -- kscale(s.f_bavail, s.f_bsize), -+ kscale(s.f_blocks, s.f_frsize), -+ kscale(s.f_blocks - s.f_bfree, s.f_frsize), -+ kscale(s.f_bavail, s.f_frsize), - blocks_percent_used, mount_point); - #endif - } --- -2.9.0 - diff --git a/main/busybox/0001-diff-add-support-for-no-dereference.patch b/main/busybox/0001-diff-add-support-for-no-dereference.patch deleted file mode 100644 index a611e8a381e..00000000000 --- a/main/busybox/0001-diff-add-support-for-no-dereference.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 3993add1f639fc1c6c44d9dc865aa02646e22d6c Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Fri, 25 Jul 2014 15:28:33 +0200 -Subject: [PATCH] diff: add support for --no-dereference - -Add flag for not following symlinks when recursing - -function old new delta -.rodata 7934 7967 +33 -diff_longopts 253 270 +17 -packed_usage 1704 1720 +16 -diff_main 1665 1662 -3 ------------------------------------------------------------------------------- -(add/remove: 0/0 grow/shrink: 3/1 up/down: 66/-3) Total: 63 bytes - -Signed-off-by: Natanael Copa ---- - editors/diff.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/editors/diff.c b/editors/diff.c -index a78a0ee..a0203af 100644 ---- a/editors/diff.c -+++ b/editors/diff.c -@@ -117,6 +117,9 @@ - //usage: "\n -N Treat absent files as empty" - //usage: "\n -q Output only whether files differ" - //usage: "\n -r Recurse" -+//usage: IF_LONG_OPTS( -+//usage: "\n --no-dereference Don't follow symlinks" -+//usage: ) - //usage: "\n -S Start with FILE when comparing directories" - //usage: "\n -T Make tabs line up by prefixing a tab when necessary" - //usage: "\n -s Report when two files are the same" -@@ -157,6 +160,7 @@ enum { /* Commandline flags */ - FLAG_p, /* not implemented */ - FLAG_B, - FLAG_E, /* not implemented */ -+ FLAG_no_deref, - }; - #define FLAG(x) (1 << FLAG_##x) - -@@ -869,7 +873,8 @@ static void diffdir(char *p[2], const char *s_start) - * Using list.len to specify its length, - * add_to_dirlist will remove it. */ - list[i].len = strlen(p[i]); -- recursive_action(p[i], ACTION_RECURSE | ACTION_FOLLOWLINKS, -+ recursive_action(p[i], ACTION_RECURSE | -+ ((option_mask32 & FLAG(no_deref)) ? 0 : ACTION_FOLLOWLINKS), - add_to_dirlist, skip_dir, &list[i], 0); - /* Sort dl alphabetically. - * GNU diff does this ignoring any number of trailing dots. -@@ -966,6 +971,7 @@ static const char diff_longopts[] ALIGN1 = - "report-identical-files\0" No_argument "s" - "starting-file\0" Required_argument "S" - "minimal\0" No_argument "d" -+ "no-dereference\0" No_argument "\xff" - ; - #endif - --- -2.0.3 - diff --git a/main/busybox/0001-gzip-fix-compression-level-bug.-Closes-9131.patch b/main/busybox/0001-gzip-fix-compression-level-bug.-Closes-9131.patch deleted file mode 100644 index a13c68e39d0..00000000000 --- a/main/busybox/0001-gzip-fix-compression-level-bug.-Closes-9131.patch +++ /dev/null @@ -1,41 +0,0 @@ -From afe536411df2d4b080159aa461111fe56c25e30e Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Wed, 3 Aug 2016 13:23:57 +0200 -Subject: [PATCH] gzip: fix compression level bug. Closes 9131 - -fix broken logic to get the gzip_level_config value from options -1 to --9. - -This fixes an off-by-one bug that caused gzip -9 output bigger files -than the other compression levels. - -It fixes so that compression level 1 to 3 are actually mapped to level 4 -as comments say. - -It also fixes that levels -4 to -9 is mapped to correct level and avoids -out-of-bounds access. - -Signed-off-by: Natanael Copa ---- - archival/gzip.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/archival/gzip.c b/archival/gzip.c -index 8f1e4ff..15ba57c 100644 ---- a/archival/gzip.c -+++ b/archival/gzip.c -@@ -2220,10 +2220,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv) - opt >>= ENABLE_GUNZIP ? 7 : 5; /* drop cfv[dt]qn bits */ - if (opt == 0) - opt = 1 << 6; /* default: 6 */ -- /* Map 1..3 to 4 */ -- if (opt & 0x7) -- opt |= 1 << 4; -- opt = ffs(opt >> 3); -+ opt = ffs(opt >> 4); /* Maps 1..3 to 4 */ - max_chain_length = 1 << gzip_level_config[opt].chain_shift; - good_match = gzip_level_config[opt].good; - max_lazy_match = gzip_level_config[opt].lazy2 * 2; --- -2.9.1 - diff --git a/main/busybox/0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch b/main/busybox/0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch deleted file mode 100644 index 3fb88fd5c09..00000000000 --- a/main/busybox/0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 028524317d8d0011ed38e86e507a06738a5b5a97 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Mon, 26 Oct 2015 17:06:12 +0100 -Subject: [PATCH] ifupdown: pass interface device name for ipv6 route commands -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -IPv6 routes need the device argument for link-local routes, or they -cannot be used at all. E.g. "gateway fe80::def" seems to be used in -some places, but kernel refuses to insert the route unless device -name is explicitly specified in the route addition. - -Signed-off-by: Timo Teräs -Signed-off-by: Denys Vlasenko ---- - networking/ifupdown.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/networking/ifupdown.c b/networking/ifupdown.c -index 7c45e89..d477ff6 100644 ---- a/networking/ifupdown.c -+++ b/networking/ifupdown.c -@@ -394,8 +394,8 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec) - # if ENABLE_FEATURE_IFUPDOWN_IP - result = execute("ip addr add %address%/%netmask% dev %iface%[[ label %label%]]", ifd, exec); - result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec); -- /* Was: "[[ ip ....%gateway% ]]". Removed extra spaces w/o checking */ -- result += execute("[[ip route add ::/0 via %gateway%]][[ metric %metric%]]", ifd, exec); -+ /* Reportedly, IPv6 needs "dev %iface%", but IPv4 does not: */ -+ result += execute("[[ip route add ::/0 via %gateway% dev %iface%]][[ metric %metric%]]", ifd, exec); - # else - result = execute("ifconfig %iface%[[ media %media%]][[ hw %hwaddress%]][[ mtu %mtu%]] up", ifd, exec); - result += execute("ifconfig %iface% add %address%/%netmask%", ifd, exec); -@@ -421,7 +421,8 @@ static int FAST_FUNC v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) - "%endpoint%[[ local %local%]][[ ttl %ttl%]]", ifd, exec); - result += execute("ip link set %iface% up", ifd, exec); - result += execute("ip addr add %address%/%netmask% dev %iface%", ifd, exec); -- result += execute("[[ip route add ::/0 via %gateway%]]", ifd, exec); -+ /* Reportedly, IPv6 needs "dev %iface%", but IPv4 does not: */ -+ result += execute("[[ip route add ::/0 via %gateway% dev %iface%]]", ifd, exec); - return ((result == 4) ? 4 : 0); - } - --- -2.6.1 - diff --git a/main/busybox/0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch b/main/busybox/0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch deleted file mode 100644 index ebae8375695..00000000000 --- a/main/busybox/0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch +++ /dev/null @@ -1,38 +0,0 @@ -From ad69a8dea4fff640a7e1dcfa78d0ea96eb201ec4 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Wed, 19 Sep 2012 15:53:02 +0200 -Subject: [PATCH] ifupdown: use -x hostname:NAME with udhcpc - -The -H NAME is deprecated in udhcpc. See commit -2017d48c0d70bef8768efb42909e605ea8eb5a21 - -Signed-off-by: Natanael Copa ---- - networking/ifupdown.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/networking/ifupdown.c b/networking/ifupdown.c -index ad0a997..6eb3570 100644 ---- a/networking/ifupdown.c -+++ b/networking/ifupdown.c -@@ -540,7 +540,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = { - "pump -i %iface% -k", - }, - { "udhcpc", -- "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %client%]]" -+ "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -x hostname:%hostname%]][[ -c %client%]]" - "[[ -s %script%]][[ %udhcpc_opts%]]", - "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", - }, -@@ -580,7 +580,7 @@ static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec) - return 0; - # endif - return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid " -- "-i %iface%[[ -H %hostname%]][[ -c %client%]][[ -s %script%]][[ %udhcpc_opts%]]", -+ "-i %iface%[[ -x hostname:%hostname%]][[ -c %client%]][[ -s %script%]][[ %udhcpc_opts%]]", - ifd, exec); - } - # else --- -1.7.12 - diff --git a/main/busybox/0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch b/main/busybox/0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch deleted file mode 100644 index 3169bdff46d..00000000000 --- a/main/busybox/0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c9ee7417d8d838c16bc2c270d4dbb5fdb9c8b786 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Thu, 19 May 2016 16:17:32 +0200 -Subject: [PATCH] libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS] - -If SS is not given a value, it is assumed to be zero. -http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html - -closes 8951 - -Signed-off-by: Natanael Copa ---- - libbb/time.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libbb/time.c b/libbb/time.c -index aa19a47..82e6cb1 100644 ---- a/libbb/time.c -+++ b/libbb/time.c -@@ -186,6 +186,7 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm) - } else { - bb_error_msg_and_die(bb_msg_invalid_date, date_str); - } -+ ptm->tm_sec = 0; /* assume zero if [.SS] is not given */ - if (end == '.') { - /* xxx.SS */ - if (sscanf(strchr(date_str, '.') + 1, "%u%c", --- -2.8.2 - diff --git a/main/busybox/0001-ping-make-ping-work-without-root-privileges.patch b/main/busybox/0001-ping-make-ping-work-without-root-privileges.patch deleted file mode 100644 index 43c45f31b3f..00000000000 --- a/main/busybox/0001-ping-make-ping-work-without-root-privileges.patch +++ /dev/null @@ -1,197 +0,0 @@ -From 8fa06464b2c1cb80553a0f47b47503cf231d64d8 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Tue, 29 Mar 2016 18:59:22 +0200 -Subject: [PATCH] ping: make ping work without root privileges - ---- - networking/ping.c | 103 +++++++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 87 insertions(+), 16 deletions(-) - -diff --git a/networking/ping.c b/networking/ping.c -index dcbf196..1d96790 100644 ---- a/networking/ping.c -+++ b/networking/ping.c -@@ -154,6 +154,7 @@ enum { - pingsock = 0, - }; - -+static int using_dgram; - static void - #if ENABLE_PING6 - create_icmp_socket(len_and_sockaddr *lsa) -@@ -170,9 +171,23 @@ create_icmp_socket(void) - #endif - sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */ - if (sock < 0) { -- if (errno == EPERM) -- bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); -- bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); -+ if (errno != EPERM) -+ bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); -+#if defined(__linux__) || defined(__APPLE__) -+ /* We don't have root privileges. Try SOCK_DGRAM instead. -+ * Linux needs net.ipv4.ping_group_range for this to work. -+ * MacOSX allows ICMP_ECHO, ICMP_TSTAMP or ICMP_MASKREQ -+ */ -+#if ENABLE_PING6 -+ if (lsa->u.sa.sa_family == AF_INET6) -+ sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6); -+ else -+#endif -+ sock = socket(AF_INET, SOCK_DGRAM, 1); /* 1 == ICMP */ -+ if (sock < 0) -+#endif -+ bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); -+ using_dgram = 1; - } - - xmove_fd(sock, pingsock); -@@ -223,10 +238,12 @@ static void ping4(len_and_sockaddr *lsa) - bb_perror_msg("recvfrom"); - continue; - } -- if (c >= 76) { /* ip + icmp */ -- struct iphdr *iphdr = (struct iphdr *) G.packet; -+ if (c >= 76 || using_dgram && (c == 64)) { /* ip + icmp */ -+ if(!using_dgram) { -+ struct iphdr *iphdr = (struct iphdr *) G.packet; - -- pkt = (struct icmp *) (G.packet + (iphdr->ihl << 2)); /* skip ip hdr */ -+ pkt = (struct icmp *) (G.packet + (iphdr->ihl << 2)); /* skip ip hdr */ -+ } else pkt = (struct icmp *) G.packet; - if (pkt->icmp_type == ICMP_ECHOREPLY) - break; - } -@@ -619,19 +636,21 @@ static void unpack_tail(int sz, uint32_t *tp, - } - static void unpack4(char *buf, int sz, struct sockaddr_in *from) - { -- struct icmp *icmppkt; - struct iphdr *iphdr; -+ struct icmp *icmppkt; - int hlen; - - /* discard if too short */ - if (sz < (datalen + ICMP_MINLEN)) - return; -+ if(!using_dgram) { -+ /* check IP header */ -+ iphdr = (struct iphdr *) buf; -+ hlen = iphdr->ihl << 2; -+ sz -= hlen; -+ icmppkt = (struct icmp *) (buf + hlen); -+ } else icmppkt = (struct icmp *) buf; - -- /* check IP header */ -- iphdr = (struct iphdr *) buf; -- hlen = iphdr->ihl << 2; -- sz -= hlen; -- icmppkt = (struct icmp *) (buf + hlen); - if (icmppkt->icmp_id != myid) - return; /* not our ping */ - -@@ -643,7 +662,7 @@ static void unpack4(char *buf, int sz, struct sockaddr_in *from) - tp = (uint32_t *) icmppkt->icmp_data; - unpack_tail(sz, tp, - inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr), -- recv_seq, iphdr->ttl); -+ recv_seq, using_dgram ? 42 : iphdr->ttl); - } else if (icmppkt->icmp_type != ICMP_ECHO) { - bb_error_msg("warning: got ICMP %d (%s)", - icmppkt->icmp_type, -@@ -687,11 +706,31 @@ static void ping4(len_and_sockaddr *lsa) - int sockopt; - - pingaddr.sin = lsa->u.sin; -- if (source_lsa) { -+ if (source_lsa && !using_dgram) { - if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, - &source_lsa->u.sa, source_lsa->len)) - bb_error_msg_and_die("can't set multicast source interface"); - xbind(pingsock, &source_lsa->u.sa, source_lsa->len); -+ } else if(using_dgram) { -+ struct sockaddr_in sa; -+ socklen_t sl; -+ -+ sa.sin_family = AF_INET; -+ sa.sin_port = 0; -+ sa.sin_addr.s_addr = source_lsa ? -+ source_lsa->u.sin.sin_addr.s_addr : 0; -+ sl = sizeof(sa); -+ -+ if (bind(pingsock, (struct sockaddr *) &sa, sl) == -1) { -+ perror("bind"); -+ exit(2); -+ } -+ -+ if (getsockname(pingsock, (struct sockaddr *) &sa, &sl) == -1) { -+ perror("getsockname"); -+ exit(2); -+ } -+ myid = sa.sin_port; - } - - /* enable broadcast pings */ -@@ -708,6 +747,15 @@ static void ping4(len_and_sockaddr *lsa) - setsockopt_int(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, opt_ttl); - } - -+ if(using_dgram) { -+ int hold = 65536; -+ if (setsockopt(pingsock, SOL_IP, IP_RECVTTL, (char *)&hold, sizeof(hold))) -+ perror("WARNING: setsockopt(IP_RECVTTL)"); -+ if (setsockopt(pingsock, SOL_IP, IP_RETOPTS, (char *)&hold, sizeof(hold))) -+ perror("WARNING: setsockopt(IP_RETOPTS)"); -+ -+ } -+ - signal(SIGINT, print_stats_and_exit); - - /* start the ping's going ... */ -@@ -742,10 +790,33 @@ static void ping6(len_and_sockaddr *lsa) - char control_buf[CMSG_SPACE(36)]; - - pingaddr.sin6 = lsa->u.sin6; -- if (source_lsa) -+ if (source_lsa && !using_dgram) - xbind(pingsock, &source_lsa->u.sa, source_lsa->len); -+ else if(using_dgram) { -+ struct sockaddr_in6 sa = {0}; -+ socklen_t sl; -+ -+ sa.sin6_family = AF_INET6; -+ sa.sin6_port = 0; -+ if(source_lsa) { -+ memcpy(&sa.sin6_addr, &source_lsa->u.sin6.sin6_addr, sizeof(struct in6_addr)); -+ } -+ sl = sizeof(sa); -+ -+ if (bind(pingsock, (struct sockaddr *) &sa, sl) == -1) { -+ perror("bind"); -+ exit(2); -+ } -+ -+ if (getsockname(pingsock, (struct sockaddr *) &sa, &sl) == -1) { -+ perror("getsockname"); -+ exit(2); -+ } -+ myid = sa.sin6_port; -+ } - - #ifdef ICMP6_FILTER -+ if(!using_dgram) - { - struct icmp6_filter filt; - if (!(option_mask32 & OPT_VERBOSE)) { -@@ -874,7 +945,7 @@ static int common_ping_main(int opt, char **argv) - if (opt & OPT_p) - G.pattern = xstrtou_range(str_p, 16, 0, 255); - -- myid = (uint16_t) getpid(); -+ if (!using_dgram) myid = (uint16_t) getpid(); - hostname = argv[optind]; - #if ENABLE_PING6 - { --- -2.7.4 - diff --git a/main/busybox/0002-set-applet-location-to-correspond-to-upstream-for-vi.patch b/main/busybox/0002-set-applet-location-to-correspond-to-upstream-for-vi.patch new file mode 100644 index 00000000000..bbb68e3c2c5 --- /dev/null +++ b/main/busybox/0002-set-applet-location-to-correspond-to-upstream-for-vi.patch @@ -0,0 +1,40 @@ +From 0dab6f340920d1e5c61bda6640205a9e376b9a97 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 4 Aug 2016 11:05:02 +0200 +Subject: [PATCH 02/15] set applet location to correspond to upstream for vi + and lspci + +--- + editors/vi.c | 2 +- + include/applets.src.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/editors/vi.c b/editors/vi.c +index 974f997..05d39ea 100644 +--- a/editors/vi.c ++++ b/editors/vi.c +@@ -166,7 +166,7 @@ + //config: Unless you want more (or less) frequent "undo points" while typing, + //config: you should probably leave this unchanged. + +-//applet:IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP)) ++//applet:IF_VI(APPLET(vi, BB_DIR_USR_BIN, BB_SUID_DROP)) + + //kbuild:lib-$(CONFIG_VI) += vi.o + +diff --git a/include/applets.src.h b/include/applets.src.h +index 6e1b02f..03ee70d 100644 +--- a/include/applets.src.h ++++ b/include/applets.src.h +@@ -199,7 +199,7 @@ IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP)) + IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname)) + IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) + IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls)) +-IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP)) ++IF_LSPCI(APPLET(lspci, BB_DIR_USR_SBIN, BB_SUID_DROP)) + IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP)) + IF_MAKEDEVS(APPLET(makedevs, BB_DIR_SBIN, BB_SUID_DROP)) + IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP)) +-- +2.9.1 + diff --git a/main/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch b/main/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch new file mode 100644 index 00000000000..2e3f1e28822 --- /dev/null +++ b/main/busybox/0003-udhcpc-set-default-discover-retries-to-5.patch @@ -0,0 +1,26 @@ +From c5a44a23ce9b2893c6a5b6e037c4c1cc5aa543a5 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 4 Aug 2016 11:08:35 +0200 +Subject: [PATCH 03/15] udhcpc: set default discover retries to 5 + +Some slower nics needs more attempts to get a lease +--- + networking/udhcp/dhcpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c +index fc7b621..ada6142 100644 +--- a/networking/udhcp/dhcpc.c ++++ b/networking/udhcp/dhcpc.c +@@ -1255,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 = 3; ++ int discover_retries = 5; + uint32_t server_addr = server_addr; /* for compiler */ + uint32_t requested_ip = 0; + uint32_t xid = xid; /* for compiler */ +-- +2.9.1 + diff --git a/main/busybox/0004-ping-make-ping-work-without-root-privileges.patch b/main/busybox/0004-ping-make-ping-work-without-root-privileges.patch new file mode 100644 index 00000000000..65e5ae44388 --- /dev/null +++ b/main/busybox/0004-ping-make-ping-work-without-root-privileges.patch @@ -0,0 +1,197 @@ +From dc3cf4277f672ed1ce567c6915e28341e7963380 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Tue, 29 Mar 2016 18:59:22 +0200 +Subject: [PATCH 04/15] ping: make ping work without root privileges + +--- + networking/ping.c | 103 +++++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 87 insertions(+), 16 deletions(-) + +diff --git a/networking/ping.c b/networking/ping.c +index cfe6826..e4474ae 100644 +--- a/networking/ping.c ++++ b/networking/ping.c +@@ -155,6 +155,7 @@ enum { + pingsock = 0, + }; + ++static int using_dgram; + static void + #if ENABLE_PING6 + create_icmp_socket(len_and_sockaddr *lsa) +@@ -171,9 +172,23 @@ create_icmp_socket(void) + #endif + sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */ + if (sock < 0) { +- if (errno == EPERM) +- bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); +- bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); ++ if (errno != EPERM) ++ bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); ++#if defined(__linux__) || defined(__APPLE__) ++ /* We don't have root privileges. Try SOCK_DGRAM instead. ++ * Linux needs net.ipv4.ping_group_range for this to work. ++ * MacOSX allows ICMP_ECHO, ICMP_TSTAMP or ICMP_MASKREQ ++ */ ++#if ENABLE_PING6 ++ if (lsa->u.sa.sa_family == AF_INET6) ++ sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6); ++ else ++#endif ++ sock = socket(AF_INET, SOCK_DGRAM, 1); /* 1 == ICMP */ ++ if (sock < 0) ++#endif ++ bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); ++ using_dgram = 1; + } + + xmove_fd(sock, pingsock); +@@ -224,10 +239,12 @@ static void ping4(len_and_sockaddr *lsa) + bb_perror_msg("recvfrom"); + continue; + } +- if (c >= 76) { /* ip + icmp */ +- struct iphdr *iphdr = (struct iphdr *) G.packet; ++ if (c >= 76 || using_dgram && (c == 64)) { /* ip + icmp */ ++ if(!using_dgram) { ++ struct iphdr *iphdr = (struct iphdr *) G.packet; + +- pkt = (struct icmp *) (G.packet + (iphdr->ihl << 2)); /* skip ip hdr */ ++ pkt = (struct icmp *) (G.packet + (iphdr->ihl << 2)); /* skip ip hdr */ ++ } else pkt = (struct icmp *) G.packet; + if (pkt->icmp_type == ICMP_ECHOREPLY) + break; + } +@@ -619,19 +636,21 @@ static void unpack_tail(int sz, uint32_t *tp, + } + static void unpack4(char *buf, int sz, struct sockaddr_in *from) + { +- struct icmp *icmppkt; + struct iphdr *iphdr; ++ struct icmp *icmppkt; + int hlen; + + /* discard if too short */ + if (sz < (datalen + ICMP_MINLEN)) + return; ++ if(!using_dgram) { ++ /* check IP header */ ++ iphdr = (struct iphdr *) buf; ++ hlen = iphdr->ihl << 2; ++ sz -= hlen; ++ icmppkt = (struct icmp *) (buf + hlen); ++ } else icmppkt = (struct icmp *) buf; + +- /* check IP header */ +- iphdr = (struct iphdr *) buf; +- hlen = iphdr->ihl << 2; +- sz -= hlen; +- icmppkt = (struct icmp *) (buf + hlen); + if (icmppkt->icmp_id != myid) + return; /* not our ping */ + +@@ -643,7 +662,7 @@ static void unpack4(char *buf, int sz, struct sockaddr_in *from) + tp = (uint32_t *) icmppkt->icmp_data; + unpack_tail(sz, tp, + inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr), +- recv_seq, iphdr->ttl); ++ recv_seq, using_dgram ? 42 : iphdr->ttl); + } else if (icmppkt->icmp_type != ICMP_ECHO) { + bb_error_msg("warning: got ICMP %d (%s)", + icmppkt->icmp_type, +@@ -687,11 +706,31 @@ static void ping4(len_and_sockaddr *lsa) + int sockopt; + + pingaddr.sin = lsa->u.sin; +- if (source_lsa) { ++ if (source_lsa && !using_dgram) { + if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, + &source_lsa->u.sa, source_lsa->len)) + bb_error_msg_and_die("can't set multicast source interface"); + xbind(pingsock, &source_lsa->u.sa, source_lsa->len); ++ } else if(using_dgram) { ++ struct sockaddr_in sa; ++ socklen_t sl; ++ ++ sa.sin_family = AF_INET; ++ sa.sin_port = 0; ++ sa.sin_addr.s_addr = source_lsa ? ++ source_lsa->u.sin.sin_addr.s_addr : 0; ++ sl = sizeof(sa); ++ ++ if (bind(pingsock, (struct sockaddr *) &sa, sl) == -1) { ++ perror("bind"); ++ exit(2); ++ } ++ ++ if (getsockname(pingsock, (struct sockaddr *) &sa, &sl) == -1) { ++ perror("getsockname"); ++ exit(2); ++ } ++ myid = sa.sin_port; + } + + /* enable broadcast pings */ +@@ -708,6 +747,15 @@ static void ping4(len_and_sockaddr *lsa) + setsockopt_int(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, opt_ttl); + } + ++ if(using_dgram) { ++ int hold = 65536; ++ if (setsockopt(pingsock, SOL_IP, IP_RECVTTL, (char *)&hold, sizeof(hold))) ++ perror("WARNING: setsockopt(IP_RECVTTL)"); ++ if (setsockopt(pingsock, SOL_IP, IP_RETOPTS, (char *)&hold, sizeof(hold))) ++ perror("WARNING: setsockopt(IP_RETOPTS)"); ++ ++ } ++ + signal(SIGINT, print_stats_and_exit); + + /* start the ping's going ... */ +@@ -741,10 +789,33 @@ static void ping6(len_and_sockaddr *lsa) + char control_buf[CMSG_SPACE(36)]; + + pingaddr.sin6 = lsa->u.sin6; +- if (source_lsa) ++ if (source_lsa && !using_dgram) + xbind(pingsock, &source_lsa->u.sa, source_lsa->len); ++ else if(using_dgram) { ++ struct sockaddr_in6 sa = {0}; ++ socklen_t sl; ++ ++ sa.sin6_family = AF_INET6; ++ sa.sin6_port = 0; ++ if(source_lsa) { ++ memcpy(&sa.sin6_addr, &source_lsa->u.sin6.sin6_addr, sizeof(struct in6_addr)); ++ } ++ sl = sizeof(sa); ++ ++ if (bind(pingsock, (struct sockaddr *) &sa, sl) == -1) { ++ perror("bind"); ++ exit(2); ++ } ++ ++ if (getsockname(pingsock, (struct sockaddr *) &sa, &sl) == -1) { ++ perror("getsockname"); ++ exit(2); ++ } ++ myid = sa.sin6_port; ++ } + + #ifdef ICMP6_FILTER ++ if(!using_dgram) + { + struct icmp6_filter filt; + if (!(option_mask32 & OPT_VERBOSE)) { +@@ -872,7 +943,7 @@ static int common_ping_main(int opt, char **argv) + if (opt & OPT_p) + G.pattern = xstrtou_range(str_p, 16, 0, 255); + +- myid = (uint16_t) getpid(); ++ if (!using_dgram) myid = (uint16_t) getpid(); + hostname = argv[optind]; + #if ENABLE_PING6 + { +-- +2.9.1 + diff --git a/main/busybox/0005-fbsplash-support-console-switching.patch b/main/busybox/0005-fbsplash-support-console-switching.patch new file mode 100644 index 00000000000..7ffa5da1cd9 --- /dev/null +++ b/main/busybox/0005-fbsplash-support-console-switching.patch @@ -0,0 +1,187 @@ +From 44be65aa1de3ad093cd754574734175884048285 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Mon, 24 Sep 2012 07:58:29 +0300 +Subject: [PATCH 05/15] fbsplash: support console switching +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Timo Teräs +--- + miscutils/fbsplash.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 76 insertions(+), 7 deletions(-) + +diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c +index 3ddf8a2..aaaca39 100644 +--- a/miscutils/fbsplash.c ++++ b/miscutils/fbsplash.c +@@ -22,7 +22,7 @@ + */ + + //usage:#define fbsplash_trivial_usage +-//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" ++//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD] [-T tty]" + //usage:#define fbsplash_full_usage "\n\n" + //usage: " -s Image" + //usage: "\n -c Hide cursor" +@@ -32,11 +32,17 @@ + //usage: "\n BAR_R,BAR_G,BAR_B" + //usage: "\n -f Control pipe (else exit after drawing image)" + //usage: "\n commands: 'NN' (% for progress bar) or 'exit'" ++//usage: "\n -T Switch to TTY to hide all console messages" + + #include "libbb.h" + #include "common_bufsiz.h" + #include + ++#include ++#include ++#include ++#include ++ + /* If you want logging messages on /tmp/fbsplash.log... */ + #define DEBUG 0 + +@@ -48,6 +54,8 @@ struct globals { + unsigned char *addr; // pointer to framebuffer memory + unsigned ns[7]; // n-parameters + const char *image_filename; ++ int silent_tty, fd_tty_s; ++ bool do_not_draw; + struct fb_var_screeninfo scr_var; + struct fb_fix_screeninfo scr_fix; + unsigned bytes_per_pixel; +@@ -458,6 +466,11 @@ static void init(const char *cfg_filename) + config_close(parser); + } + ++static void sighandler(int sig) ++{ ++ ioctl(G.fd_tty_s, VT_RELDISP, sig == SIGUSR1 ? 1 : 2); ++ G.do_not_draw = (sig != SIGUSR2); ++} + + int fbsplash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; + int fbsplash_main(int argc UNUSED_PARAM, char **argv) +@@ -467,6 +480,9 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + char *num_buf; + unsigned num; + bool bCursorOff; ++ int fd_tty0, active_vt; ++ struct vt_stat vtstat; ++ struct vt_mode vt; + + INIT_G(); + +@@ -474,8 +490,10 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + fb_device = "/dev/fb0"; + cfg_filename = NULL; + fifo_filename = NULL; +- bCursorOff = 1 & getopt32(argv, "cs:d:i:f:", +- &G.image_filename, &fb_device, &cfg_filename, &fifo_filename); ++ opt_complementary = "T+"; // numeric params ++ bCursorOff = 1 & getopt32(argv, "cs:d:i:f:T:", ++ &G.image_filename, &fb_device, &cfg_filename, &fifo_filename, ++ &G.silent_tty); + + // parse configuration file + if (cfg_filename) +@@ -485,11 +503,43 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + if (!G.image_filename) + bb_show_usage(); + ++ fd_tty0 = get_console_fd_or_die(); ++ if (G.silent_tty) { ++ char buf[16]; ++ ++ /* Initialize TTY */ ++ bb_signals((1LL << SIGUSR1) | (1LL << SIGUSR2), sighandler); ++ snprintf(buf, sizeof(buf), "/dev/tty%d", G.silent_tty); ++ G.fd_tty_s = xopen(buf, O_RDWR | O_NOCTTY); ++ ++ /* Activate TTY */ ++ xioctl(fd_tty0, VT_GETSTATE, &vtstat); ++ active_vt = vtstat.v_active; ++ console_make_active(fd_tty0, G.silent_tty); ++ ++ /* Get notifications on console changes */ ++ vt.mode = VT_PROCESS; ++ vt.waitv = 0; ++ vt.relsig = SIGUSR1; ++ vt.acqsig = SIGUSR2; ++ ioctl(G.fd_tty_s, VT_SETMODE, &vt); ++ ++ /* Redirect all kernel messages to tty1 so that they don't get ++ * printed over our silent splash image. And clear it. */ ++ buf[0] = TIOCL_SETKMSGREDIRECT; ++ buf[1] = 1; ++ ioctl(G.fd_tty_s, TIOCLINUX, buf); ++ full_write(G.fd_tty_s, "\e[H\e[2J" "\e[?17;0c", 7+8); ++ ioctl(G.fd_tty_s, KDSETMODE, KD_GRAPHICS); ++ } else { ++ G.fd_tty_s = STDOUT_FILENO; ++ } ++ + fb_open(fb_device); + + if (fifo_filename && bCursorOff) { + // hide cursor (BEFORE any fb ops) +- full_write(STDOUT_FILENO, "\033[?25l", 6); ++ full_write(G.fd_tty_s, "\033[?25l", 6); + } + + fb_drawimage(); +@@ -497,6 +547,7 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + if (!fifo_filename) + return EXIT_SUCCESS; + ++ sig_block(SIGUSR1); + fp = xfopen_stdin(fifo_filename); + if (fp != stdin) { + // For named pipes, we want to support this: +@@ -512,8 +563,9 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + // and become an additional writer :) + open(fifo_filename, O_WRONLY); // errors are ignored + } +- + fb_drawprogressbar(0); ++ sig_unblock(SIGUSR1); ++ + // Block on read, waiting for some input. + // Use of style I/O allows to correctly + // handle a case when we have many buffered lines +@@ -528,12 +580,29 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) + #if DEBUG + DEBUG_MESSAGE(itoa(num)); + #endif +- fb_drawprogressbar(num); ++ sig_block(SIGUSR1); ++ if (!G.do_not_draw) ++ fb_drawprogressbar(num); ++ sig_unblock(SIGUSR1); + } + free(num_buf); + } + +- if (bCursorOff) // restore cursor ++ if (G.silent_tty) { ++ usleep(100*1000); ++ ++ ioctl(G.fd_tty_s, VT_RELDISP, 1); ++ ioctl(G.fd_tty_s, KDSETMODE, KD_TEXT); ++ vt.mode = VT_AUTO; ++ vt.waitv = 0; ++ ioctl(G.fd_tty_s, VT_SETMODE, &vt); ++ close(G.fd_tty_s); ++ ++ xioctl(fd_tty0, VT_GETSTATE, &vtstat); ++ if (vtstat.v_active == G.silent_tty) ++ console_make_active(fd_tty0, active_vt); ++ ioctl(fd_tty0, VT_DISALLOCATE, (void *)(ptrdiff_t)G.silent_tty); ++ } else if (bCursorOff) // restore cursor + full_write(STDOUT_FILENO, "\033[?25h", 6); + + return EXIT_SUCCESS; +-- +2.9.1 + diff --git a/main/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch b/main/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch new file mode 100644 index 00000000000..a2886202f04 --- /dev/null +++ b/main/busybox/0006-fbsplash-support-image-and-bar-alignment-and-positio.patch @@ -0,0 +1,185 @@ +From 942f123dce1f36144b200731df7abfd3dbc92f22 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Fri, 21 Nov 2014 16:06:34 +0200 +Subject: [PATCH 06/15] fbsplash: support image and bar alignment and + positioning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Timo Teräs +--- + miscutils/fbsplash.c | 91 +++++++++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 76 insertions(+), 15 deletions(-) + +diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c +index aaaca39..ea0dc22 100644 +--- a/miscutils/fbsplash.c ++++ b/miscutils/fbsplash.c +@@ -28,6 +28,7 @@ + //usage: "\n -c Hide cursor" + //usage: "\n -d Framebuffer device (default /dev/fb0)" + //usage: "\n -i Config file (var=value):" ++//usage: "\n IMAGE_ALIGN" + //usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" + //usage: "\n BAR_R,BAR_G,BAR_B" + //usage: "\n -f Control pipe (else exit after drawing image)" +@@ -46,13 +47,38 @@ + /* If you want logging messages on /tmp/fbsplash.log... */ + #define DEBUG 0 + ++enum { ++ image_align, ++ ++ image_posx, ++ image_posy, ++ bar_width, ++ bar_height, ++ bar_posx, ++ bar_posy, ++ bar_colr, ++ bar_colg, ++ bar_colb, ++ ++ debug ++}; ++ ++#define nimage_align ns[image_align] ++#define nbar_width ns[bar_width] ++#define nbar_height ns[bar_height] ++#define nbar_posx ns[bar_posx] ++#define nbar_posy ns[bar_posy] ++#define nbar_colr ns[bar_colr] ++#define nbar_colg ns[bar_colg] ++#define nbar_colb ns[bar_colb] ++ + struct globals { + #if DEBUG + bool bdebug_messages; // enable/disable logging + FILE *logfile_fd; // log file + #endif + unsigned char *addr; // pointer to framebuffer memory +- unsigned ns[7]; // n-parameters ++ unsigned ns[debug+1]; // n-parameters + const char *image_filename; + int silent_tty, fd_tty_s; + bool do_not_draw; +@@ -69,14 +95,6 @@ struct globals { + SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ + } while (0) + +-#define nbar_width ns[0] // progress bar width +-#define nbar_height ns[1] // progress bar height +-#define nbar_posx ns[2] // progress bar horizontal position +-#define nbar_posy ns[3] // progress bar vertical position +-#define nbar_colr ns[4] // progress bar color red component +-#define nbar_colg ns[5] // progress bar color green component +-#define nbar_colb ns[6] // progress bar color blue component +- + #if DEBUG + #define DEBUG_MESSAGE(strMessage, args...) \ + if (G.bdebug_messages) { \ +@@ -357,7 +375,7 @@ static void fb_drawimage(void) + FILE *theme_file; + char *read_ptr; + unsigned char *pixline; +- unsigned i, j, width, height, line_size; ++ int i, j, width, height, line_size, xoffs, yoffs, xstart; + + if (LONE_DASH(G.image_filename)) { + theme_file = stdin; +@@ -407,18 +425,46 @@ static void fb_drawimage(void) + line_size = width*3; + pixline = xmalloc(line_size); + ++#if 0 + if (width > G.scr_var.xres) + width = G.scr_var.xres; + if (height > G.scr_var.yres) + height = G.scr_var.yres; +- for (j = 0; j < height; j++) { ++#endif ++ ++ xoffs = yoffs = 0; ++ switch (G.nimage_align % 3) { ++ case 1: xoffs = (G.scr_var.xres - width) / 2; break; ++ case 2: xoffs = G.scr_var.xres - width; break; ++ } ++ xstart = 0; ++ if (xoffs < 0) { ++ xstart = -xoffs; ++ width -= xstart; ++ xoffs = 0; ++ } ++ xoffs *= G.bytes_per_pixel; ++ if (width > G.scr_var.xres) ++ width = G.scr_var.xres; ++ ++ switch (G.nimage_align / 3) { ++ case 1: yoffs = (G.scr_var.yres - height) / 2; break; ++ case 2: yoffs = G.scr_var.yres - height; break; ++ } ++ ++ for (j = 0; j < height && yoffs < G.scr_var.yres; j++, yoffs++) { + unsigned char *pixel; + unsigned char *src; + + if (fread(pixline, 1, line_size, theme_file) != line_size) + bb_error_msg_and_die("bad PPM file '%s'", G.image_filename); ++ ++ if (yoffs < 0) ++ continue; ++ + pixel = pixline; +- src = G.addr + j * G.scr_fix.line_length; ++ src = G.addr + yoffs * G.scr_fix.line_length + xoffs; ++ + for (i = 0; i < width; i++) { + unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]); + fb_write_pixel(src, thispix); +@@ -437,9 +483,17 @@ static void fb_drawimage(void) + */ + static void init(const char *cfg_filename) + { ++ static const char align_names[] ALIGN1 = ++ "LT\0" "CT\0" "RT\0" ++ "LM\0" "CM\0" "RM\0" ++ "LB\0" "CB\0" "RB\0"; + static const char param_names[] ALIGN1 = ++ "IMAGE_ALIGN\0" ++ ++ "IMAGE_X\0" "IMAGE_Y\0" + "BAR_WIDTH\0" "BAR_HEIGHT\0" + "BAR_LEFT\0" "BAR_TOP\0" ++ + "BAR_R\0" "BAR_G\0" "BAR_B\0" + #if DEBUG + "DEBUG\0" +@@ -449,14 +503,21 @@ static void init(const char *cfg_filename) + parser_t *parser = config_open2(cfg_filename, xfopen_stdin); + while (config_read(parser, token, 2, 2, "#=", + (PARSE_NORMAL | PARSE_MIN_DIE) & ~(PARSE_TRIM | PARSE_COLLAPSE))) { +- unsigned val = xatoi_positive(token[1]); ++ unsigned val; + int i = index_in_strings(param_names, token[0]); ++ + if (i < 0) + bb_error_msg_and_die("syntax error: %s", token[0]); +- if (i >= 0 && i < 7) ++ ++ if (i <= image_align) ++ val = index_in_strings(align_names, token[1]); ++ else ++ val = xatoi_positive(token[1]); ++ ++ if (i < debug) + G.ns[i] = val; + #if DEBUG +- if (i == 7) { ++ if (i == debug) { + G.bdebug_messages = val; + if (G.bdebug_messages) + G.logfile_fd = xfopen_for_write("/tmp/fbsplash.log"); +-- +2.9.1 + diff --git a/main/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch b/main/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch new file mode 100644 index 00000000000..03a503c0708 --- /dev/null +++ b/main/busybox/0007-depmod-support-generating-kmod-binary-index-files.patch @@ -0,0 +1,501 @@ +From 249ef5277e15bd9f6728275a4d21ffdcd7877dc4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Sun, 25 Oct 2015 22:21:41 +0200 +Subject: [PATCH 07/15] depmod: support generating kmod binary index files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows to use busybox depmod, and run daemons +using libkmod (or even kmod modprobe if needed). + +About +1500 bytes when enabled. This patch merges some +depmod code paths, so when this is disabled it shrinks +the code size a little bit. + +Signed-off-by: Timo Teräs +--- + modutils/Config.src | 10 ++ + modutils/depmod.c | 277 ++++++++++++++++++++++++++++++++++++++++++---------- + modutils/modprobe.c | 15 --- + modutils/modutils.c | 27 ++++- + modutils/modutils.h | 15 +++ + 5 files changed, 278 insertions(+), 66 deletions(-) + +diff --git a/modutils/Config.src b/modutils/Config.src +index 0b11832..09db515 100644 +--- a/modutils/Config.src ++++ b/modutils/Config.src +@@ -229,6 +229,16 @@ config FEATURE_MODUTILS_ALIAS + + Say Y if unsure. + ++config FEATURE_MODUTILS_BIN ++ bool "Support for the kmod .bin file format" ++ default n ++ depends on DEPMOD && !MODPROBE_SMALL ++ select PLATFORM_LINUX ++ help ++ Generate kmod compatible binary index files for .dep, .alias, ++ .symbols and .builtin files. Allows mixing use of busybox ++ modutils and kmod (binaries and library). ++ + config FEATURE_MODUTILS_SYMBOLS + bool "Support for module.symbols file" + default y +diff --git a/modutils/depmod.c b/modutils/depmod.c +index e5f0e3d..c35a584 100644 +--- a/modutils/depmod.c ++++ b/modutils/depmod.c +@@ -2,7 +2,7 @@ + /* + * depmod - generate modules.dep + * Copyright (c) 2008 Bernhard Reutner-Fischer +- * Copyrihgt (c) 2008 Timo Teras ++ * Copyrihgt (c) 2008-2015 Timo Teras + * Copyright (c) 2008 Vladimir Dronnikov + * + * Licensed under GPLv2 or later, see file LICENSE in this source tree. +@@ -14,6 +14,24 @@ + #include "modutils.h" + #include /* uname() */ + ++#define INDEX_MINCHAR 32 ++#define INDEX_MAXCHAR 128 ++ ++typedef struct index_node { ++ char *prefix; ++ llist_t *values; ++ struct index_node *children[INDEX_MAXCHAR-INDEX_MINCHAR]; ++} index_node; ++ ++struct globals { ++ module_db db; ++ index_node *root_node; ++} FIX_ALIASING; ++#define G (*ptr_to_globals) ++#define INIT_G() do { \ ++ SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ ++} while (0) ++ + /* + * Theory of operation: + * - iterate over all modules and record their full path +@@ -41,18 +59,12 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA + + for (ptr = image; ptr < image + len - 10; ptr++) { + if (is_prefixed_with(ptr, "depends=")) { +- char *u; +- + ptr += 8; +- for (u = ptr; *u; u++) +- if (*u == '-') +- *u = '_'; +- ptr += string_to_llist(ptr, &e->deps, ","); ++ string_to_llist(replace_underscores(ptr), &e->deps, ","); + } else if (ENABLE_FEATURE_MODUTILS_ALIAS + && is_prefixed_with(ptr, "alias=") + ) { +- llist_add_to(&e->aliases, xstrdup(ptr + 6)); +- ptr += strlen(ptr); ++ llist_add_to(&e->aliases, replace_underscores(xstrdup(ptr + 6))); + } else if (ENABLE_FEATURE_MODUTILS_SYMBOLS + && is_prefixed_with(ptr, "__ksymtab_") + ) { +@@ -62,9 +74,10 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA + ) { + continue; + } +- llist_add_to(&e->symbols, xstrdup(ptr)); +- ptr += strlen(ptr); +- } ++ llist_add_to(&e->symbols, xasprintf("symbol:%s", ptr)); ++ } else ++ continue; ++ ptr += strlen(ptr); + } + free(image); + +@@ -96,12 +109,6 @@ static void order_dep_list(module_db *modules, module_entry *start, llist_t *add + } + } + +-static void xfreopen_write(const char *file, FILE *f) +-{ +- if (freopen(file, "w", f) == NULL) +- bb_perror_msg_and_die("can't open '%s'", file); +-} +- + //usage:#if !ENABLE_MODPROBE_SMALL + //usage:#define depmod_trivial_usage "[-n] [-b BASE] [VERSION] [MODFILES]..." + //usage:#define depmod_full_usage "\n\n" +@@ -155,6 +162,169 @@ enum { + OPT_C = (1 << 9), /* -C,--config etc_modules_conf: ignored */ + }; + ++/* Support for the mod binary index generation */ ++ ++static void index_init(const char *filename) ++{ ++ if (ENABLE_FEATURE_MODUTILS_BIN) { ++ index_node *n; ++ ++ n = xzalloc(sizeof(index_node)); ++ n->prefix = xstrdup(""); ++ G.root_node = n; ++ } ++ ++ if (filename && !(option_mask32 & OPT_n)) { ++ if (freopen(filename, "w", stdout) == NULL) ++ bb_perror_msg_and_die("can't open '%s'", filename); ++ } ++} ++ ++static void index_add(const char *key, char *value, const char *prefix) ++{ ++ if (prefix && *prefix) ++ printf("%s%s %s\n", prefix, key, value); ++ else if (prefix) ++ printf("%s\n", value); ++ ++ if (ENABLE_FEATURE_MODUTILS_BIN) { ++ index_node *cur = G.root_node, *n; ++ unsigned i = 0, j, ch; ++ ++ while (1) { ++ /* Ensure node->prefix is a prefix of &str[i]. ++ * If it is not already, then we must split node. */ ++ for (j = 0; cur->prefix[j]; j++) { ++ ch = cur->prefix[j]; ++ if (ch != key[i+j]) { ++ /* New child is copy of node with prefix[j+1..N] */ ++ n = xzalloc(sizeof(index_node)); ++ n->prefix = xstrdup(&cur->prefix[j+1]); ++ n->values = cur->values; ++ memcpy(n->children, cur->children, sizeof(n->children)); ++ ++ /* Parent has prefix[0..j], child at prefix[j] */ ++ cur->prefix[j] = '\0'; ++ cur->values = NULL; ++ memset(cur->children, 0, sizeof(cur->children)); ++ cur->children[ch-INDEX_MINCHAR] = n; ++ break; ++ } ++ } ++ i += j; ++ ++ ch = key[i]; ++ if (ch == 0) ++ break; ++ ++ if (ch < INDEX_MINCHAR || ch >= INDEX_MAXCHAR) ++ bb_error_msg_and_die("bad module name"); ++ ++ ch -= INDEX_MINCHAR; ++ if (!cur->children[ch]) { ++ n = xzalloc(sizeof(index_node)); ++ cur->children[ch] = n; ++ n->prefix = xstrdup(&key[i+1]); ++ cur = n; ++ break; ++ } ++ ++ /* Descend into child node and continue */ ++ cur = cur->children[ch]; ++ i++; ++ } ++ ++ llist_add_to(&cur->values, value); ++ } ++} ++ ++static uint32_t index_write_node(FILE *out, index_node *n, void (*freeit)(void *data)) ++{ ++ uint32_t child_offs[INDEX_MAXCHAR-INDEX_MINCHAR]; ++ uint32_t offset; ++ uint8_t first = 255, last = 0; ++ unsigned i; ++ ++ for (i = 0; i < INDEX_MAXCHAR-INDEX_MINCHAR; i++) { ++ child_offs[i] = 0; ++ if (!n->children[i]) ++ continue; ++ child_offs[i] = index_write_node(out, n->children[i], freeit); ++ if (first > INDEX_MAXCHAR) ++ first = i; ++ last = i; ++ } ++ ++ offset = ftell(out); ++ ++ if (n->prefix[0]) { ++ fputs(n->prefix, out); ++ fputc('\0', out); ++ offset |= INDEX_NODE_PREFIX; ++ } ++ ++ if (first < INDEX_MAXCHAR) { ++ fputc(first + INDEX_MINCHAR, out); ++ fputc(last + INDEX_MINCHAR, out); ++ fwrite(child_offs + first, sizeof(uint32_t), last - first + 1, out); ++ offset |= INDEX_NODE_CHILDS; ++ } ++ ++ if (n->values) { ++ const llist_t *v; ++ unsigned int cnt; ++ uint32_t u; ++ ++ n->values = llist_rev(n->values); ++ for (v = n->values, cnt = 0; v != NULL; v = v->link, cnt++); ++ u = htonl(cnt); ++ fwrite(&u, sizeof(u), 1, out); ++ for (v = n->values, cnt = 0; v != NULL; v = v->link, cnt++) { ++ u = htonl(cnt); ++ fwrite(&u, sizeof(u), 1, out); ++ fputs(v->data, out); ++ fputc('\0', out); ++ } ++ offset |= INDEX_NODE_VALUES; ++ } ++ ++ llist_free(n->values, freeit); ++ free(n->prefix); ++ free(n); ++ ++ return htonl(offset); ++} ++ ++static void index_dump(const char *filename, int deps_file) ++{ ++ if (ENABLE_FEATURE_MODUTILS_BIN) { ++ FILE *out; ++ uint32_t header[3] = { ++ htonl(INDEX_MAGIC), ++ htonl(INDEX_VERSION), ++ }; ++ ++ if (option_mask32 & OPT_n) ++ filename = "/dev/null"; ++ else ++ filename = xasprintf("tmp.%s.bin", filename); ++ ++ out = xfopen_for_write(filename); ++ fwrite(header, sizeof(uint32_t), 3, out); ++ header[2] = index_write_node(out, G.root_node, deps_file ? free : 0); ++ rewind(out); ++ G.root_node = NULL; ++ fwrite(header, sizeof(uint32_t), 3, out); ++ if (fclose(out)) { ++ remove(filename); ++ bb_error_msg_and_die(bb_msg_write_error); ++ } ++ /* .bin files are mmap'ed; not renaming it may crash ++ * long standing daemon using libkmod */ ++ rename_or_warn(filename, filename + 4); ++ } ++} ++ + int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; + int depmod_main(int argc UNUSED_PARAM, char **argv) + { +@@ -198,53 +368,60 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) + } + + /* Generate dependency and alias files */ +- if (!(option_mask32 & OPT_n)) +- xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout); +- ++ index_init(CONFIG_DEFAULT_DEPMOD_FILE); + moddb_foreach_module(&modules, m, i) { +- printf("%s:", m->name); +- ++ char *buf = xasprintf("%s:", m->name); + order_dep_list(&modules, m, m->deps); ++ + while (m->dnext != m) { + dep = m->dnext; +- printf(" %s", dep->name); +- ++ buf = gather_options_str(buf, dep->name); + /* unlink current entry */ + dep->dnext->dprev = dep->dprev; + dep->dprev->dnext = dep->dnext; + dep->dnext = dep->dprev = dep; + } +- bb_putchar('\n'); ++ index_add(m->modname, buf, ""); + } ++ index_dump(CONFIG_DEFAULT_DEPMOD_FILE, 1); + +-#if ENABLE_FEATURE_MODUTILS_ALIAS +- if (!(option_mask32 & OPT_n)) +- xfreopen_write("modules.alias", stdout); +- moddb_foreach_module(&modules, m, i) { +- while (m->aliases) { +- /* +- * Last word used to be a basename +- * (filename with path and .ko.* stripped) +- * at the time of module-init-tools 3.4. +- * kmod v.12 uses module name, i.e., s/-/_/g. +- */ +- printf("alias %s %s\n", +- (char*)llist_pop(&m->aliases), +- m->modname); ++ if (ENABLE_FEATURE_MODUTILS_ALIAS) { ++ index_init("modules.alias"); ++ moddb_foreach_module(&modules, m, i) { ++ while (m->aliases) { ++ /* ++ * Last word used to be a basename ++ * (filename with path and .ko.* stripped) ++ * at the time of module-init-tools 3.4. ++ * kmod v.12 uses module name, i.e., s/-/_/g. ++ */ ++ index_add((char*)llist_pop(&m->aliases), m->modname, "alias "); ++ } + } ++ index_dump("modules.alias", 0); + } +-#endif +-#if ENABLE_FEATURE_MODUTILS_SYMBOLS +- if (!(option_mask32 & OPT_n)) +- xfreopen_write("modules.symbols", stdout); +- moddb_foreach_module(&modules, m, i) { +- while (m->symbols) { +- printf("alias symbol:%s %s\n", +- (char*)llist_pop(&m->symbols), +- m->modname); ++ if (ENABLE_FEATURE_MODUTILS_SYMBOLS) { ++ index_init("modules.symbols"); ++ moddb_foreach_module(&modules, m, i) { ++ while (m->symbols) { ++ index_add((char*)llist_pop(&m->symbols), m->modname, "alias "); ++ } ++ } ++ index_dump("modules.symbols", 0); ++ } ++ if (ENABLE_FEATURE_MODUTILS_BIN) { ++ char line[PATH_MAX], modname[MODULE_NAME_LEN]; ++ FILE *in; ++ ++ index_init(NULL); ++ in = xfopen_for_read("modules.builtin"); ++ while (fgets(line, sizeof(line), in) != NULL) { ++ filename2modname(line, modname); ++ index_add(modname, (char *) "", 0); + } ++ fclose(in); ++ index_dump("modules.builtin", 0); + } +-#endif + + if (ENABLE_FEATURE_CLEAN_UP) + moddb_free(&modules); +diff --git a/modutils/modprobe.c b/modutils/modprobe.c +index 8130c40..ec64477 100644 +--- a/modutils/modprobe.c ++++ b/modutils/modprobe.c +@@ -167,21 +167,6 @@ struct globals { + + static int read_config(const char *path); + +-static char *gather_options_str(char *opts, const char *append) +-{ +- /* Speed-optimized. We call gather_options_str many times. */ +- if (append) { +- if (opts == NULL) { +- opts = xstrdup(append); +- } else { +- int optlen = strlen(opts); +- opts = xrealloc(opts, optlen + strlen(append) + 2); +- sprintf(opts + optlen, " %s", append); +- } +- } +- return opts; +-} +- + static struct module_entry *get_or_add_modentry(const char *module) + { + return moddb_get_or_create(&G.db, module); +diff --git a/modutils/modutils.c b/modutils/modutils.c +index 0a05673..8b6298b 100644 +--- a/modutils/modutils.c ++++ b/modutils/modutils.c +@@ -67,6 +67,21 @@ void FAST_FUNC moddb_free(module_db *db) + } + } + ++char * FAST_FUNC gather_options_str(char *opts, const char *append) ++{ ++ /* Speed-optimized. We call gather_options_str many times. */ ++ if (append) { ++ if (opts == NULL) { ++ opts = xstrdup(append); ++ } else { ++ int optlen = strlen(opts); ++ opts = xrealloc(opts, optlen + strlen(append) + 2); ++ sprintf(opts + optlen, " %s", append); ++ } ++ } ++ return opts; ++} ++ + void FAST_FUNC replace(char *s, char what, char with) + { + while (*s) { +@@ -78,7 +93,17 @@ void FAST_FUNC replace(char *s, char what, char with) + + char* FAST_FUNC replace_underscores(char *s) + { +- replace(s, '-', '_'); ++ int i; ++ for (i = 0; s[i]; i++) { ++ switch (s[i]) { ++ case '-': ++ s[i] = '_'; ++ break; ++ case '[': ++ i += strcspn(&s[i], "]"); ++ break; ++ } ++ } + return s; + } + +diff --git a/modutils/modutils.h b/modutils/modutils.h +index 2cbd144..dd6f173 100644 +--- a/modutils/modutils.h ++++ b/modutils/modutils.h +@@ -18,6 +18,20 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN + #define MODULE_NAME_LEN 256 + #define MODULE_HASH_SIZE 256 + ++/* .bin index format definitions */ ++#define INDEX_MAGIC 0xB007F457 ++#define INDEX_VERSION_MAJOR 0x0002 ++#define INDEX_VERSION_MINOR 0x0001 ++#define INDEX_VERSION ((INDEX_VERSION_MAJOR<<16)|INDEX_VERSION_MINOR) ++ ++enum node_offset { ++ INDEX_NODE_FLAGS = 0xF0000000, /* Flags in high nibble */ ++ INDEX_NODE_PREFIX = 0x80000000, ++ INDEX_NODE_VALUES = 0x40000000, ++ INDEX_NODE_CHILDS = 0x20000000, ++ INDEX_NODE_MASK = 0x0FFFFFFF, /* Offset value */ ++}; ++ + typedef struct module_entry { + struct module_entry *next; + char *name, *modname; +@@ -47,6 +61,7 @@ module_entry *moddb_get(module_db *db, const char *s) FAST_FUNC; + module_entry *moddb_get_or_create(module_db *db, const char *s) FAST_FUNC; + void moddb_free(module_db *db) FAST_FUNC; + ++char *gather_options_str(char *opts, const char *append) FAST_FUNC; + void replace(char *s, char what, char with) FAST_FUNC; + char *replace_underscores(char *s) FAST_FUNC; + int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC; +-- +2.9.1 + diff --git a/main/busybox/0008-login-move-check_securetty-to-libbb.patch b/main/busybox/0008-login-move-check_securetty-to-libbb.patch new file mode 100644 index 00000000000..8acb38f458e --- /dev/null +++ b/main/busybox/0008-login-move-check_securetty-to-libbb.patch @@ -0,0 +1,103 @@ +From b6d861d6ffaf3b367096c057a5f633dea8a8907d Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen +Date: Thu, 5 Nov 2015 16:27:34 +0200 +Subject: [PATCH 08/15] login: move check_securetty to libbb + +--- + include/libbb.h | 1 + + libbb/Kbuild.src | 1 + + libbb/securetty.c | 27 +++++++++++++++++++++++++++ + loginutils/login.c | 19 ------------------- + 4 files changed, 29 insertions(+), 19 deletions(-) + create mode 100644 libbb/securetty.c + +diff --git a/include/libbb.h b/include/libbb.h +index e39021e..25c5868 100644 +--- a/include/libbb.h ++++ b/include/libbb.h +@@ -1374,6 +1374,7 @@ extern void selinux_or_die(void) FAST_FUNC; + #define SETUP_ENV_NO_CHDIR (1 << 4) + void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; + void nuke_str(char *str) FAST_FUNC; ++int check_securetty(const char *short_tty); + int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC; + int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC; + int ask_and_check_password(const struct passwd *pw) FAST_FUNC; +diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src +index 52a90e9..ddaa873 100644 +--- a/libbb/Kbuild.src ++++ b/libbb/Kbuild.src +@@ -83,6 +83,7 @@ lib-y += safe_gethostname.o + lib-y += safe_poll.o + lib-y += safe_strncpy.o + lib-y += safe_write.o ++lib-y += securetty.o + lib-y += setup_environment.o + lib-y += signals.o + lib-y += simplify_path.o +diff --git a/libbb/securetty.c b/libbb/securetty.c +new file mode 100644 +index 0000000..95edbc9 +--- /dev/null ++++ b/libbb/securetty.c +@@ -0,0 +1,27 @@ ++/* vi: set sw=4 ts=4: */ ++/* ++ * /etc/securetty checking. ++ * ++ * Licensed under GPLv2, see file LICENSE in this source tree. ++ */ ++ ++#include "libbb.h" ++ ++#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM ++int check_securetty(const char *short_tty) ++{ ++ char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */ ++ parser_t *parser = config_open2("/etc/securetty", fopen_for_read); ++ while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) { ++ if (strcmp(buf, short_tty) == 0) ++ break; ++ buf = NULL; ++ } ++ config_close(parser); ++ /* buf != NULL here if config file was not found, empty ++ * or line was found which equals short_tty */ ++ return buf != NULL; ++} ++#else ++ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; } ++#endif +diff --git a/loginutils/login.c b/loginutils/login.c +index 94b6c45..9ecf606 100644 +--- a/loginutils/login.c ++++ b/loginutils/login.c +@@ -173,25 +173,6 @@ static void die_if_nologin(void) + # define die_if_nologin() ((void)0) + #endif + +-#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM +-static int check_securetty(const char *short_tty) +-{ +- char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */ +- parser_t *parser = config_open2("/etc/securetty", fopen_for_read); +- while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) { +- if (strcmp(buf, short_tty) == 0) +- break; +- buf = NULL; +- } +- config_close(parser); +- /* buf != NULL here if config file was not found, empty +- * or line was found which equals short_tty */ +- return buf != NULL; +-} +-#else +-static ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; } +-#endif +- + #if ENABLE_SELINUX + static void initselinux(char *username, char *full_tty, + security_context_t *user_sid) +-- +2.9.1 + diff --git a/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch b/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch new file mode 100644 index 00000000000..504a1bcc440 --- /dev/null +++ b/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch @@ -0,0 +1,70 @@ +From 7161cc4e35dff5a21aff1f7b5d3edd7d7dcbacbd Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen +Date: Thu, 5 Nov 2015 16:27:35 +0200 +Subject: [PATCH 09/15] libbb: allow_blank argument for + ask_and_check_password_extended() + +--- + include/libbb.h | 2 +- + libbb/correct_password.c | 6 +++--- + loginutils/sulogin.c | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/include/libbb.h b/include/libbb.h +index 25c5868..1348a46 100644 +--- a/include/libbb.h ++++ b/include/libbb.h +@@ -1376,7 +1376,7 @@ void setup_environment(const char *shell, int flags, const struct passwd *pw) FA + void nuke_str(char *str) FAST_FUNC; + int check_securetty(const char *short_tty); + int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC; +-int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC; ++int ask_and_check_password_extended(const struct passwd *pw, int timeout, int allow_blank, const char *prompt) FAST_FUNC; + int ask_and_check_password(const struct passwd *pw) FAST_FUNC; + /* Returns a malloced string */ + #if !ENABLE_USE_BB_CRYPT +diff --git a/libbb/correct_password.c b/libbb/correct_password.c +index 513c930..57cd2b8 100644 +--- a/libbb/correct_password.c ++++ b/libbb/correct_password.c +@@ -96,7 +96,7 @@ int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext) + * NULL pw means "just fake it for login with bad username" + */ + int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, +- int timeout, const char *prompt) ++ int timeout, int allow_blank, const char *prompt) + { + IF_FEATURE_SHADOWPASSWDS(char buffer[SHADOW_BUFSIZE];) + char *plaintext; +@@ -105,7 +105,7 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, + + pw_pass = get_passwd(pw, buffer); + if (!pw_pass[0]) /* empty password field? */ +- return 1; ++ return allow_blank; + + plaintext = bb_ask(STDIN_FILENO, timeout, prompt); + if (!plaintext) { +@@ -120,5 +120,5 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, + + int FAST_FUNC ask_and_check_password(const struct passwd *pw) + { +- return ask_and_check_password_extended(pw, 0, "Password: "); ++ return ask_and_check_password_extended(pw, 0, 1, "Password: "); + } +diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c +index f324695..b26db96 100644 +--- a/loginutils/sulogin.c ++++ b/loginutils/sulogin.c +@@ -63,7 +63,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv) + while (1) { + int r; + +- r = ask_and_check_password_extended(pwd, timeout, ++ r = ask_and_check_password_extended(pwd, timeout, 1, + "Give root password for system maintenance\n" + "(or type Control-D for normal startup):" + ); +-- +2.9.1 + diff --git a/main/busybox/0010-su-FEATURE_SU_NULLOK_SECURE.patch b/main/busybox/0010-su-FEATURE_SU_NULLOK_SECURE.patch new file mode 100644 index 00000000000..5f67bbbed10 --- /dev/null +++ b/main/busybox/0010-su-FEATURE_SU_NULLOK_SECURE.patch @@ -0,0 +1,71 @@ +From fea67b57ed920fafe595affb2954111c2bb67054 Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen +Date: Thu, 5 Nov 2015 16:27:36 +0200 +Subject: [PATCH 10/15] su: FEATURE_SU_NULLOK_SECURE + +When this feature is enabled, blank passwords are not accepted by su +unless the user is on a secure TTY defined in /etc/securetty. This +resembles the default PAM configuration of some Linux distros which +specify the nullok_secure option for pam_unix.so. +--- + loginutils/su.c | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/loginutils/su.c b/loginutils/su.c +index 3c0e8c1..bdcc6a9 100644 +--- a/loginutils/su.c ++++ b/loginutils/su.c +@@ -24,6 +24,11 @@ + //config: bool "Enable su to check user's shell to be listed in /etc/shells" + //config: depends on SU + //config: default y ++//config:config FEATURE_SU_NULLOK_SECURE ++//config: bool "Disallow blank passwords from TTYs other than specified in /etc/securetty" ++//config: depends on SU ++//config: default n ++ + + //applet:/* Needs to be run by root or be suid root - needs to change uid and gid: */ + //applet:IF_SU(APPLET(su, BB_DIR_BIN, BB_SUID_REQUIRE)) +@@ -76,6 +81,7 @@ int su_main(int argc UNUSED_PARAM, char **argv) + struct passwd *pw; + uid_t cur_uid = getuid(); + const char *tty; ++ int allow_blank = 1; + #if ENABLE_FEATURE_UTMP + char user_buf[64]; + #endif +@@ -96,6 +102,12 @@ int su_main(int argc UNUSED_PARAM, char **argv) + argv++; + } + ++ tty = xmalloc_ttyname(STDIN_FILENO); ++ if (!tty) tty = "none"; ++ tty = skip_dev_pfx(tty); ++ ++ if (ENABLE_FEATURE_SU_NULLOK_SECURE) allow_blank = check_securetty(tty); ++ + if (ENABLE_FEATURE_SU_SYSLOG) { + /* The utmp entry (via getlogin) is probably the best way to + * identify the user, especially if someone su's from a su-shell. +@@ -109,16 +121,12 @@ int su_main(int argc UNUSED_PARAM, char **argv) + pw = getpwuid(cur_uid); + old_user = pw ? xstrdup(pw->pw_name) : ""; + } +- tty = xmalloc_ttyname(2); +- if (!tty) { +- tty = "none"; +- } + openlog(applet_name, 0, LOG_AUTH); + } + + pw = xgetpwnam(opt_username); + +- if (cur_uid == 0 || ask_and_check_password(pw) > 0) { ++ if (cur_uid == 0 || ask_and_check_password_extended(pw, 0, allow_blank, "Password: ") > 0) { + if (ENABLE_FEATURE_SU_SYSLOG) + syslog(LOG_NOTICE, "%c %s %s:%s", + '+', tty, old_user, opt_username); +-- +2.9.1 + diff --git a/main/busybox/0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch b/main/busybox/0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch new file mode 100644 index 00000000000..1491616321e --- /dev/null +++ b/main/busybox/0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch @@ -0,0 +1,73 @@ +From f284457f4400ee31469a6fde1468088fc1858eb0 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 23 Jun 2016 10:42:40 +0200 +Subject: [PATCH 11/15] df: use f_frsize instead of f_bsize for correct sizes + +Use the correct field f_frsize instead of f_bsize. + +The statfs f_bsize is the "Optimal transfer block size" while the +f_frsize is the "Fragment size (since Linux 2.6)". On some FUSE +filesystems those may differ. + +Fixes bug 9046 + +URL: https://bugs.busybox.net/show_bug.cgi?id=9046 + +Signed-off-by: Natanael Copa +Signed-off-by: Denys Vlasenko +--- + coreutils/df.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/coreutils/df.c b/coreutils/df.c +index d79c11a..06b2920 100644 +--- a/coreutils/df.c ++++ b/coreutils/df.c +@@ -188,7 +188,7 @@ int df_main(int argc UNUSED_PARAM, char **argv) + if (opt & OPT_INODE) { + s.f_blocks = s.f_files; + s.f_bavail = s.f_bfree = s.f_ffree; +- s.f_bsize = 1; ++ s.f_frsize = 1; + + if (df_disp_hr) + df_disp_hr = 1; +@@ -246,26 +246,26 @@ int df_main(int argc UNUSED_PARAM, char **argv) + + #if ENABLE_FEATURE_HUMAN_READABLE + printf(" %9s ", +- /* f_blocks x f_bsize / df_disp_hr, show one fractional, ++ /* f_blocks x f_frsize / df_disp_hr, show one fractional, + * use suffixes if df_disp_hr == 0 */ +- make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr)); ++ make_human_readable_str(s.f_blocks, s.f_frsize, df_disp_hr)); + + printf(" %9s " + 1, +- /* EXPR x f_bsize / df_disp_hr, show one fractional, ++ /* EXPR x f_frsize / df_disp_hr, show one fractional, + * use suffixes if df_disp_hr == 0 */ + make_human_readable_str((s.f_blocks - s.f_bfree), +- s.f_bsize, df_disp_hr)); ++ s.f_frsize, df_disp_hr)); + + printf("%9s %3u%% %s\n", +- /* f_bavail x f_bsize / df_disp_hr, show one fractional, ++ /* f_bavail x f_frsize / df_disp_hr, show one fractional, + * use suffixes if df_disp_hr == 0 */ +- make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr), ++ make_human_readable_str(s.f_bavail, s.f_frsize, df_disp_hr), + blocks_percent_used, mount_point); + #else + printf(" %9lu %9lu %9lu %3u%% %s\n", +- kscale(s.f_blocks, s.f_bsize), +- kscale(s.f_blocks - s.f_bfree, s.f_bsize), +- kscale(s.f_bavail, s.f_bsize), ++ kscale(s.f_blocks, s.f_frsize), ++ kscale(s.f_blocks - s.f_bfree, s.f_frsize), ++ kscale(s.f_bavail, s.f_frsize), + blocks_percent_used, mount_point); + #endif + } +-- +2.9.1 + diff --git a/main/busybox/0012-gzip-fix-compression-level-bug.-Closes-9131.patch b/main/busybox/0012-gzip-fix-compression-level-bug.-Closes-9131.patch new file mode 100644 index 00000000000..48187240284 --- /dev/null +++ b/main/busybox/0012-gzip-fix-compression-level-bug.-Closes-9131.patch @@ -0,0 +1,41 @@ +From 900a96dee4932db22dbb7ab12a5fc6f2108b01b7 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 3 Aug 2016 13:23:57 +0200 +Subject: [PATCH 12/15] gzip: fix compression level bug. Closes 9131 + +fix broken logic to get the gzip_level_config value from options -1 to +-9. + +This fixes an off-by-one bug that caused gzip -9 output bigger files +than the other compression levels. + +It fixes so that compression level 1 to 3 are actually mapped to level 4 +as comments say. + +It also fixes that levels -4 to -9 is mapped to correct level and avoids +out-of-bounds access. + +Signed-off-by: Natanael Copa +--- + archival/gzip.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/archival/gzip.c b/archival/gzip.c +index 8f1e4ff..15ba57c 100644 +--- a/archival/gzip.c ++++ b/archival/gzip.c +@@ -2220,10 +2220,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv) + opt >>= ENABLE_GUNZIP ? 7 : 5; /* drop cfv[dt]qn bits */ + if (opt == 0) + opt = 1 << 6; /* default: 6 */ +- /* Map 1..3 to 4 */ +- if (opt & 0x7) +- opt |= 1 << 4; +- opt = ffs(opt >> 3); ++ opt = ffs(opt >> 4); /* Maps 1..3 to 4 */ + max_chain_length = 1 << gzip_level_config[opt].chain_shift; + good_match = gzip_level_config[opt].good; + max_lazy_match = gzip_level_config[opt].lazy2 * 2; +-- +2.9.1 + diff --git a/main/busybox/0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch b/main/busybox/0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch new file mode 100644 index 00000000000..5454815680f --- /dev/null +++ b/main/busybox/0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch @@ -0,0 +1,197 @@ +From 678563e106ce8416266de16c309494a051f331f6 Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen +Date: Thu, 4 Aug 2016 12:26:56 +0200 +Subject: [PATCH 13/15] ntpd: postpone hostname resolution if fails on startup + +Signed-off-by: Kaarle Ritvanen +--- + networking/ntpd.c | 129 ++++++++++++++++++++++++++---------------------------- + 1 file changed, 63 insertions(+), 66 deletions(-) + +diff --git a/networking/ntpd.c b/networking/ntpd.c +index 98158a3..7f7d69e 100644 +--- a/networking/ntpd.c ++++ b/networking/ntpd.c +@@ -267,6 +267,7 @@ typedef struct { + + typedef struct { + len_and_sockaddr *p_lsa; ++ char *p_hostname; + char *p_dotted; + int p_fd; + int datapoint_idx; +@@ -292,7 +293,6 @@ typedef struct { + datapoint_t filter_datapoint[NUM_DATAPOINTS]; + /* last sent packet: */ + msg_t p_xmt_msg; +- char p_hostname[1]; + } peer_t; + + +@@ -765,27 +765,17 @@ reset_peer_stats(peer_t *p, double offset) + } + + static void +-resolve_peer_hostname(peer_t *p, int loop_on_fail) +-{ +- len_and_sockaddr *lsa; +- +- again: +- lsa = host2sockaddr(p->p_hostname, 123); +- if (!lsa) { +- /* error message already emitted by host2sockaddr() */ +- if (!loop_on_fail) +- return; +-//FIXME: do this to avoid infinite looping on typo in a hostname? +-//well... in which case, what is a good value for loop_on_fail? +- //if (--loop_on_fail == 0) +- // xfunc_die(); +- sleep(5); +- goto again; ++resolve_peer_hostname(peer_t *p) { ++ len_and_sockaddr *lsa = host2sockaddr(p->p_hostname, 123); ++ if (lsa) { ++ if (p->p_lsa) { ++ free(p->p_lsa); ++ free(p->p_dotted); ++ } ++ p->p_lsa = lsa; ++ p->p_dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); + } +- free(p->p_lsa); +- free(p->p_dotted); +- p->p_lsa = lsa; +- p->p_dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); ++ set_next(p, lsa ? 0 : RETRY_INTERVAL); + } + + static void +@@ -794,28 +784,29 @@ add_peers(const char *s) + llist_t *item; + peer_t *p; + +- p = xzalloc(sizeof(*p) + strlen(s)); +- strcpy(p->p_hostname, s); +- resolve_peer_hostname(p, /*loop_on_fail=*/ 1); ++ p = xzalloc(sizeof(*p)); ++ p->p_hostname = xstrdup(s); ++ resolve_peer_hostname(p); + + /* Names like N..pool.ntp.org are randomly resolved + * to a pool of machines. Sometimes different N's resolve to the same IP. + * It is not useful to have two peers with same IP. We skip duplicates. + */ +- for (item = G.ntp_peers; item != NULL; item = item->link) { +- peer_t *pp = (peer_t *) item->data; +- if (strcmp(p->p_dotted, pp->p_dotted) == 0) { +- bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted); +- free(p->p_lsa); +- free(p->p_dotted); +- free(p); +- return; ++ if (p->p_lsa) ++ for (item = G.ntp_peers; item != NULL; item = item->link) { ++ peer_t *pp = (peer_t *) item->data; ++ if (pp->p_lsa && strcmp(p->p_dotted, pp->p_dotted) == 0) { ++ bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted); ++ free(p->p_hostname); ++ free(p->p_lsa); ++ free(p->p_dotted); ++ free(p); ++ return; ++ } + } +- } + + p->p_fd = -1; + p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3); +- p->next_action_time = G.cur_time; /* = set_next(p, 0); */ + reset_peer_stats(p, STEP_THRESHOLD); + + llist_add_to(&G.ntp_peers, p); +@@ -2340,44 +2331,50 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) + for (item = G.ntp_peers; item != NULL; item = item->link) { + peer_t *p = (peer_t *) item->data; + +- if (p->next_action_time <= G.cur_time) { +- if (p->p_fd == -1) { +- /* Time to send new req */ +- if (--cnt == 0) { +- VERB4 bb_error_msg("disabling burst mode"); +- G.polladj_count = 0; +- G.poll_exp = MINPOLL; ++ if (p->p_lsa) { ++ ++ if (p->next_action_time <= G.cur_time) { ++ if (p->p_fd == -1) { ++ /* Time to send new req */ ++ if (--cnt == 0) { ++ VERB4 bb_error_msg("disabling burst mode"); ++ G.polladj_count = 0; ++ G.poll_exp = MINPOLL; ++ } ++ send_query_to_peer(p); ++ } else { ++ /* Timed out waiting for reply */ ++ close(p->p_fd); ++ p->p_fd = -1; ++ /* If poll interval is small, increase it */ ++ if (G.poll_exp < BIGPOLL) ++ adjust_poll(MINPOLL); ++ timeout = poll_interval(NOREPLY_INTERVAL); ++ bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us", ++ p->p_dotted, p->reachable_bits, timeout); ++ ++ /* What if don't see it because it changed its IP? */ ++ if (p->reachable_bits == 0) ++ resolve_peer_hostname(p); ++ ++ set_next(p, timeout); + } +- send_query_to_peer(p); +- } else { +- /* Timed out waiting for reply */ +- close(p->p_fd); +- p->p_fd = -1; +- /* If poll interval is small, increase it */ +- if (G.poll_exp < BIGPOLL) +- adjust_poll(MINPOLL); +- timeout = poll_interval(NOREPLY_INTERVAL); +- bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us", +- p->p_dotted, p->reachable_bits, timeout); +- +- /* What if don't see it because it changed its IP? */ +- if (p->reachable_bits == 0) +- resolve_peer_hostname(p, /*loop_on_fail=*/ 0); +- +- set_next(p, timeout); + } +- } ++ ++ if (p->p_fd >= 0) { ++ /* Wait for reply from this peer */ ++ pfd[i].fd = p->p_fd; ++ pfd[i].events = POLLIN; ++ idx2peer[i] = p; ++ i++; ++ } ++ ++ } else ++ resolve_peer_hostname(p); + + if (p->next_action_time < nextaction) + nextaction = p->next_action_time; + +- if (p->p_fd >= 0) { +- /* Wait for reply from this peer */ +- pfd[i].fd = p->p_fd; +- pfd[i].events = POLLIN; +- idx2peer[i] = p; +- i++; +- } + } + + timeout = nextaction - G.cur_time; +-- +2.9.1 + diff --git a/main/busybox/0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch b/main/busybox/0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch new file mode 100644 index 00000000000..24dc0e890c3 --- /dev/null +++ b/main/busybox/0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch @@ -0,0 +1,41 @@ +From c87fd50857e07450e8868730293f2af7063d263a Mon Sep 17 00:00:00 2001 +From: Miroslav Lichvar +Date: Mon, 1 Aug 2016 20:24:24 +0200 +Subject: [PATCH 14/15] ntpd: respond only to client and symmetric active + packets + +The busybox NTP implementation doesn't check the NTP mode of packets +received on the server port and responds to any packet with the right +size. This includes responses from another NTP server. An attacker can +send a packet with a spoofed source address in order to create an +infinite loop of responses between two busybox NTP servers. Adding +more packets to the loop increases the traffic between the servers +until one of them has a fully loaded CPU and/or network. + +Signed-off-by: Miroslav Lichvar +Signed-off-by: Denys Vlasenko +--- + networking/ntpd.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/networking/ntpd.c b/networking/ntpd.c +index 7f7d69e..182dd58 100644 +--- a/networking/ntpd.c ++++ b/networking/ntpd.c +@@ -2042,6 +2042,13 @@ recv_and_process_client_pkt(void /*int fd*/) + goto bail; + } + ++ /* Respond only to client and symmetric active packets */ ++ if ((msg.m_status & MODE_MASK) != MODE_CLIENT ++ && (msg.m_status & MODE_MASK) != MODE_SYM_ACT ++ ) { ++ goto bail; ++ } ++ + query_status = msg.m_status; + query_xmttime = msg.m_xmttime; + +-- +2.9.1 + diff --git a/main/busybox/0015-diff-add-support-for-no-dereference.patch b/main/busybox/0015-diff-add-support-for-no-dereference.patch new file mode 100644 index 00000000000..22b088ef705 --- /dev/null +++ b/main/busybox/0015-diff-add-support-for-no-dereference.patch @@ -0,0 +1,63 @@ +From 2a6b675f7bdf6eaf512620c43980abe91a20de28 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Fri, 25 Jul 2014 15:28:33 +0200 +Subject: [PATCH 15/15] diff: add support for --no-dereference + +Add flag for not following symlinks when recursing + +function old new delta +.rodata 7934 7967 +33 +diff_longopts 253 270 +17 +packed_usage 1704 1720 +16 +diff_main 1665 1662 -3 +------------------------------------------------------------------------------ +(add/remove: 0/0 grow/shrink: 3/1 up/down: 66/-3) Total: 63 bytes + +Signed-off-by: Natanael Copa +--- + editors/diff.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/editors/diff.c b/editors/diff.c +index ff26936..585b7f6 100644 +--- a/editors/diff.c ++++ b/editors/diff.c +@@ -117,6 +117,9 @@ + //usage: "\n -N Treat absent files as empty" + //usage: "\n -q Output only whether files differ" + //usage: "\n -r Recurse" ++//usage: IF_LONG_OPTS( ++//usage: "\n --no-dereference Don't follow symlinks" ++//usage: ) + //usage: "\n -S Start with FILE when comparing directories" + //usage: "\n -T Make tabs line up by prefixing a tab when necessary" + //usage: "\n -s Report when two files are the same" +@@ -158,6 +161,7 @@ enum { /* Commandline flags */ + FLAG_p, /* not implemented */ + FLAG_B, + FLAG_E, /* not implemented */ ++ FLAG_no_deref, + }; + #define FLAG(x) (1 << FLAG_##x) + +@@ -872,7 +876,8 @@ static void diffdir(char *p[2], const char *s_start) + * Using list.len to specify its length, + * add_to_dirlist will remove it. */ + list[i].len = strlen(p[i]); +- recursive_action(p[i], ACTION_RECURSE | ACTION_FOLLOWLINKS, ++ recursive_action(p[i], ACTION_RECURSE | ++ ((option_mask32 & FLAG(no_deref)) ? 0 : ACTION_FOLLOWLINKS), + add_to_dirlist, skip_dir, &list[i], 0); + /* Sort dl alphabetically. + * GNU diff does this ignoring any number of trailing dots. +@@ -969,6 +974,7 @@ static const char diff_longopts[] ALIGN1 = + "report-identical-files\0" No_argument "s" + "starting-file\0" Required_argument "S" + "minimal\0" No_argument "d" ++ "no-dereference\0" No_argument "\xff" + ; + #endif + +-- +2.9.1 + diff --git a/main/busybox/1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch b/main/busybox/1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch deleted file mode 100644 index ddfeb7f967a..00000000000 --- a/main/busybox/1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 7f70f194ae135bd1e856c2dc811b8fa4a56296ea Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Thu, 20 Sep 2012 09:41:56 +0300 -Subject: [PATCH] fbsplash: use virtual y size in mmap size calculations -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The virtual y can be larger - and we can be even writing there since -we are taking into account the y offset. Avoids possible crash. - -Signed-off-by: Timo Teräs ---- - miscutils/fbsplash.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c -index 7b695b2..58e491d 100644 ---- a/miscutils/fbsplash.c -+++ b/miscutils/fbsplash.c -@@ -150,7 +150,7 @@ static void fb_open(const char *strfb_device) - - // map the device in memory - G.addr = mmap(NULL, -- G.scr_var.yres * G.scr_fix.line_length, -+ G.scr_var.yres_virtual * G.scr_fix.line_length, - PROT_WRITE, MAP_SHARED, fbfd, 0); - if (G.addr == MAP_FAILED) - bb_perror_msg_and_die("mmap"); --- -2.1.3 - diff --git a/main/busybox/1001-fbsplash-support-console-switching.patch b/main/busybox/1001-fbsplash-support-console-switching.patch deleted file mode 100644 index 2c88e2d78f1..00000000000 --- a/main/busybox/1001-fbsplash-support-console-switching.patch +++ /dev/null @@ -1,186 +0,0 @@ -From 78e0c5d3ec8354b94e5d7bd978222651dbb2c8c0 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Mon, 24 Sep 2012 07:58:29 +0300 -Subject: [PATCH] fbsplash: support console switching -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Timo Teräs ---- - miscutils/fbsplash.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 76 insertions(+), 7 deletions(-) - -diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c -index 58e491d..8599f78 100644 ---- a/miscutils/fbsplash.c -+++ b/miscutils/fbsplash.c -@@ -22,7 +22,7 @@ - */ - - //usage:#define fbsplash_trivial_usage --//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" -+//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD] [-T tty]" - //usage:#define fbsplash_full_usage "\n\n" - //usage: " -s Image" - //usage: "\n -c Hide cursor" -@@ -32,10 +32,16 @@ - //usage: "\n BAR_R,BAR_G,BAR_B" - //usage: "\n -f Control pipe (else exit after drawing image)" - //usage: "\n commands: 'NN' (% for progress bar) or 'exit'" -+//usage: "\n -T Switch to TTY to hide all console messages" - - #include "libbb.h" - #include - -+#include -+#include -+#include -+#include -+ - /* If you want logging messages on /tmp/fbsplash.log... */ - #define DEBUG 0 - -@@ -47,6 +53,8 @@ struct globals { - unsigned char *addr; // pointer to framebuffer memory - unsigned ns[7]; // n-parameters - const char *image_filename; -+ int silent_tty, fd_tty_s; -+ bool do_not_draw; - struct fb_var_screeninfo scr_var; - struct fb_fix_screeninfo scr_fix; - unsigned bytes_per_pixel; -@@ -455,6 +463,11 @@ static void init(const char *cfg_filename) - config_close(parser); - } - -+static void sighandler(int sig) -+{ -+ ioctl(G.fd_tty_s, VT_RELDISP, sig == SIGUSR1 ? 1 : 2); -+ G.do_not_draw = (sig != SIGUSR2); -+} - - int fbsplash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; - int fbsplash_main(int argc UNUSED_PARAM, char **argv) -@@ -464,6 +477,9 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - char *num_buf; - unsigned num; - bool bCursorOff; -+ int fd_tty0, active_vt; -+ struct vt_stat vtstat; -+ struct vt_mode vt; - - INIT_G(); - -@@ -471,8 +487,10 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - fb_device = "/dev/fb0"; - cfg_filename = NULL; - fifo_filename = NULL; -- bCursorOff = 1 & getopt32(argv, "cs:d:i:f:", -- &G.image_filename, &fb_device, &cfg_filename, &fifo_filename); -+ opt_complementary = "T+"; // numeric params -+ bCursorOff = 1 & getopt32(argv, "cs:d:i:f:T:", -+ &G.image_filename, &fb_device, &cfg_filename, &fifo_filename, -+ &G.silent_tty); - - // parse configuration file - if (cfg_filename) -@@ -482,11 +500,43 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - if (!G.image_filename) - bb_show_usage(); - -+ fd_tty0 = get_console_fd_or_die(); -+ if (G.silent_tty) { -+ char buf[16]; -+ -+ /* Initialize TTY */ -+ bb_signals((1LL << SIGUSR1) | (1LL << SIGUSR2), sighandler); -+ snprintf(buf, sizeof(buf), "/dev/tty%d", G.silent_tty); -+ G.fd_tty_s = xopen(buf, O_RDWR | O_NOCTTY); -+ -+ /* Activate TTY */ -+ xioctl(fd_tty0, VT_GETSTATE, &vtstat); -+ active_vt = vtstat.v_active; -+ console_make_active(fd_tty0, G.silent_tty); -+ -+ /* Get notifications on console changes */ -+ vt.mode = VT_PROCESS; -+ vt.waitv = 0; -+ vt.relsig = SIGUSR1; -+ vt.acqsig = SIGUSR2; -+ ioctl(G.fd_tty_s, VT_SETMODE, &vt); -+ -+ /* Redirect all kernel messages to tty1 so that they don't get -+ * printed over our silent splash image. And clear it. */ -+ buf[0] = TIOCL_SETKMSGREDIRECT; -+ buf[1] = 1; -+ ioctl(G.fd_tty_s, TIOCLINUX, buf); -+ full_write(G.fd_tty_s, "\e[H\e[2J" "\e[?17;0c", 7+8); -+ ioctl(G.fd_tty_s, KDSETMODE, KD_GRAPHICS); -+ } else { -+ G.fd_tty_s = STDOUT_FILENO; -+ } -+ - fb_open(fb_device); - - if (fifo_filename && bCursorOff) { - // hide cursor (BEFORE any fb ops) -- full_write(STDOUT_FILENO, "\033[?25l", 6); -+ full_write(G.fd_tty_s, "\033[?25l", 6); - } - - fb_drawimage(); -@@ -494,6 +544,7 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - if (!fifo_filename) - return EXIT_SUCCESS; - -+ sig_block(SIGUSR1); - fp = xfopen_stdin(fifo_filename); - if (fp != stdin) { - // For named pipes, we want to support this: -@@ -509,8 +560,9 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - // and become an additional writer :) - open(fifo_filename, O_WRONLY); // errors are ignored - } -- - fb_drawprogressbar(0); -+ sig_unblock(SIGUSR1); -+ - // Block on read, waiting for some input. - // Use of style I/O allows to correctly - // handle a case when we have many buffered lines -@@ -525,12 +577,29 @@ int fbsplash_main(int argc UNUSED_PARAM, char **argv) - #if DEBUG - DEBUG_MESSAGE(itoa(num)); - #endif -- fb_drawprogressbar(num); -+ sig_block(SIGUSR1); -+ if (!G.do_not_draw) -+ fb_drawprogressbar(num); -+ sig_unblock(SIGUSR1); - } - free(num_buf); - } - -- if (bCursorOff) // restore cursor -+ if (G.silent_tty) { -+ usleep(100*1000); -+ -+ ioctl(G.fd_tty_s, VT_RELDISP, 1); -+ ioctl(G.fd_tty_s, KDSETMODE, KD_TEXT); -+ vt.mode = VT_AUTO; -+ vt.waitv = 0; -+ ioctl(G.fd_tty_s, VT_SETMODE, &vt); -+ close(G.fd_tty_s); -+ -+ xioctl(fd_tty0, VT_GETSTATE, &vtstat); -+ if (vtstat.v_active == G.silent_tty) -+ console_make_active(fd_tty0, active_vt); -+ ioctl(fd_tty0, VT_DISALLOCATE, (void *)(ptrdiff_t)G.silent_tty); -+ } else if (bCursorOff) // restore cursor - full_write(STDOUT_FILENO, "\033[?25h", 6); - - return EXIT_SUCCESS; --- -2.1.3 - diff --git a/main/busybox/1002-fbsplash-support-image-and-bar-alignment-and-positio.patch b/main/busybox/1002-fbsplash-support-image-and-bar-alignment-and-positio.patch deleted file mode 100644 index 2ed0fa050da..00000000000 --- a/main/busybox/1002-fbsplash-support-image-and-bar-alignment-and-positio.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 99d9c9a46b47190f1d2f061ba11c767b4089cf0a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Fri, 21 Nov 2014 16:06:34 +0200 -Subject: [PATCH] fbsplash: support image and bar alignment and positioning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Timo Teräs ---- - miscutils/fbsplash.c | 91 +++++++++++++++++++++++++++++++++++++++++++--------- - 1 file changed, 76 insertions(+), 15 deletions(-) - -diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c -index 8599f78..660fddd 100644 ---- a/miscutils/fbsplash.c -+++ b/miscutils/fbsplash.c -@@ -28,6 +28,7 @@ - //usage: "\n -c Hide cursor" - //usage: "\n -d Framebuffer device (default /dev/fb0)" - //usage: "\n -i Config file (var=value):" -+//usage: "\n IMAGE_ALIGN" - //usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" - //usage: "\n BAR_R,BAR_G,BAR_B" - //usage: "\n -f Control pipe (else exit after drawing image)" -@@ -45,13 +46,38 @@ - /* If you want logging messages on /tmp/fbsplash.log... */ - #define DEBUG 0 - -+enum { -+ image_align, -+ -+ image_posx, -+ image_posy, -+ bar_width, -+ bar_height, -+ bar_posx, -+ bar_posy, -+ bar_colr, -+ bar_colg, -+ bar_colb, -+ -+ debug -+}; -+ -+#define nimage_align ns[image_align] -+#define nbar_width ns[bar_width] -+#define nbar_height ns[bar_height] -+#define nbar_posx ns[bar_posx] -+#define nbar_posy ns[bar_posy] -+#define nbar_colr ns[bar_colr] -+#define nbar_colg ns[bar_colg] -+#define nbar_colb ns[bar_colb] -+ - struct globals { - #if DEBUG - bool bdebug_messages; // enable/disable logging - FILE *logfile_fd; // log file - #endif - unsigned char *addr; // pointer to framebuffer memory -- unsigned ns[7]; // n-parameters -+ unsigned ns[debug+1]; // n-parameters - const char *image_filename; - int silent_tty, fd_tty_s; - bool do_not_draw; -@@ -68,14 +94,6 @@ struct globals { - SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ - } while (0) - --#define nbar_width ns[0] // progress bar width --#define nbar_height ns[1] // progress bar height --#define nbar_posx ns[2] // progress bar horizontal position --#define nbar_posy ns[3] // progress bar vertical position --#define nbar_colr ns[4] // progress bar color red component --#define nbar_colg ns[5] // progress bar color green component --#define nbar_colb ns[6] // progress bar color blue component -- - #if DEBUG - #define DEBUG_MESSAGE(strMessage, args...) \ - if (G.bdebug_messages) { \ -@@ -356,7 +374,7 @@ static void fb_drawimage(void) - FILE *theme_file; - char *read_ptr; - unsigned char *pixline; -- unsigned i, j, width, height, line_size; -+ int i, j, width, height, line_size, xoffs, yoffs, xstart; - - if (LONE_DASH(G.image_filename)) { - theme_file = stdin; -@@ -404,18 +422,46 @@ static void fb_drawimage(void) - line_size = width*3; - pixline = xmalloc(line_size); - -+#if 0 - if (width > G.scr_var.xres) - width = G.scr_var.xres; - if (height > G.scr_var.yres) - height = G.scr_var.yres; -- for (j = 0; j < height; j++) { -+#endif -+ -+ xoffs = yoffs = 0; -+ switch (G.nimage_align % 3) { -+ case 1: xoffs = (G.scr_var.xres - width) / 2; break; -+ case 2: xoffs = G.scr_var.xres - width; break; -+ } -+ xstart = 0; -+ if (xoffs < 0) { -+ xstart = -xoffs; -+ width -= xstart; -+ xoffs = 0; -+ } -+ xoffs *= G.bytes_per_pixel; -+ if (width > G.scr_var.xres) -+ width = G.scr_var.xres; -+ -+ switch (G.nimage_align / 3) { -+ case 1: yoffs = (G.scr_var.yres - height) / 2; break; -+ case 2: yoffs = G.scr_var.yres - height; break; -+ } -+ -+ for (j = 0; j < height && yoffs < G.scr_var.yres; j++, yoffs++) { - unsigned char *pixel; - unsigned char *src; - - if (fread(pixline, 1, line_size, theme_file) != line_size) - bb_error_msg_and_die("bad PPM file '%s'", G.image_filename); -+ -+ if (yoffs < 0) -+ continue; -+ - pixel = pixline; -- src = G.addr + j * G.scr_fix.line_length; -+ src = G.addr + yoffs * G.scr_fix.line_length + xoffs; -+ - for (i = 0; i < width; i++) { - unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]); - fb_write_pixel(src, thispix); -@@ -434,9 +480,17 @@ static void fb_drawimage(void) - */ - static void init(const char *cfg_filename) - { -+ static const char align_names[] ALIGN1 = -+ "LT\0" "CT\0" "RT\0" -+ "LM\0" "CM\0" "RM\0" -+ "LB\0" "CB\0" "RB\0"; - static const char param_names[] ALIGN1 = -+ "IMAGE_ALIGN\0" -+ -+ "IMAGE_X\0" "IMAGE_Y\0" - "BAR_WIDTH\0" "BAR_HEIGHT\0" - "BAR_LEFT\0" "BAR_TOP\0" -+ - "BAR_R\0" "BAR_G\0" "BAR_B\0" - #if DEBUG - "DEBUG\0" -@@ -446,14 +500,21 @@ static void init(const char *cfg_filename) - parser_t *parser = config_open2(cfg_filename, xfopen_stdin); - while (config_read(parser, token, 2, 2, "#=", - (PARSE_NORMAL | PARSE_MIN_DIE) & ~(PARSE_TRIM | PARSE_COLLAPSE))) { -- unsigned val = xatoi_positive(token[1]); -+ unsigned val; - int i = index_in_strings(param_names, token[0]); -+ - if (i < 0) - bb_error_msg_and_die("syntax error: %s", token[0]); -- if (i >= 0 && i < 7) -+ -+ if (i <= image_align) -+ val = index_in_strings(align_names, token[1]); -+ else -+ val = xatoi_positive(token[1]); -+ -+ if (i < debug) - G.ns[i] = val; - #if DEBUG -- if (i == 7) { -+ if (i == debug) { - G.bdebug_messages = val; - if (G.bdebug_messages) - G.logfile_fd = xfopen_for_write("/tmp/fbsplash.log"); --- -2.1.3 - diff --git a/main/busybox/2001-modutils-merge-module_entry-and-module_info-to-commo.patch b/main/busybox/2001-modutils-merge-module_entry-and-module_info-to-commo.patch deleted file mode 100644 index d0ad5f852d2..00000000000 --- a/main/busybox/2001-modutils-merge-module_entry-and-module_info-to-commo.patch +++ /dev/null @@ -1,445 +0,0 @@ -From e20b230f09522423c6f752d0d6914922fa0f8533 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Sun, 25 Oct 2015 22:21:40 +0200 -Subject: [PATCH 2001/2003] modutils: merge module_entry and module_info to - common code -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This merges the in-memory module info structures of modprobe -and depmod. This allows sharing hashing by modulename code -improving depmod runtime with almost factor of 2x. - -Signed-off-by: Timo Teräs ---- - modutils/depmod.c | 99 +++++++++++++++++++---------------------------------- - modutils/modprobe.c | 66 ++++------------------------------- - modutils/modutils.c | 43 +++++++++++++++++++++++ - modutils/modutils.h | 29 ++++++++++++++++ - 4 files changed, 114 insertions(+), 123 deletions(-) - -diff --git a/modutils/depmod.c b/modutils/depmod.c -index 9713aef..b8699ba 100644 ---- a/modutils/depmod.c -+++ b/modutils/depmod.c -@@ -14,6 +14,14 @@ - #include "modutils.h" - #include /* uname() */ - -+struct globals { -+ module_db db; -+} FIX_ALIASING; -+#define G (*ptr_to_globals) -+#define INIT_G() do { \ -+ SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ -+} while (0) -+ - /* - * Theory of operation: - * - iterate over all modules and record their full path -@@ -21,21 +29,12 @@ - * for each depends, look through our list of full paths and emit if found - */ - --typedef struct module_info { -- struct module_info *next; -- char *name, *modname; -- llist_t *dependencies; -- llist_t *aliases; -- llist_t *symbols; -- struct module_info *dnext, *dprev; --} module_info; -- - static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARAM, -- void *data, int depth UNUSED_PARAM) -+ void *data UNUSED_PARAM, int depth UNUSED_PARAM) - { -- module_info **first = (module_info **) data; - char *image, *ptr; -- module_info *info; -+ module_entry *e; -+ - /* Arbitrary. Was sb->st_size, but that breaks .gz etc */ - size_t len = (64*1024*1024 - 4096); - -@@ -43,17 +42,10 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA - return TRUE; - - image = xmalloc_open_zipped_read_close(fname, &len); -- info = xzalloc(sizeof(*info)); - -- info->next = *first; -- *first = info; -+ e = moddb_get(&G.db, bb_get_last_path_component_nostrip(fname), 1); -+ e->name = xstrdup(fname + 2); /* skip "./" */ - -- info->dnext = info->dprev = info; -- info->name = xstrdup(fname + 2); /* skip "./" */ -- info->modname = filename2modname( -- bb_get_last_path_component_nostrip(fname), -- NULL -- ); - for (ptr = image; ptr < image + len - 10; ptr++) { - if (is_prefixed_with(ptr, "depends=")) { - char *u; -@@ -62,11 +54,11 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA - for (u = ptr; *u; u++) - if (*u == '-') - *u = '_'; -- ptr += string_to_llist(ptr, &info->dependencies, ","); -+ ptr += string_to_llist(ptr, &e->deps, ","); - } else if (ENABLE_FEATURE_MODUTILS_ALIAS - && is_prefixed_with(ptr, "alias=") - ) { -- llist_add_to(&info->aliases, xstrdup(ptr + 6)); -+ llist_add_to(&e->aliases, xstrdup(ptr + 6)); - ptr += strlen(ptr); - } else if (ENABLE_FEATURE_MODUTILS_SYMBOLS - && is_prefixed_with(ptr, "__ksymtab_") -@@ -77,7 +69,7 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA - ) { - continue; - } -- llist_add_to(&info->symbols, xstrdup(ptr)); -+ llist_add_to(&e->symbols, xstrdup(ptr)); - ptr += strlen(ptr); - } - } -@@ -86,24 +78,13 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA - return TRUE; - } - --static module_info *find_module(module_info *modules, const char *modname) --{ -- module_info *m; -- -- for (m = modules; m != NULL; m = m->next) -- if (strcmp(m->modname, modname) == 0) -- return m; -- return NULL; --} -- --static void order_dep_list(module_info *modules, module_info *start, -- llist_t *add) -+static void order_dep_list(module_entry *start, llist_t *add) - { -- module_info *m; -+ module_entry *m; - llist_t *n; - - for (n = add; n != NULL; n = n->link) { -- m = find_module(modules, n->data); -+ m = moddb_get(&G.db, n->data, 0); - if (m == NULL) - continue; - -@@ -118,7 +99,7 @@ static void order_dep_list(module_info *modules, module_info *start, - start->dprev = m; - - /* recurse */ -- order_dep_list(modules, start, m->dependencies); -+ order_dep_list(start, m->deps); - } - } - -@@ -184,12 +165,15 @@ enum { - int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; - int depmod_main(int argc UNUSED_PARAM, char **argv) - { -- module_info *modules, *m, *dep; -+ module_entry *m, *dep; - const char *moddir_base = "/"; - char *moddir, *version; - struct utsname uts; -+ unsigned i; - int tmp; - -+ INIT_G(); -+ - getopt32(argv, "aAb:eF:nruqC:", &moddir_base, NULL, NULL); - argv += optind; - -@@ -211,23 +195,23 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) - free(moddir); - - /* Scan modules */ -- modules = NULL; - if (*argv) { - do { -- parse_module(*argv, /*sb (unused):*/ NULL, &modules, 0); -+ parse_module(*argv, /*sb (unused):*/ NULL, NULL, 0); - } while (*++argv); - } else { - recursive_action(".", ACTION_RECURSE, -- parse_module, NULL, &modules, 0); -+ parse_module, NULL, NULL, 0); - } - - /* Generate dependency and alias files */ - if (!(option_mask32 & OPT_n)) - xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout); -- for (m = modules; m != NULL; m = m->next) { -+ -+ moddb_foreach_module(&G.db, m, i) { - printf("%s:", m->name); - -- order_dep_list(modules, m, m->dependencies); -+ order_dep_list(m, m->deps); - while (m->dnext != m) { - dep = m->dnext; - printf(" %s", dep->name); -@@ -243,10 +227,7 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) - #if ENABLE_FEATURE_MODUTILS_ALIAS - if (!(option_mask32 & OPT_n)) - xfreopen_write("modules.alias", stdout); -- for (m = modules; m != NULL; m = m->next) { -- char modname[MODULE_NAME_LEN]; -- const char *fname = bb_basename(m->name); -- filename2modname(fname, modname); -+ moddb_foreach_module(&G.db, m, i) { - while (m->aliases) { - /* - * Last word used to be a basename -@@ -256,34 +237,24 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) - */ - printf("alias %s %s\n", - (char*)llist_pop(&m->aliases), -- modname); -+ m->modname); - } - } - #endif - #if ENABLE_FEATURE_MODUTILS_SYMBOLS - if (!(option_mask32 & OPT_n)) - xfreopen_write("modules.symbols", stdout); -- for (m = modules; m != NULL; m = m->next) { -- char modname[MODULE_NAME_LEN]; -- const char *fname = bb_basename(m->name); -- filename2modname(fname, modname); -+ moddb_foreach_module(&G.db, m, i) { - while (m->symbols) { - printf("alias symbol:%s %s\n", - (char*)llist_pop(&m->symbols), -- modname); -+ m->modname); - } - } - #endif - -- if (ENABLE_FEATURE_CLEAN_UP) { -- while (modules) { -- module_info *old = modules; -- modules = modules->next; -- free(old->name); -- free(old->modname); -- free(old); -- } -- } -+ if (ENABLE_FEATURE_CLEAN_UP) -+ moddb_free(&G.db); - - return EXIT_SUCCESS; - } -diff --git a/modutils/modprobe.c b/modutils/modprobe.c -index 05bf02c..2f55ad2 100644 ---- a/modutils/modprobe.c -+++ b/modutils/modprobe.c -@@ -150,19 +150,6 @@ static const char modprobe_longopts[] ALIGN1 = - #define MODULE_FLAG_FOUND_IN_MODDEP 0x0004 - #define MODULE_FLAG_BLACKLISTED 0x0008 - --struct module_entry { /* I'll call it ME. */ -- unsigned flags; -- char *modname; /* stripped of /path/, .ext and s/-/_/g */ -- const char *probed_name; /* verbatim as seen on cmdline */ -- char *options; /* options from config files */ -- llist_t *realnames; /* strings. if this module is an alias, */ -- /* real module name is one of these. */ --//Can there really be more than one? Example from real kernel? -- llist_t *deps; /* strings. modules we depend on */ --}; -- --#define DB_HASH_SIZE 256 -- - struct globals { - llist_t *probes; /* MEs of module(s) requested on cmdline */ - char *cmdline_mopts; /* module options from cmdline */ -@@ -170,7 +157,7 @@ struct globals { - /* bool. "Did we have 'symbol:FOO' requested on cmdline?" */ - smallint need_symbols; - struct utsname uts; -- llist_t *db[DB_HASH_SIZE]; /* MEs of all modules ever seen (caching for speed) */ -+ module_db db; - } FIX_ALIASING; - #define G (*ptr_to_globals) - #define INIT_G() do { \ -@@ -195,51 +182,9 @@ static char *gather_options_str(char *opts, const char *append) - return opts; - } - --/* These three functions called many times, optimizing for speed. -- * Users reported minute-long delays when they runn iptables repeatedly -- * (iptables use modprobe to install needed kernel modules). -- */ --static struct module_entry *helper_get_module(const char *module, int create) --{ -- char modname[MODULE_NAME_LEN]; -- struct module_entry *e; -- llist_t *l; -- unsigned i; -- unsigned hash; -- -- filename2modname(module, modname); -- -- hash = 0; -- for (i = 0; modname[i]; i++) -- hash = ((hash << 5) + hash) + modname[i]; -- hash %= DB_HASH_SIZE; -- -- for (l = G.db[hash]; l; l = l->link) { -- e = (struct module_entry *) l->data; -- if (strcmp(e->modname, modname) == 0) -- return e; -- } -- if (!create) -- return NULL; -- -- e = xzalloc(sizeof(*e)); -- e->modname = xstrdup(modname); -- llist_add_to(&G.db[hash], e); -- -- return e; --} --static ALWAYS_INLINE struct module_entry *get_or_add_modentry(const char *module) -+static struct module_entry *get_or_add_modentry(const char *module) - { -- return helper_get_module(module, 1); --} --/* So far this function always gets a module pathname, never an alias name. -- * The crucial difference is that pathname needs dirname stripping, -- * while alias name must NOT do it! -- * Testcase where dirname stripping is likely to go wrong: "modprobe devname:snd/timer" -- */ --static ALWAYS_INLINE struct module_entry *get_modentry(const char *pathname) --{ -- return helper_get_module(bb_get_last_path_component_nostrip(pathname), 0); -+ return moddb_get(&G.db, module, 1); - } - - static void add_probe(const char *name) -@@ -536,7 +481,7 @@ static void load_modules_dep(void) - continue; - *colon = '\0'; - -- m = get_modentry(tokens[0]); -+ m = moddb_get(&G.db, bb_get_last_path_component_nostrip(tokens[0]), 0); - if (m == NULL) - continue; - -@@ -697,5 +642,8 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv) - } while (me->realnames != NULL); - } - -+ if (ENABLE_FEATURE_CLEAN_UP) -+ moddb_free(&G.db); -+ - return (rc != 0); - } -diff --git a/modutils/modutils.c b/modutils/modutils.c -index ef4134a..05e0777 100644 ---- a/modutils/modutils.c -+++ b/modutils/modutils.c -@@ -16,6 +16,49 @@ extern int delete_module(const char *module, unsigned int flags); - # define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags) - #endif - -+module_entry * FAST_FUNC moddb_get(module_db *db, const char *module, int create) -+{ -+ char modname[MODULE_NAME_LEN]; -+ struct module_entry *e; -+ unsigned i, hash; -+ -+ filename2modname(module, modname); -+ -+ hash = 0; -+ for (i = 0; modname[i]; i++) -+ hash = ((hash << 5) + hash) + modname[i]; -+ hash %= MODULE_HASH_SIZE; -+ -+ for (e = db->buckets[hash]; e; e = e->next) -+ if (strcmp(e->modname, modname) == 0) -+ return e; -+ if (!create) -+ return NULL; -+ -+ e = xzalloc(sizeof(*e)); -+ e->modname = xstrdup(modname); -+ e->next = db->buckets[hash]; -+ db->buckets[hash] = e; -+ e->dnext = e->dprev = e; -+ -+ return e; -+} -+ -+void FAST_FUNC moddb_free(module_db *db) -+{ -+ module_entry *e, *n; -+ unsigned i; -+ -+ for (i = 0; i < MODULE_HASH_SIZE; i++) { -+ for (e = db->buckets[i]; e; e = n) { -+ n = e->next; -+ free(e->name); -+ free(e->modname); -+ free(e); -+ } -+ } -+} -+ - void FAST_FUNC replace(char *s, char what, char with) - { - while (*s) { -diff --git a/modutils/modutils.h b/modutils/modutils.h -index 5f059c7..0c0cb46 100644 ---- a/modutils/modutils.h -+++ b/modutils/modutils.h -@@ -16,6 +16,35 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN - /* linux/include/linux/module.h has 64, but this is also used - * internally for the maximum alias name length, which can be quite long */ - #define MODULE_NAME_LEN 256 -+#define MODULE_HASH_SIZE 256 -+ -+typedef struct module_entry { -+ struct module_entry *next; -+ char *name, *modname; -+ llist_t *deps; -+ IF_MODPROBE( -+ llist_t *realnames; -+ unsigned flags; -+ const char *probed_name; /* verbatim as seen on cmdline */ -+ char *options; /* options from config files */ -+ ) -+ IF_DEPMOD( -+ llist_t *aliases; -+ llist_t *symbols; -+ struct module_entry *dnext, *dprev; -+ ) -+} module_entry; -+ -+typedef struct module_db { -+ module_entry *buckets[MODULE_HASH_SIZE]; -+} module_db; -+ -+#define moddb_foreach_module(db, module, index) \ -+ for ((index) = 0; (index) < MODULE_HASH_SIZE; (index)++) \ -+ for (module = (db)->buckets[index]; module; module = module->next) -+ -+module_entry *moddb_get(module_db *db, const char *s, int create) FAST_FUNC; -+void moddb_free(module_db *db) FAST_FUNC; - - void replace(char *s, char what, char with) FAST_FUNC; - char *replace_underscores(char *s) FAST_FUNC; --- -2.6.1 - diff --git a/main/busybox/2002-depmod-support-generating-kmod-binary-index-files.patch b/main/busybox/2002-depmod-support-generating-kmod-binary-index-files.patch deleted file mode 100644 index b758c35e4ab..00000000000 --- a/main/busybox/2002-depmod-support-generating-kmod-binary-index-files.patch +++ /dev/null @@ -1,495 +0,0 @@ -From d8c1e5b77fd9fac9e03172a00bcd3f18aa20e2d9 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Sun, 25 Oct 2015 22:21:41 +0200 -Subject: [PATCH 2002/2003] depmod: support generating kmod binary index files -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows to use busybox depmod, and run daemons -using libkmod (or even kmod modprobe if needed). - -About +1500 bytes when enabled. This patch merges some -depmod code paths, so when this is disabled it shrinks -the code size a little bit. - -Signed-off-by: Timo Teräs ---- - modutils/Config.src | 10 ++ - modutils/depmod.c | 270 ++++++++++++++++++++++++++++++++++++++++++---------- - modutils/modprobe.c | 15 --- - modutils/modutils.c | 27 +++++- - modutils/modutils.h | 15 +++ - 5 files changed, 270 insertions(+), 67 deletions(-) - -diff --git a/modutils/Config.src b/modutils/Config.src -index 0b11832..09db515 100644 ---- a/modutils/Config.src -+++ b/modutils/Config.src -@@ -229,6 +229,16 @@ config FEATURE_MODUTILS_ALIAS - - Say Y if unsure. - -+config FEATURE_MODUTILS_BIN -+ bool "Support for the kmod .bin file format" -+ default n -+ depends on DEPMOD && !MODPROBE_SMALL -+ select PLATFORM_LINUX -+ help -+ Generate kmod compatible binary index files for .dep, .alias, -+ .symbols and .builtin files. Allows mixing use of busybox -+ modutils and kmod (binaries and library). -+ - config FEATURE_MODUTILS_SYMBOLS - bool "Support for module.symbols file" - default y -diff --git a/modutils/depmod.c b/modutils/depmod.c -index b8699ba..40f3c08 100644 ---- a/modutils/depmod.c -+++ b/modutils/depmod.c -@@ -2,7 +2,7 @@ - /* - * depmod - generate modules.dep - * Copyright (c) 2008 Bernhard Reutner-Fischer -- * Copyrihgt (c) 2008 Timo Teras -+ * Copyrihgt (c) 2008-2015 Timo Teras - * Copyright (c) 2008 Vladimir Dronnikov - * - * Licensed under GPLv2 or later, see file LICENSE in this source tree. -@@ -14,8 +14,18 @@ - #include "modutils.h" - #include /* uname() */ - -+#define INDEX_MINCHAR 32 -+#define INDEX_MAXCHAR 128 -+ -+typedef struct index_node { -+ char *prefix; -+ llist_t *values; -+ struct index_node *children[INDEX_MAXCHAR-INDEX_MINCHAR]; -+} index_node; -+ - struct globals { - module_db db; -+ index_node *root_node; - } FIX_ALIASING; - #define G (*ptr_to_globals) - #define INIT_G() do { \ -@@ -48,18 +58,12 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA - - for (ptr = image; ptr < image + len - 10; ptr++) { - if (is_prefixed_with(ptr, "depends=")) { -- char *u; -- - ptr += 8; -- for (u = ptr; *u; u++) -- if (*u == '-') -- *u = '_'; -- ptr += string_to_llist(ptr, &e->deps, ","); -+ string_to_llist(replace_underscores(ptr), &e->deps, ","); - } else if (ENABLE_FEATURE_MODUTILS_ALIAS - && is_prefixed_with(ptr, "alias=") - ) { -- llist_add_to(&e->aliases, xstrdup(ptr + 6)); -- ptr += strlen(ptr); -+ llist_add_to(&e->aliases, replace_underscores(xstrdup(ptr + 6))); - } else if (ENABLE_FEATURE_MODUTILS_SYMBOLS - && is_prefixed_with(ptr, "__ksymtab_") - ) { -@@ -69,9 +73,10 @@ static int FAST_FUNC parse_module(const char *fname, struct stat *sb UNUSED_PARA - ) { - continue; - } -- llist_add_to(&e->symbols, xstrdup(ptr)); -- ptr += strlen(ptr); -- } -+ llist_add_to(&e->symbols, xasprintf("symbol:%s", ptr)); -+ } else -+ continue; -+ ptr += strlen(ptr); - } - free(image); - -@@ -103,12 +108,6 @@ static void order_dep_list(module_entry *start, llist_t *add) - } - } - --static void xfreopen_write(const char *file, FILE *f) --{ -- if (freopen(file, "w", f) == NULL) -- bb_perror_msg_and_die("can't open '%s'", file); --} -- - //usage:#if !ENABLE_MODPROBE_SMALL - //usage:#define depmod_trivial_usage "[-n] [-b BASE] [VERSION] [MODFILES]..." - //usage:#define depmod_full_usage "\n\n" -@@ -162,6 +161,169 @@ enum { - OPT_C = (1 << 9), /* -C,--config etc_modules_conf: ignored */ - }; - -+/* Support for the mod binary index generation */ -+ -+static void index_init(const char *filename) -+{ -+ if (ENABLE_FEATURE_MODUTILS_BIN) { -+ index_node *n; -+ -+ n = xzalloc(sizeof(index_node)); -+ n->prefix = xstrdup(""); -+ G.root_node = n; -+ } -+ -+ if (filename && !(option_mask32 & OPT_n)) { -+ if (freopen(filename, "w", stdout) == NULL) -+ bb_perror_msg_and_die("can't open '%s'", filename); -+ } -+} -+ -+static void index_add(const char *key, char *value, const char *prefix) -+{ -+ if (prefix && *prefix) -+ printf("%s%s %s\n", prefix, key, value); -+ else if (prefix) -+ printf("%s\n", value); -+ -+ if (ENABLE_FEATURE_MODUTILS_BIN) { -+ index_node *cur = G.root_node, *n; -+ unsigned i = 0, j, ch; -+ -+ while (1) { -+ /* Ensure node->prefix is a prefix of &str[i]. -+ * If it is not already, then we must split node. */ -+ for (j = 0; cur->prefix[j]; j++) { -+ ch = cur->prefix[j]; -+ if (ch != key[i+j]) { -+ /* New child is copy of node with prefix[j+1..N] */ -+ n = xzalloc(sizeof(index_node)); -+ n->prefix = xstrdup(&cur->prefix[j+1]); -+ n->values = cur->values; -+ memcpy(n->children, cur->children, sizeof(n->children)); -+ -+ /* Parent has prefix[0..j], child at prefix[j] */ -+ cur->prefix[j] = '\0'; -+ cur->values = NULL; -+ memset(cur->children, 0, sizeof(cur->children)); -+ cur->children[ch-INDEX_MINCHAR] = n; -+ break; -+ } -+ } -+ i += j; -+ -+ ch = key[i]; -+ if (ch == 0) -+ break; -+ -+ if (ch < INDEX_MINCHAR || ch >= INDEX_MAXCHAR) -+ bb_error_msg_and_die("bad module name"); -+ -+ ch -= INDEX_MINCHAR; -+ if (!cur->children[ch]) { -+ n = xzalloc(sizeof(index_node)); -+ cur->children[ch] = n; -+ n->prefix = xstrdup(&key[i+1]); -+ cur = n; -+ break; -+ } -+ -+ /* Descend into child node and continue */ -+ cur = cur->children[ch]; -+ i++; -+ } -+ -+ llist_add_to(&cur->values, value); -+ } -+} -+ -+static uint32_t index_write_node(FILE *out, index_node *n, void (*freeit)(void *data)) -+{ -+ uint32_t child_offs[INDEX_MAXCHAR-INDEX_MINCHAR]; -+ uint32_t offset; -+ uint8_t first = 255, last = 0; -+ unsigned i; -+ -+ for (i = 0; i < INDEX_MAXCHAR-INDEX_MINCHAR; i++) { -+ child_offs[i] = 0; -+ if (!n->children[i]) -+ continue; -+ child_offs[i] = index_write_node(out, n->children[i], freeit); -+ if (first > INDEX_MAXCHAR) -+ first = i; -+ last = i; -+ } -+ -+ offset = ftell(out); -+ -+ if (n->prefix[0]) { -+ fputs(n->prefix, out); -+ fputc('\0', out); -+ offset |= INDEX_NODE_PREFIX; -+ } -+ -+ if (first < INDEX_MAXCHAR) { -+ fputc(first + INDEX_MINCHAR, out); -+ fputc(last + INDEX_MINCHAR, out); -+ fwrite(child_offs + first, sizeof(uint32_t), last - first + 1, out); -+ offset |= INDEX_NODE_CHILDS; -+ } -+ -+ if (n->values) { -+ const llist_t *v; -+ unsigned int cnt; -+ uint32_t u; -+ -+ n->values = llist_rev(n->values); -+ for (v = n->values, cnt = 0; v != NULL; v = v->link, cnt++); -+ u = htonl(cnt); -+ fwrite(&u, sizeof(u), 1, out); -+ for (v = n->values, cnt = 0; v != NULL; v = v->link, cnt++) { -+ u = htonl(cnt); -+ fwrite(&u, sizeof(u), 1, out); -+ fputs(v->data, out); -+ fputc('\0', out); -+ } -+ offset |= INDEX_NODE_VALUES; -+ } -+ -+ llist_free(n->values, freeit); -+ free(n->prefix); -+ free(n); -+ -+ return htonl(offset); -+} -+ -+static void index_dump(const char *filename, int deps_file) -+{ -+ if (ENABLE_FEATURE_MODUTILS_BIN) { -+ FILE *out; -+ uint32_t header[3] = { -+ htonl(INDEX_MAGIC), -+ htonl(INDEX_VERSION), -+ }; -+ -+ if (option_mask32 & OPT_n) -+ filename = "/dev/null"; -+ else -+ filename = xasprintf("tmp.%s.bin", filename); -+ -+ out = xfopen_for_write(filename); -+ fwrite(header, sizeof(uint32_t), 3, out); -+ header[2] = index_write_node(out, G.root_node, deps_file ? free : 0); -+ rewind(out); -+ G.root_node = NULL; -+ fwrite(header, sizeof(uint32_t), 3, out); -+ if (fclose(out)) { -+ remove(filename); -+ bb_error_msg_and_die(bb_msg_write_error); -+ } -+ /* .bin files are mmap'ed; not renaming it may crash -+ * long standing daemon using libkmod */ -+ rename_or_warn(filename, filename + 4); -+ } -+} -+ - int depmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; - int depmod_main(int argc UNUSED_PARAM, char **argv) - { -@@ -205,53 +367,59 @@ int depmod_main(int argc UNUSED_PARAM, char **argv) - } - - /* Generate dependency and alias files */ -- if (!(option_mask32 & OPT_n)) -- xfreopen_write(CONFIG_DEFAULT_DEPMOD_FILE, stdout); -- -+ index_init(CONFIG_DEFAULT_DEPMOD_FILE); - moddb_foreach_module(&G.db, m, i) { -- printf("%s:", m->name); -- -+ char *buf = xasprintf("%s:", m->name); - order_dep_list(m, m->deps); - while (m->dnext != m) { - dep = m->dnext; -- printf(" %s", dep->name); -- -+ buf = gather_options_str(buf, dep->name); - /* unlink current entry */ - dep->dnext->dprev = dep->dprev; - dep->dprev->dnext = dep->dnext; - dep->dnext = dep->dprev = dep; - } -- bb_putchar('\n'); -+ index_add(m->modname, buf, ""); - } -- --#if ENABLE_FEATURE_MODUTILS_ALIAS -- if (!(option_mask32 & OPT_n)) -- xfreopen_write("modules.alias", stdout); -- moddb_foreach_module(&G.db, m, i) { -- while (m->aliases) { -- /* -- * Last word used to be a basename -- * (filename with path and .ko.* stripped) -- * at the time of module-init-tools 3.4. -- * kmod v.12 uses module name, i.e., s/-/_/g. -- */ -- printf("alias %s %s\n", -- (char*)llist_pop(&m->aliases), -- m->modname); -+ index_dump(CONFIG_DEFAULT_DEPMOD_FILE, 1); -+ -+ if (ENABLE_FEATURE_MODUTILS_ALIAS) { -+ index_init("modules.alias"); -+ moddb_foreach_module(&G.db, m, i) { -+ while (m->aliases) { -+ /* -+ * Last word used to be a basename -+ * (filename with path and .ko.* stripped) -+ * at the time of module-init-tools 3.4. -+ * kmod v.12 uses module name, i.e., s/-/_/g. -+ */ -+ index_add((char*)llist_pop(&m->aliases), m->modname, "alias "); -+ } - } -+ index_dump("modules.alias", 0); - } --#endif --#if ENABLE_FEATURE_MODUTILS_SYMBOLS -- if (!(option_mask32 & OPT_n)) -- xfreopen_write("modules.symbols", stdout); -- moddb_foreach_module(&G.db, m, i) { -- while (m->symbols) { -- printf("alias symbol:%s %s\n", -- (char*)llist_pop(&m->symbols), -- m->modname); -+ if (ENABLE_FEATURE_MODUTILS_SYMBOLS) { -+ index_init("modules.symbols"); -+ moddb_foreach_module(&G.db, m, i) { -+ while (m->symbols) { -+ index_add((char*)llist_pop(&m->symbols), m->modname, "alias "); -+ } -+ } -+ index_dump("modules.symbols", 0); -+ } -+ if (ENABLE_FEATURE_MODUTILS_BIN) { -+ char line[PATH_MAX], modname[MODULE_NAME_LEN]; -+ FILE *in; -+ -+ index_init(NULL); -+ in = xfopen_for_read("modules.builtin"); -+ while (fgets(line, sizeof(line), in) != NULL) { -+ filename2modname(line, modname); -+ index_add(modname, (char *) "", 0); - } -+ fclose(in); -+ index_dump("modules.builtin", 0); - } --#endif - - if (ENABLE_FEATURE_CLEAN_UP) - moddb_free(&G.db); -diff --git a/modutils/modprobe.c b/modutils/modprobe.c -index 2f55ad2..121bd56 100644 ---- a/modutils/modprobe.c -+++ b/modutils/modprobe.c -@@ -167,21 +167,6 @@ struct globals { - - static int read_config(const char *path); - --static char *gather_options_str(char *opts, const char *append) --{ -- /* Speed-optimized. We call gather_options_str many times. */ -- if (append) { -- if (opts == NULL) { -- opts = xstrdup(append); -- } else { -- int optlen = strlen(opts); -- opts = xrealloc(opts, optlen + strlen(append) + 2); -- sprintf(opts + optlen, " %s", append); -- } -- } -- return opts; --} -- - static struct module_entry *get_or_add_modentry(const char *module) - { - return moddb_get(&G.db, module, 1); -diff --git a/modutils/modutils.c b/modutils/modutils.c -index 05e0777..9d5c8c4 100644 ---- a/modutils/modutils.c -+++ b/modutils/modutils.c -@@ -59,6 +59,21 @@ void FAST_FUNC moddb_free(module_db *db) - } - } - -+char * FAST_FUNC gather_options_str(char *opts, const char *append) -+{ -+ /* Speed-optimized. We call gather_options_str many times. */ -+ if (append) { -+ if (opts == NULL) { -+ opts = xstrdup(append); -+ } else { -+ int optlen = strlen(opts); -+ opts = xrealloc(opts, optlen + strlen(append) + 2); -+ sprintf(opts + optlen, " %s", append); -+ } -+ } -+ return opts; -+} -+ - void FAST_FUNC replace(char *s, char what, char with) - { - while (*s) { -@@ -70,7 +85,17 @@ void FAST_FUNC replace(char *s, char what, char with) - - char* FAST_FUNC replace_underscores(char *s) - { -- replace(s, '-', '_'); -+ int i; -+ for (i = 0; s[i]; i++) { -+ switch (s[i]) { -+ case '-': -+ s[i] = '_'; -+ break; -+ case '[': -+ i += strcspn(&s[i], "]"); -+ break; -+ } -+ } - return s; - } - -diff --git a/modutils/modutils.h b/modutils/modutils.h -index 0c0cb46..30a13e6 100644 ---- a/modutils/modutils.h -+++ b/modutils/modutils.h -@@ -18,6 +18,20 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN - #define MODULE_NAME_LEN 256 - #define MODULE_HASH_SIZE 256 - -+/* .bin index format definitions */ -+#define INDEX_MAGIC 0xB007F457 -+#define INDEX_VERSION_MAJOR 0x0002 -+#define INDEX_VERSION_MINOR 0x0001 -+#define INDEX_VERSION ((INDEX_VERSION_MAJOR<<16)|INDEX_VERSION_MINOR) -+ -+enum node_offset { -+ INDEX_NODE_FLAGS = 0xF0000000, /* Flags in high nibble */ -+ INDEX_NODE_PREFIX = 0x80000000, -+ INDEX_NODE_VALUES = 0x40000000, -+ INDEX_NODE_CHILDS = 0x20000000, -+ INDEX_NODE_MASK = 0x0FFFFFFF, /* Offset value */ -+}; -+ - typedef struct module_entry { - struct module_entry *next; - char *name, *modname; -@@ -46,6 +60,7 @@ typedef struct module_db { - module_entry *moddb_get(module_db *db, const char *s, int create) FAST_FUNC; - void moddb_free(module_db *db) FAST_FUNC; - -+char *gather_options_str(char *opts, const char *append) FAST_FUNC; - void replace(char *s, char what, char with) FAST_FUNC; - char *replace_underscores(char *s) FAST_FUNC; - int string_to_llist(char *string, llist_t **llist, const char *delim) FAST_FUNC; --- -2.6.1 - diff --git a/main/busybox/2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch b/main/busybox/2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch deleted file mode 100644 index 434759d1309..00000000000 --- a/main/busybox/2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch +++ /dev/null @@ -1,87 +0,0 @@ -From a19967762fa8b8e6da7fcbcf7447131f33b0135b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Wed, 28 Oct 2015 10:20:57 +0200 -Subject: [PATCH 2003/2003] modinfo: fix argument parsing, and printing of - firmware -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -getopt was missing a short option for 'firmware', thus the -F option -for specific keyword was flagged as last OPT_TAGS entry. This caused -"-F firmware" to print twice the firmware fields (once due to incorrectly -set OPT_TAGS and once for OPT_F) and incorrectly with the fieldname -prefix. - -This adds -f as shortcut for "-F firmware" so that OPT_TAGS and OPT_F -are now set properly by getopt32(). This allows removing the incorrect -and unneeded OPT_F setting based on the keyword field. - -function old new delta -modinfo_main 438 430 -8 -modinfo 457 438 -19 ------------------------------------------------------------------------------- -(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-27) Total: -27 bytes - text data bss dec hex filename - 787574 15136 3656 806366 c4dde busybox_old - 787547 15136 3656 806339 c4dc3 busybox_unstripped - -Fixes: 772f17a843 "modinfo: match more standard module fields and fix version field" -Signed-off-by: Timo Teräs -Cc: Tanguy Pruvot ---- - modutils/modinfo.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/modutils/modinfo.c b/modutils/modinfo.c -index 8e74b64..e2c9df3 100644 ---- a/modutils/modinfo.c -+++ b/modutils/modinfo.c -@@ -31,7 +31,7 @@ enum { - - struct modinfo_env { - char *field; -- int tags; -+ unsigned tags; - }; - - static void display(const char *data, const char *pattern, int flag) -@@ -62,11 +62,13 @@ static void modinfo(const char *path, const char *version, - "firmware", - }; - size_t len; -- int j; -+ unsigned j; - char *ptr, *the_module; - const char *field = env->field; -- int tags = env->tags; -+ unsigned tags = env->tags; - -+ if (!tags) -+ tags = OPT_TAGS; - if (tags & 1) { /* filename */ - display(path, shortcuts[0], 1 != tags); - } -@@ -84,8 +86,6 @@ static void modinfo(const char *path, const char *version, - return; - } - -- if (field) -- tags |= OPT_F; - for (j = 1; (1< -Date: Thu, 5 Nov 2015 16:27:34 +0200 -Subject: [PATCH 3001/3003] login: move check_securetty to libbb - ---- - include/libbb.h | 1 + - libbb/Kbuild.src | 1 + - libbb/securetty.c | 27 +++++++++++++++++++++++++++ - loginutils/login.c | 19 ------------------- - 4 files changed, 29 insertions(+), 19 deletions(-) - create mode 100644 libbb/securetty.c - -diff --git a/include/libbb.h b/include/libbb.h -index a8ceb44..516f42e 100644 ---- a/include/libbb.h -+++ b/include/libbb.h -@@ -1360,6 +1360,7 @@ int sd_listen_fds(void); - #define SETUP_ENV_NO_CHDIR (1 << 4) - void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; - void nuke_str(char *str) FAST_FUNC; -+int check_securetty(const char *short_tty); - int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC; - int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC; - int ask_and_check_password(const struct passwd *pw) FAST_FUNC; -diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src -index 7fb6872..0f09de7 100644 ---- a/libbb/Kbuild.src -+++ b/libbb/Kbuild.src -@@ -84,6 +84,7 @@ lib-y += safe_gethostname.o - lib-y += safe_poll.o - lib-y += safe_strncpy.o - lib-y += safe_write.o -+lib-y += securetty.o - lib-y += setup_environment.o - lib-y += signals.o - lib-y += simplify_path.o -diff --git a/libbb/securetty.c b/libbb/securetty.c -new file mode 100644 -index 0000000..95edbc9 ---- /dev/null -+++ b/libbb/securetty.c -@@ -0,0 +1,27 @@ -+/* vi: set sw=4 ts=4: */ -+/* -+ * /etc/securetty checking. -+ * -+ * Licensed under GPLv2, see file LICENSE in this source tree. -+ */ -+ -+#include "libbb.h" -+ -+#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM -+int check_securetty(const char *short_tty) -+{ -+ char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */ -+ parser_t *parser = config_open2("/etc/securetty", fopen_for_read); -+ while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) { -+ if (strcmp(buf, short_tty) == 0) -+ break; -+ buf = NULL; -+ } -+ config_close(parser); -+ /* buf != NULL here if config file was not found, empty -+ * or line was found which equals short_tty */ -+ return buf != NULL; -+} -+#else -+ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; } -+#endif -diff --git a/loginutils/login.c b/loginutils/login.c -index 1700cfc..b38a1fb 100644 ---- a/loginutils/login.c -+++ b/loginutils/login.c -@@ -79,25 +79,6 @@ static void die_if_nologin(void) - # define die_if_nologin() ((void)0) - #endif - --#if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM --static int check_securetty(const char *short_tty) --{ -- char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */ -- parser_t *parser = config_open2("/etc/securetty", fopen_for_read); -- while (config_read(parser, &buf, 1, 1, "# \t", PARSE_NORMAL)) { -- if (strcmp(buf, short_tty) == 0) -- break; -- buf = NULL; -- } -- config_close(parser); -- /* buf != NULL here if config file was not found, empty -- * or line was found which equals short_tty */ -- return buf != NULL; --} --#else --static ALWAYS_INLINE int check_securetty(const char *short_tty UNUSED_PARAM) { return 1; } --#endif -- - #if ENABLE_SELINUX - static void initselinux(char *username, char *full_tty, - security_context_t *user_sid) --- -2.6.3 - diff --git a/main/busybox/3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch b/main/busybox/3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch deleted file mode 100644 index 1722be2ccde..00000000000 --- a/main/busybox/3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 12b6eff3a535a55441b6a84c24407626edf44b76 Mon Sep 17 00:00:00 2001 -From: Kaarle Ritvanen -Date: Thu, 5 Nov 2015 16:27:35 +0200 -Subject: [PATCH 3002/3003] libbb: allow_blank argument for - ask_and_check_password_extended() - ---- - include/libbb.h | 2 +- - libbb/correct_password.c | 6 +++--- - loginutils/sulogin.c | 2 +- - 3 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/include/libbb.h b/include/libbb.h -index 516f42e..ece8d37 100644 ---- a/include/libbb.h -+++ b/include/libbb.h -@@ -1362,7 +1362,7 @@ void setup_environment(const char *shell, int flags, const struct passwd *pw) FA - void nuke_str(char *str) FAST_FUNC; - int check_securetty(const char *short_tty); - int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC; --int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC; -+int ask_and_check_password_extended(const struct passwd *pw, int timeout, int allow_blank, const char *prompt) FAST_FUNC; - int ask_and_check_password(const struct passwd *pw) FAST_FUNC; - /* Returns a malloced string */ - #if !ENABLE_USE_BB_CRYPT -diff --git a/libbb/correct_password.c b/libbb/correct_password.c -index 513c930..57cd2b8 100644 ---- a/libbb/correct_password.c -+++ b/libbb/correct_password.c -@@ -96,7 +96,7 @@ int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext) - * NULL pw means "just fake it for login with bad username" - */ - int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, -- int timeout, const char *prompt) -+ int timeout, int allow_blank, const char *prompt) - { - IF_FEATURE_SHADOWPASSWDS(char buffer[SHADOW_BUFSIZE];) - char *plaintext; -@@ -105,7 +105,7 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, - - pw_pass = get_passwd(pw, buffer); - if (!pw_pass[0]) /* empty password field? */ -- return 1; -+ return allow_blank; - - plaintext = bb_ask(STDIN_FILENO, timeout, prompt); - if (!plaintext) { -@@ -120,5 +120,5 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw, - - int FAST_FUNC ask_and_check_password(const struct passwd *pw) - { -- return ask_and_check_password_extended(pw, 0, "Password: "); -+ return ask_and_check_password_extended(pw, 0, 1, "Password: "); - } -diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c -index 2a29099..4013f11 100644 ---- a/loginutils/sulogin.c -+++ b/loginutils/sulogin.c -@@ -53,7 +53,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv) - while (1) { - int r; - -- r = ask_and_check_password_extended(pwd, timeout, -+ r = ask_and_check_password_extended(pwd, timeout, 1, - "Give root password for system maintenance\n" - "(or type Control-D for normal startup):" - ); --- -2.6.3 - diff --git a/main/busybox/3003-su-FEATURE_SU_NULLOK_SECURE.patch b/main/busybox/3003-su-FEATURE_SU_NULLOK_SECURE.patch deleted file mode 100644 index bb0e1c64ce6..00000000000 --- a/main/busybox/3003-su-FEATURE_SU_NULLOK_SECURE.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0acd825122c5e2d1b2ba6a0d0f42960cefaafa88 Mon Sep 17 00:00:00 2001 -From: Kaarle Ritvanen -Date: Thu, 5 Nov 2015 16:27:36 +0200 -Subject: [PATCH 3003/3003] su: FEATURE_SU_NULLOK_SECURE - -When this feature is enabled, blank passwords are not accepted by su -unless the user is on a secure TTY defined in /etc/securetty. This -resembles the default PAM configuration of some Linux distros which -specify the nullok_secure option for pam_unix.so. ---- - loginutils/Config.src | 5 +++++ - loginutils/su.c | 13 ++++++++----- - 2 files changed, 13 insertions(+), 5 deletions(-) - -diff --git a/loginutils/Config.src b/loginutils/Config.src -index fa2b4f8..a150899 100644 ---- a/loginutils/Config.src -+++ b/loginutils/Config.src -@@ -311,6 +311,11 @@ config FEATURE_SU_CHECKS_SHELLS - depends on SU - default y - -+config FEATURE_SU_NULLOK_SECURE -+ bool "Disallow blank passwords from TTYs other than specified in /etc/securetty" -+ depends on SU -+ default n -+ - config SULOGIN - bool "sulogin" - default y -diff --git a/loginutils/su.c b/loginutils/su.c -index f812505..bd0cb35 100644 ---- a/loginutils/su.c -+++ b/loginutils/su.c -@@ -51,6 +51,7 @@ int su_main(int argc UNUSED_PARAM, char **argv) - struct passwd *pw; - uid_t cur_uid = getuid(); - const char *tty; -+ int allow_blank = 1; - #if ENABLE_FEATURE_UTMP - char user_buf[64]; - #endif -@@ -71,6 +72,12 @@ int su_main(int argc UNUSED_PARAM, char **argv) - argv++; - } - -+ tty = xmalloc_ttyname(STDIN_FILENO); -+ if (!tty) tty = "none"; -+ tty = skip_dev_pfx(tty); -+ -+ if (ENABLE_FEATURE_SU_NULLOK_SECURE) allow_blank = check_securetty(tty); -+ - if (ENABLE_FEATURE_SU_SYSLOG) { - /* The utmp entry (via getlogin) is probably the best way to - * identify the user, especially if someone su's from a su-shell. -@@ -84,16 +91,12 @@ int su_main(int argc UNUSED_PARAM, char **argv) - pw = getpwuid(cur_uid); - old_user = pw ? xstrdup(pw->pw_name) : ""; - } -- tty = xmalloc_ttyname(2); -- if (!tty) { -- tty = "none"; -- } - openlog(applet_name, 0, LOG_AUTH); - } - - pw = xgetpwnam(opt_username); - -- if (cur_uid == 0 || ask_and_check_password(pw) > 0) { -+ if (cur_uid == 0 || ask_and_check_password_extended(pw, 0, allow_blank, "Password: ") > 0) { - if (ENABLE_FEATURE_SU_SYSLOG) - syslog(LOG_NOTICE, "%c %s %s:%s", - '+', tty, old_user, opt_username); --- -2.6.3 - diff --git a/main/busybox/4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch b/main/busybox/4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch deleted file mode 100644 index a2b6688fc6b..00000000000 --- a/main/busybox/4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch +++ /dev/null @@ -1,153 +0,0 @@ -From fc47fcefb6401605b142c30025c597dc4d110087 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Wed, 10 Feb 2016 06:55:07 +0100 -Subject: [PATCH 4001/4007] ntpd: step when |offset| > 1 sec, not 0.125 sec - -update_local_clock 769 820 +51 -recv_and_process_peer_pkt 838 862 +24 -reset_peer_stats 137 133 -4 ------------------------------------------------------------------------------- -(add/remove: 0/0 grow/shrink: 2/1 up/down: 75/-4) Total: 71 bytes - -Signed-off-by: Denys Vlasenko ---- - networking/ntpd.c | 54 ++++++++++++++++++++++++++++++++++++------------------ - 1 file changed, 36 insertions(+), 18 deletions(-) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 9732c9b..32590a1 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -112,7 +112,7 @@ - * - * Made some changes to speed up re-syncing after our clock goes bad - * (tested with suspending my laptop): -- * - if largish offset (>= STEP_THRESHOLD * 8 == 1 sec) is seen -+ * - if largish offset (>= STEP_THRESHOLD == 1 sec) is seen - * from a peer, schedule next query for this peer soon - * without drastically lowering poll interval for everybody. - * This makes us collect enough data for step much faster: -@@ -131,11 +131,14 @@ - #define RESPONSE_INTERVAL 16 /* wait for reply up to N secs */ - - /* Step threshold (sec). std ntpd uses 0.128. -+ */ -+#define STEP_THRESHOLD 1 -+/* Slew threshold (sec): adjtimex() won't accept offsets larger than this. - * Using exact power of 2 (1/8) results in smaller code - */ --#define STEP_THRESHOLD 0.125 -+#define SLEW_THRESHOLD 0.125 - /* Stepout threshold (sec). std ntpd uses 900 (11 mins (!)) */ --#define WATCH_THRESHOLD 128 -+#define WATCH_THRESHOLD 128 - /* NB: set WATCH_THRESHOLD to ~60 when debugging to save time) */ - //UNUSED: #define PANIC_THRESHOLD 1000 /* panic threshold (sec) */ - -@@ -143,7 +146,7 @@ - * If we got |offset| > BIGOFF from a peer, cap next query interval - * for this peer by this many seconds: - */ --#define BIGOFF (STEP_THRESHOLD * 8) -+#define BIGOFF STEP_THRESHOLD - #define BIGOFF_INTERVAL (1 << 7) /* 128 s */ - - #define FREQ_TOLERANCE 0.000015 /* frequency tolerance (15 PPM) */ -@@ -157,10 +160,10 @@ - #define MAXPOLL 12 /* maximum poll interval (12: 1.1h, 17: 36.4h). std ntpd uses 17 */ - /* - * Actively lower poll when we see such big offsets. -- * With STEP_THRESHOLD = 0.125, it means we try to sync more aggressively -+ * With SLEW_THRESHOLD = 0.125, it means we try to sync more aggressively - * if offset increases over ~0.04 sec - */ --//#define POLLDOWN_OFFSET (STEP_THRESHOLD / 3) -+//#define POLLDOWN_OFFSET (SLEW_THRESHOLD / 3) - #define MINDISP 0.01 /* minimum dispersion (sec) */ - #define MAXDISP 16 /* maximum dispersion (sec) */ - #define MAXSTRAT 16 /* maximum stratum (infinity metric) */ -@@ -720,7 +723,7 @@ static void - reset_peer_stats(peer_t *p, double offset) - { - int i; -- bool small_ofs = fabs(offset) < 16 * STEP_THRESHOLD; -+ bool small_ofs = fabs(offset) < STEP_THRESHOLD; - - /* Used to set p->filter_datapoint[i].d_dispersion = MAXDISP - * and clear reachable bits, but this proved to be too agressive: -@@ -771,7 +774,7 @@ add_peers(const char *s) - p->p_fd = -1; - p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3); - p->next_action_time = G.cur_time; /* = set_next(p, 0); */ -- reset_peer_stats(p, 16 * STEP_THRESHOLD); -+ reset_peer_stats(p, STEP_THRESHOLD); - - llist_add_to(&G.ntp_peers, p); - G.peer_cnt++; -@@ -1638,14 +1641,7 @@ update_local_clock(peer_t *p) - tmx.freq = G.discipline_freq_drift * 65536e6; - #endif - tmx.modes = ADJ_OFFSET | ADJ_STATUS | ADJ_TIMECONST;// | ADJ_MAXERROR | ADJ_ESTERROR; -- tmx.offset = (offset * 1000000); /* usec */ -- tmx.status = STA_PLL; -- if (G.ntp_status & LI_PLUSSEC) -- tmx.status |= STA_INS; -- if (G.ntp_status & LI_MINUSSEC) -- tmx.status |= STA_DEL; -- -- tmx.constant = (int)G.poll_exp - 4 > 0 ? (int)G.poll_exp - 4 : 0; -+ tmx.constant = (int)G.poll_exp - 4; - /* EXPERIMENTAL. - * The below if statement should be unnecessary, but... - * It looks like Linux kernel's PLL is far too gentle in changing -@@ -1656,8 +1652,27 @@ update_local_clock(peer_t *p) - * To be on a safe side, let's do it only if offset is significantly - * larger than jitter. - */ -- if (tmx.constant > 0 && G.offset_to_jitter_ratio >= TIMECONST_HACK_GATE) -+ if (G.offset_to_jitter_ratio >= TIMECONST_HACK_GATE) - tmx.constant--; -+ tmx.offset = (long)(offset * 1000000); /* usec */ -+ if (SLEW_THRESHOLD < STEP_THRESHOLD) { -+ if (tmx.offset > (long)(SLEW_THRESHOLD * 1000000)) { -+ tmx.offset = (long)(SLEW_THRESHOLD * 1000000); -+ tmx.constant--; -+ } -+ if (tmx.offset < -(long)(SLEW_THRESHOLD * 1000000)) { -+ tmx.offset = -(long)(SLEW_THRESHOLD * 1000000); -+ tmx.constant--; -+ } -+ } -+ if (tmx.constant < 0) -+ tmx.constant = 0; -+ -+ tmx.status = STA_PLL; -+ if (G.ntp_status & LI_PLUSSEC) -+ tmx.status |= STA_INS; -+ if (G.ntp_status & LI_MINUSSEC) -+ tmx.status |= STA_DEL; - - //tmx.esterror = (uint32_t)(clock_jitter * 1e6); - //tmx.maxerror = (uint32_t)((sys_rootdelay / 2 + sys_rootdisp) * 1e6); -@@ -1931,6 +1946,9 @@ recv_and_process_peer_pkt(peer_t *p) - increase_interval: - adjust_poll(MINPOLL); - } else { -+ VERB3 if (rc > 0) -+ bb_error_msg("want smaller poll interval: offset/jitter ratio > %u", -+ POLLADJ_GATE); - adjust_poll(-G.poll_exp * 2); - } - } -@@ -1939,7 +1957,7 @@ recv_and_process_peer_pkt(peer_t *p) - pick_normal_interval: - interval = poll_interval(INT_MAX); - if (fabs(offset) >= BIGOFF && interval > BIGOFF_INTERVAL) { -- /* If we are synced, offsets are less than STEP_THRESHOLD, -+ /* If we are synced, offsets are less than SLEW_THRESHOLD, - * or at the very least not much larger than it. - * Now we see a largish one. - * Either this peer is feeling bad, or packet got corrupted, --- -2.8.3 - diff --git a/main/busybox/4002-ntpd-shorter-message.patch b/main/busybox/4002-ntpd-shorter-message.patch deleted file mode 100644 index fddf0ca6249..00000000000 --- a/main/busybox/4002-ntpd-shorter-message.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 383201e7258c3c1646f6d5cab4e813b5c3b3ecd0 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Wed, 10 Feb 2016 07:06:31 +0100 -Subject: [PATCH 4002/4007] ntpd: shorter message - -Signed-off-by: Denys Vlasenko ---- - networking/ntpd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 32590a1..1651670 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -1947,7 +1947,7 @@ recv_and_process_peer_pkt(peer_t *p) - adjust_poll(MINPOLL); - } else { - VERB3 if (rc > 0) -- bb_error_msg("want smaller poll interval: offset/jitter ratio > %u", -+ bb_error_msg("want smaller poll interval: offset/jitter > %u", - POLLADJ_GATE); - adjust_poll(-G.poll_exp * 2); - } --- -2.8.3 - diff --git a/main/busybox/4003-ntpd-print-packet-delay-in-clock-update-message.patch b/main/busybox/4003-ntpd-print-packet-delay-in-clock-update-message.patch deleted file mode 100644 index e07c940ceda..00000000000 --- a/main/busybox/4003-ntpd-print-packet-delay-in-clock-update-message.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 03718bb2743fbd772732a2c57c76c1c56fa9cd37 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Wed, 24 Feb 2016 01:22:45 +0100 -Subject: [PATCH 4003/4007] ntpd: print packet delay in clock update message - -function old new delta -update_local_clock 820 826 +6 - -Signed-off-by: Denys Vlasenko ---- - networking/ntpd.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 1651670..2a96ddb 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -1685,8 +1685,14 @@ update_local_clock(peer_t *p) - VERB4 bb_error_msg("adjtimex:%d freq:%ld offset:%+ld status:0x%x", - rc, tmx.freq, tmx.offset, tmx.status); - G.kernel_freq_drift = tmx.freq / 65536; -- VERB2 bb_error_msg("update from:%s offset:%+f jitter:%f clock drift:%+.3fppm tc:%d", -- p->p_dotted, offset, G.discipline_jitter, (double)tmx.freq / 65536, (int)tmx.constant); -+ VERB2 bb_error_msg("update from:%s offset:%+f delay:%f jitter:%f clock drift:%+.3fppm tc:%d", -+ p->p_dotted, -+ offset, -+ p->lastpkt_delay, -+ G.discipline_jitter, -+ (double)tmx.freq / 65536, -+ (int)tmx.constant -+ ); - - return 1; /* "ok to increase poll interval" */ - } --- -2.8.3 - diff --git a/main/busybox/4004-ntpd-more-informative-poll-lowering-message.patch b/main/busybox/4004-ntpd-more-informative-poll-lowering-message.patch deleted file mode 100644 index 721e731610a..00000000000 --- a/main/busybox/4004-ntpd-more-informative-poll-lowering-message.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4c48a6474701d8b396a14213ebcc979a49187faf Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Thu, 3 Mar 2016 22:01:23 +0100 -Subject: [PATCH 4004/4007] ntpd: more informative poll lowering message - -Signed-off-by: Denys Vlasenko ---- - networking/ntpd.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 2a96ddb..4695c33 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -1953,8 +1953,8 @@ recv_and_process_peer_pkt(peer_t *p) - adjust_poll(MINPOLL); - } else { - VERB3 if (rc > 0) -- bb_error_msg("want smaller poll interval: offset/jitter > %u", -- POLLADJ_GATE); -+ bb_error_msg("want smaller interval: offset/jitter = %u", -+ G.offset_to_jitter_ratio); - adjust_poll(-G.poll_exp * 2); - } - } --- -2.8.3 - diff --git a/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch b/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch deleted file mode 100644 index ccad8425079..00000000000 --- a/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch +++ /dev/null @@ -1,57 +0,0 @@ -From f37f28199f508f5fee44753d320f044a91e76e39 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Fri, 4 Mar 2016 07:06:53 +0100 -Subject: [PATCH 4005/4007] ntpd: do not use a peer more than once (say, if two - peers resolve to the same IP) - -function old new delta -add_peers 98 166 +68 - -Signed-off-by: Denys Vlasenko ---- - networking/ntpd.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 4695c33..517806e 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -727,7 +727,7 @@ reset_peer_stats(peer_t *p, double offset) - - /* Used to set p->filter_datapoint[i].d_dispersion = MAXDISP - * and clear reachable bits, but this proved to be too agressive: -- * after step (tested with suspinding laptop for ~30 secs), -+ * after step (tested with suspending laptop for ~30 secs), - * this caused all previous data to be considered invalid, - * making us needing to collect full ~8 datapoins per peer - * after step in order to start trusting them. -@@ -766,11 +766,26 @@ reset_peer_stats(peer_t *p, double offset) - static void - add_peers(const char *s) - { -+ llist_t *item; - peer_t *p; - - p = xzalloc(sizeof(*p)); - p->p_lsa = xhost2sockaddr(s, 123); - p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa); -+ -+ /* Names like N..pool.ntp.org are randomly resolved -+ * to a pool of machines. Sometimes different N's resolve to the same IP. -+ * It is not useful to have two peers with same IP. We skip duplicates. -+ */ -+ for (item = G.ntp_peers; item != NULL; item = item->link) { -+ peer_t *pp = (peer_t *) item->data; -+ if (strcmp(p->p_dotted, pp->p_dotted) == 0) { -+ bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted); -+ free(p); -+ return; -+ } -+ } -+ - p->p_fd = -1; - p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3); - p->next_action_time = G.cur_time; /* = set_next(p, 0); */ --- -2.8.3 - diff --git a/main/busybox/4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch b/main/busybox/4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch deleted file mode 100644 index 8791b97351b..00000000000 --- a/main/busybox/4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch +++ /dev/null @@ -1,67 +0,0 @@ -From c8641962e4cbde48108ddfc1c105e3320778190d Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Fri, 4 Mar 2016 07:26:08 +0100 -Subject: [PATCH 4006/4007] ntpd: if peer does not reply anymore, try - re-resolving its hostname - -function old new delta -ntpd_main 1053 1130 +77 -add_peers 166 195 +29 - -Signed-off-by: Denys Vlasenko ---- - networking/ntpd.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 517806e..4103189 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -267,6 +267,7 @@ typedef struct { - - typedef struct { - len_and_sockaddr *p_lsa; -+ char *p_hostname; - char *p_dotted; - int p_fd; - int datapoint_idx; -@@ -781,11 +782,14 @@ add_peers(const char *s) - peer_t *pp = (peer_t *) item->data; - if (strcmp(p->p_dotted, pp->p_dotted) == 0) { - bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted); -+ free(p->p_lsa); -+ free(p->p_dotted); - free(p); - return; - } - } - -+ p->p_hostname = xstrdup(s); - p->p_fd = -1; - p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3); - p->next_action_time = G.cur_time; /* = set_next(p, 0); */ -@@ -2332,6 +2336,21 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) - timeout = poll_interval(NOREPLY_INTERVAL); - bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us", - p->p_dotted, p->reachable_bits, timeout); -+ -+ /* What if don't see it because it changed its IP? */ -+ if (p->reachable_bits == 0) { -+ len_and_sockaddr *lsa = host2sockaddr(p->p_hostname, 123); -+ if (lsa) { -+ char *dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); -+ //if (strcmp(dotted, p->p_dotted) != 0) -+ // bb_error_msg("peer IP changed"); -+ free(p->p_lsa); -+ free(p->p_dotted); -+ p->p_lsa = lsa; -+ p->p_dotted = dotted; -+ } -+ } -+ - set_next(p, timeout); - } - } --- -2.8.3 - diff --git a/main/busybox/4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch b/main/busybox/4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch deleted file mode 100644 index 81f4ef8c925..00000000000 --- a/main/busybox/4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch +++ /dev/null @@ -1,171 +0,0 @@ -From 52278b8df9433b2e32d2d842637024b42fcf1a94 Mon Sep 17 00:00:00 2001 -From: Kaarle Ritvanen -Date: Fri, 13 May 2016 00:00:11 +0300 -Subject: [PATCH 4007/4007] ntpd: postpone hostname resolution if fails on - startup - -Signed-off-by: Kaarle Ritvanen ---- - networking/ntpd.c | 116 +++++++++++++++++++++++++++++------------------------- - 1 file changed, 63 insertions(+), 53 deletions(-) - -diff --git a/networking/ntpd.c b/networking/ntpd.c -index 4103189..7f7d69e 100644 ---- a/networking/ntpd.c -+++ b/networking/ntpd.c -@@ -765,34 +765,48 @@ reset_peer_stats(peer_t *p, double offset) - } - - static void -+resolve_peer_hostname(peer_t *p) { -+ len_and_sockaddr *lsa = host2sockaddr(p->p_hostname, 123); -+ if (lsa) { -+ if (p->p_lsa) { -+ free(p->p_lsa); -+ free(p->p_dotted); -+ } -+ p->p_lsa = lsa; -+ p->p_dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); -+ } -+ set_next(p, lsa ? 0 : RETRY_INTERVAL); -+} -+ -+static void - add_peers(const char *s) - { - llist_t *item; - peer_t *p; - - p = xzalloc(sizeof(*p)); -- p->p_lsa = xhost2sockaddr(s, 123); -- p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa); -+ p->p_hostname = xstrdup(s); -+ resolve_peer_hostname(p); - - /* Names like N..pool.ntp.org are randomly resolved - * to a pool of machines. Sometimes different N's resolve to the same IP. - * It is not useful to have two peers with same IP. We skip duplicates. - */ -- for (item = G.ntp_peers; item != NULL; item = item->link) { -- peer_t *pp = (peer_t *) item->data; -- if (strcmp(p->p_dotted, pp->p_dotted) == 0) { -- bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted); -- free(p->p_lsa); -- free(p->p_dotted); -- free(p); -- return; -+ if (p->p_lsa) -+ for (item = G.ntp_peers; item != NULL; item = item->link) { -+ peer_t *pp = (peer_t *) item->data; -+ if (pp->p_lsa && strcmp(p->p_dotted, pp->p_dotted) == 0) { -+ bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted); -+ free(p->p_hostname); -+ free(p->p_lsa); -+ free(p->p_dotted); -+ free(p); -+ return; -+ } - } -- } - -- p->p_hostname = xstrdup(s); - p->p_fd = -1; - p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3); -- p->next_action_time = G.cur_time; /* = set_next(p, 0); */ - reset_peer_stats(p, STEP_THRESHOLD); - - llist_add_to(&G.ntp_peers, p); -@@ -2317,54 +2331,50 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) - for (item = G.ntp_peers; item != NULL; item = item->link) { - peer_t *p = (peer_t *) item->data; - -- if (p->next_action_time <= G.cur_time) { -- if (p->p_fd == -1) { -- /* Time to send new req */ -- if (--cnt == 0) { -- VERB4 bb_error_msg("disabling burst mode"); -- G.polladj_count = 0; -- G.poll_exp = MINPOLL; -- } -- send_query_to_peer(p); -- } else { -- /* Timed out waiting for reply */ -- close(p->p_fd); -- p->p_fd = -1; -- /* If poll interval is small, increase it */ -- if (G.poll_exp < BIGPOLL) -- adjust_poll(MINPOLL); -- timeout = poll_interval(NOREPLY_INTERVAL); -- bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us", -- p->p_dotted, p->reachable_bits, timeout); -- -- /* What if don't see it because it changed its IP? */ -- if (p->reachable_bits == 0) { -- len_and_sockaddr *lsa = host2sockaddr(p->p_hostname, 123); -- if (lsa) { -- char *dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); -- //if (strcmp(dotted, p->p_dotted) != 0) -- // bb_error_msg("peer IP changed"); -- free(p->p_lsa); -- free(p->p_dotted); -- p->p_lsa = lsa; -- p->p_dotted = dotted; -+ if (p->p_lsa) { -+ -+ if (p->next_action_time <= G.cur_time) { -+ if (p->p_fd == -1) { -+ /* Time to send new req */ -+ if (--cnt == 0) { -+ VERB4 bb_error_msg("disabling burst mode"); -+ G.polladj_count = 0; -+ G.poll_exp = MINPOLL; - } -+ send_query_to_peer(p); -+ } else { -+ /* Timed out waiting for reply */ -+ close(p->p_fd); -+ p->p_fd = -1; -+ /* If poll interval is small, increase it */ -+ if (G.poll_exp < BIGPOLL) -+ adjust_poll(MINPOLL); -+ timeout = poll_interval(NOREPLY_INTERVAL); -+ bb_error_msg("timed out waiting for %s, reach 0x%02x, next query in %us", -+ p->p_dotted, p->reachable_bits, timeout); -+ -+ /* What if don't see it because it changed its IP? */ -+ if (p->reachable_bits == 0) -+ resolve_peer_hostname(p); -+ -+ set_next(p, timeout); - } -+ } - -- set_next(p, timeout); -+ if (p->p_fd >= 0) { -+ /* Wait for reply from this peer */ -+ pfd[i].fd = p->p_fd; -+ pfd[i].events = POLLIN; -+ idx2peer[i] = p; -+ i++; - } -- } -+ -+ } else -+ resolve_peer_hostname(p); - - if (p->next_action_time < nextaction) - nextaction = p->next_action_time; - -- if (p->p_fd >= 0) { -- /* Wait for reply from this peer */ -- pfd[i].fd = p->p_fd; -- pfd[i].events = POLLIN; -- idx2peer[i] = p; -- i++; -- } - } - - timeout = nextaction - G.cur_time; --- -2.8.3 - diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index 22fb6528898..8406002a457 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -1,8 +1,8 @@ # Contributor: Łukasz Jendrysik # Maintainer: Natanael Copa pkgname=busybox -pkgver=1.24.2 -pkgrel=10 +pkgver=1.25.0 +pkgrel=0 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net arch="all" @@ -15,54 +15,27 @@ subpackages="$pkgname-static $pkgname-suid" options="suid" triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*" source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 - bbsuid.c - - nologin.c - $pkgname-1.11.1-bb.patch - bb-app-location.patch - loginutils-sha512.patch - udhcpc-discover-retries.patch - 0001-ping-make-ping-work-without-root-privileges.patch - - busybox-1.24.2-CVE-2016-2147.patch - busybox-1.24.2-CVE-2016-2148.patch - - 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch - 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch - - 0001-diff-add-support-for-no-dereference.patch - - 1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch - 1001-fbsplash-support-console-switching.patch - 1002-fbsplash-support-image-and-bar-alignment-and-positio.patch - - 2001-modutils-merge-module_entry-and-module_info-to-commo.patch - 2002-depmod-support-generating-kmod-binary-index-files.patch - 2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch - - 3001-login-move-check_securetty-to-libbb.patch - 3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch - 3003-su-FEATURE_SU_NULLOK_SECURE.patch - - 4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch - 4002-ntpd-shorter-message.patch - 4003-ntpd-print-packet-delay-in-clock-update-message.patch - 4004-ntpd-more-informative-poll-lowering-message.patch - 4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch - 4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch - 4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch - - 0001-ash-backport-fix-for-here-document-issues.patch - 0001-ash-fix-error-during-recursive-processing-of-here-do.patch - - 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch - 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch - - 0001-gzip-fix-compression-level-bug.-Closes-9131.patch + 0001-ash-exec-busybox.static.patch + 0002-set-applet-location-to-correspond-to-upstream-for-vi.patch + 0003-udhcpc-set-default-discover-retries-to-5.patch + 0004-ping-make-ping-work-without-root-privileges.patch + 0005-fbsplash-support-console-switching.patch + 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch + 0007-depmod-support-generating-kmod-binary-index-files.patch + 0008-login-move-check_securetty-to-libbb.patch + 0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch + 0010-su-FEATURE_SU_NULLOK_SECURE.patch + 0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch + 0012-gzip-fix-compression-level-bug.-Closes-9131.patch + 0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch + 0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch + 0015-diff-add-support-for-no-dereference.patch acpid.logrotate busyboxconfig - glibc.patch" + bbsuid.c + nologin.c + " _sdir="$srcdir"/$pkgname-$pkgver _staticdir="$srcdir"/build-static @@ -171,114 +144,63 @@ static() { "$subpkgdir"/bin/busybox.static } -md5sums="2eaae519cac1143bcf583636a745381f busybox-1.24.2.tar.bz2 -378058009a1d6b1e321617b32b933e28 bbsuid.c -d64b58a30892c558bdbab7f0d0997577 nologin.c -4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch -c5a8dbc8696db6da9c4624b0e11d8fba bb-app-location.patch -8c42c9ef0f0419c314c86bcaf7796106 loginutils-sha512.patch -91a7584a562a72ba886936558e576bbd udhcpc-discover-retries.patch -2b01339da696625108037303aec419d5 0001-ping-make-ping-work-without-root-privileges.patch -c45a85f5ced712743efbb683900f8c1d busybox-1.24.2-CVE-2016-2147.patch -850a57ca2871e370b4916161a0320a3f busybox-1.24.2-CVE-2016-2148.patch -d6f0ecf89f7633753d8998abe7e06e7e 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch -e1c183cbe1ca18a0fa0d9597314076c9 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch -69fa40bee9abec058427bf67fde1b61e 0001-diff-add-support-for-no-dereference.patch -699ce5aa1095ba4419cd595cec8a8f75 1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch -b56d306ccba574da78dff060b7330806 1001-fbsplash-support-console-switching.patch -4fe5f9e973674c7db3d07f295c363a7c 1002-fbsplash-support-image-and-bar-alignment-and-positio.patch -ad908fc45563148d9f22b50c6e78e0d4 2001-modutils-merge-module_entry-and-module_info-to-commo.patch -313fa7175333161c549af097d9f62a79 2002-depmod-support-generating-kmod-binary-index-files.patch -47987a0add3da5f2b1bac13c62120423 2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch -94ab8b7b930df2f8f04da0e69da258da 3001-login-move-check_securetty-to-libbb.patch -f7c45568bdb0d2295c43108691e78a40 3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch -f82d49c891c02516462db3cda29ccca7 3003-su-FEATURE_SU_NULLOK_SECURE.patch -574ba81293941dda3910a3d43699a53b 4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch -84bc3bc18532032c35553cc4d67810bf 4002-ntpd-shorter-message.patch -e891282cda76773643dd23077fc574e7 4003-ntpd-print-packet-delay-in-clock-update-message.patch -5fc2eb488f6c2a87b8eb8aa4948ae2c1 4004-ntpd-more-informative-poll-lowering-message.patch -f5adc07a1937c4ee36e231f32799515e 4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch -95479321232337dac85ff1d073ab0830 4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch -56af31d2b311983059f6ac8ebf84a5a3 4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch -5f03ee6f3e93bbc6aedff0777b227810 0001-ash-backport-fix-for-here-document-issues.patch -a4d1cf64fd1835a284ccc6dbc78e3ce0 0001-ash-fix-error-during-recursive-processing-of-here-do.patch -ab539a54dcd1c23eb0963e17e768fef7 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch -d77da40a3c1291ab82513fb59c517e38 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch -e8dea4f51fb8cf606e3c6a33e40fa644 0001-gzip-fix-compression-level-bug.-Closes-9131.patch +md5sums="b05af9645076f75429a8683f8afcbdb3 busybox-1.25.0.tar.bz2 +59028ad98544ec71c37f637df9d5c8f8 0001-ash-exec-busybox.static.patch +d6ca0a022af2f68746297b3673ca0467 0002-set-applet-location-to-correspond-to-upstream-for-vi.patch +59298fbff57e569a736e93395035cfec 0003-udhcpc-set-default-discover-retries-to-5.patch +c0ee8629bb7f2c75e6da39431b736572 0004-ping-make-ping-work-without-root-privileges.patch +50505c0b575943c85b396bbf0dad73b3 0005-fbsplash-support-console-switching.patch +b4a95d78733e08c3b960b60e70a5b965 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch +f3127ef3a4c2556e450a8d5af629d555 0007-depmod-support-generating-kmod-binary-index-files.patch +309801ed120b4a48d3da8df509679e3b 0008-login-move-check_securetty-to-libbb.patch +fbaa10f5a9f1dee17e9f106bcf7c476a 0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch +7a6be7fc37d858ceebe78f1170292d61 0010-su-FEATURE_SU_NULLOK_SECURE.patch +860021f9fb7f28c5e99973be70c6959a 0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch +a3beeb8c62d14f8c56d97e226bbeb180 0012-gzip-fix-compression-level-bug.-Closes-9131.patch +4de903bcbc4a0f9cea00ad7397f13084 0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch +a6c50952f8eecb4dc8ad961c18c99908 0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch +bc228dbf77eab3a5b7b982f603722177 0015-diff-add-support-for-no-dereference.patch 4046b78ee6a25259954797d73b94f4bd acpid.logrotate -ab4a2e1385566b01002e526614dd38c2 busyboxconfig -befaac2c59c380e36a452b3f1c1d4a3a glibc.patch" -sha256sums="e71ef53ec656f31c42633918d301405d40dea1d97eca12f272217ae4a971c855 busybox-1.24.2.tar.bz2 -52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39 bbsuid.c -9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d nologin.c -327bb8049e2726351a5c8b6b2cef864f6ce58725d4453983f97092ea73656ccc busybox-1.11.1-bb.patch -576366b4d50f1078da6c0364ef70415de92d97c93c64f4d790b11d7a34cdccd2 bb-app-location.patch -57674b20158c0b266ed028b0c65299f9cbcad7d33d19c9fcc403d3967daba493 loginutils-sha512.patch -90825a443339f1c8c249d05f7b025ce53e374d305f8e113d98d45146b105494d udhcpc-discover-retries.patch -cbc27953386429b0fa19856b881c6a1e88824ad6a77c21ecd409391d9857d319 0001-ping-make-ping-work-without-root-privileges.patch -7cedbcfe2744a7efc1d811372932bc8ef610b8bbdfe34d28ba5a0b5d582b885d busybox-1.24.2-CVE-2016-2147.patch -0d42e12334ff14616ce9dc22f02f15c8f3df3ef3334c9ef81abd29d21b5ac687 busybox-1.24.2-CVE-2016-2148.patch -666d0e9c5a4b37aca84d88138736012527d97de578f81b719bf913f558823e18 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch -53563c6dc4db13004d0b37f7bf1748e861b5a5c4244c1d34f102c23b689420c5 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch -70180473e3939402e460b25de8273a5ce7f62b130a9efe31f33d847b2406ac92 0001-diff-add-support-for-no-dereference.patch -043963183cad556bdae5d5608180f0cb76cf7eede175cd97aa002a787780500f 1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch -b8b0b16ed67b0159256193b1d2108b8ef9aa8a334ab81e463bb970c71257da9a 1001-fbsplash-support-console-switching.patch -e1f3fad8e21dfd72cfcae7ab3ba31d7938e964e0f9ec08b2da0b14d462435424 1002-fbsplash-support-image-and-bar-alignment-and-positio.patch -16ee3a66e5854adbcb7ea6b1ea5846bac49dcf6d874e167f57e88f2fbd5cd0a5 2001-modutils-merge-module_entry-and-module_info-to-commo.patch -dbddad67d6b6054b8ffe7159f7fd3189bf3b433ba8f179fb6915caeea20d1b4e 2002-depmod-support-generating-kmod-binary-index-files.patch -ea589dcd25037e3fefd2f3d6ac801a2a4a61a5cfd2d765785ea5558ed3937776 2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch -34c694cc2ac69ee2d6bbfe45a20c68036b6299ad7e4a1a8df9bf1ce0a4637bd7 3001-login-move-check_securetty-to-libbb.patch -ce24e38be870c90bdcb90e7b0445067adf7be0fac6b1154d2364a4db9ee3a9d8 3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch -d7b18672334ddeee7fbd6c0e92f26c5d2ef49ddefebf0b7f6eff8dc1ad8d3f7e 3003-su-FEATURE_SU_NULLOK_SECURE.patch -d77cf90aa6e4b69ada75f8b26df3baecc0be7f7b6a4e7825d77b76ef2cad7cc1 4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch -38c194685b40501d0806cf992f74904b408d3e2033aaeb4d82d72c0f5f6bd60f 4002-ntpd-shorter-message.patch -c9e2973410af407f87e225630c977f2222d2ee35748a67b7cb87ecd20f4412db 4003-ntpd-print-packet-delay-in-clock-update-message.patch -f04199c1593e4f3e073b358b5cf550e9b0d9ac5d2d88f2953fa12d682f7af14c 4004-ntpd-more-informative-poll-lowering-message.patch -b32097ee018d4ccdc77a12572e25a9082d4f2b0d6fb48afacdb23b3c4c438687 4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch -2ddecb01475adf86fc2e5fe835bead109ffebc83480cfcc3da650249d8e99793 4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch -c4dca6fcef3de0ed5beb1716a3fd229dd29996a90da95eec898a13e0d9d85041 4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch -f712ce190ce86084d56977e125d1561615394f3d9b840e926537868260e19d79 0001-ash-backport-fix-for-here-document-issues.patch -1d3f8f7b6d0972f8e56437fce8efbafe70e2d869fbe82f06eba11e0103fce224 0001-ash-fix-error-during-recursive-processing-of-here-do.patch -97dfec94c94f00b628a702ad81b235414af611e011bfc26c29be46c67063c101 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch -8dba75a5de5c808760e9439ad38b35f643a2442e9e5aca4b40b918cfc66ac255 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch -9ab63b013ad9edca66005c10ea58702e54b170155562baf7cb1d4a13f16196c6 0001-gzip-fix-compression-level-bug.-Closes-9131.patch +468cf612bd9e06a60fdf41e88a915270 busyboxconfig +378058009a1d6b1e321617b32b933e28 bbsuid.c +d64b58a30892c558bdbab7f0d0997577 nologin.c" +sha256sums="5a0fe06885ee1b805fb459ab6aaa023fe4f2eccee4fb8c0fd9a6c17c0daca2fc busybox-1.25.0.tar.bz2 +4c28b5613123af696399cd6caed99aaa1a86715fde3ebc00c704425c4f086b0c 0001-ash-exec-busybox.static.patch +7a955bf237e965394ee4c96c3cbe39aa41fa638531b9185838df7ee5b2d97240 0002-set-applet-location-to-correspond-to-upstream-for-vi.patch +996304829ad49ffc08e38800021a7da43ddda6e12081360fe766178106d0b452 0003-udhcpc-set-default-discover-retries-to-5.patch +b9766d28fa8dcee8ffcbc00795c1b2edea82d99ef7a39b024876c54d258a6b59 0004-ping-make-ping-work-without-root-privileges.patch +fc8bad08a5f43e32ac2f9c169a441567266dd551f9b2b82c6f227445a745413a 0005-fbsplash-support-console-switching.patch +8fe309313982fbe560cc3bdb3c61395bb22945942f1ebe768a5b0377f35e50a6 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch +8407ae754eb03c42a93c56fe2f248f4fc74301975923eb6b36e84b79cff658b0 0007-depmod-support-generating-kmod-binary-index-files.patch +23170f53ffb93bdaf555719f2233058803ae333a0176070dc0c38bb6fb1b35db 0008-login-move-check_securetty-to-libbb.patch +d2e1896b39c50988397a5ccc35074860fb0f032a837c47569530b505fc5d51eb 0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch +1d1ce2ea21668ea619b3cf48dd9bb8c9620ac0f73bad1679fc78a8e352dee6b6 0010-su-FEATURE_SU_NULLOK_SECURE.patch +748766cbc5df632ab659245e2e3e8082b8ba064a9701d6ecc7dc149b31e0e2e1 0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch +1025555ca503fd38cd98cea4b2049b3af32723950e4ff7ecdb0e2c67db7190ec 0012-gzip-fix-compression-level-bug.-Closes-9131.patch +9b70547101e717b677838cefdb65071dbecde335a860c332406adb70261d6e1b 0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch +f01c371de9a8cf7970220f9f72436199e70cdf68bb6a0ce640fa0e972699f078 0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch +8941ba9517694c10bb9c4bda30cd88a7ea6e82aa93a41b2561405315ab6b96b5 0015-diff-add-support-for-no-dereference.patch f7cbeb5a5a47395ad30454ce8262abcd3e91c33ef803c2ae31a9258d7142dd48 acpid.logrotate -a129ededc4c5ec3d0385e4da50a87e81f348ecc7541a2105dd98f0c8543a3a2f busyboxconfig -c604ef791c31d35a8c5ee4558d21428a46f37a6d762c4a7e29864f4037fc44a0 glibc.patch" -sha512sums="4d20fb68ee440be2855231c7fd5f3cb9dd9bfcc1a688f0b59cd3f7a55c8819e9cc44bd15f91500713571f2a84e5e44adc0fa8ae0ae3ebf63961dfc9e1c9ef8e0 busybox-1.24.2.tar.bz2 -c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f bbsuid.c -4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2 nologin.c -eb7cce973bfd53ce3350713437b9e2751becfb8dfb10b14f27c4f812297c403b90f80dc2906179d499e8dffbe6df8aa37ae27625c552162923d59fe35b55b32b busybox-1.11.1-bb.patch -5c42b05be69c834c9fd5372c6b0d55a6399c74146a94ea09eae7285dd4fa75d1bde38bf7ab73e98638f65eb72db02115453cbdfe85a0085d742940366f617c7d bb-app-location.patch -69af4800fcf765b4ae029daced7ff171b6b04d810c94a987c7ba848e275a27b77b18b38df1b85f4a12c4a47ed42f62e0768260eb1198e2aff1c3cea898b85c61 loginutils-sha512.patch -34415fe69f6b8d42756046aa8e6d9e4f64a3b0ceb9f57c4c988e35870fe975f05d0ac76f1f9a712196e9c59e67aa2a54abf398242009134fb3aca342c25a3646 udhcpc-discover-retries.patch -046576b60650a455a6f37272a9edb57d3878eae02d18d01a144286be632faae9ec9ee88f1fd4dfb2a8018c2f8b630bac06eefd2e75f16d22c4b807aa2b256366 0001-ping-make-ping-work-without-root-privileges.patch -1268f11089ab5bc4d296995ff8216a8f2f6fbb644d20f04502f92fcadd1cafade43eb6e613fe4b9ab7e475e2bcc3b85ae8196d78c4d56a62db2ce0f3564ba644 busybox-1.24.2-CVE-2016-2147.patch -0ffdfa24d5943a15d924fdd42b5d410c0a215d0cad1753caf6c6aba7d0e5be7a883b561a683a4ac8b906e96b1839f4e6f235501c1467afe50508284f51e42c0c busybox-1.24.2-CVE-2016-2148.patch -9c836f85d5bc3b33d459394679a93635658c59fb744e266109f84531d391880926d62d671f8ccef56d3b744f0bcc54a8ad2789931e50dcbc40d5d94158bcc503 0001-ifupdown-pass-interface-device-name-for-ipv6-route-c.patch -b1a1cc2ada657a3d3364c8c96853575d73784e769cd8768c170c27a3e59abd2beace75dff6d5047c4391725e961d93149f9c3f45ed75fb1c582bf18b818282c9 0001-ifupdown-use-x-hostname-NAME-with-udhcpc.patch -a35b66cd28b79ccc14b47315ac94677fdf8c14d8a6e8956707e71fb50d453dfc5b4b822832cd1faecfe9bf79e687f9b25a1357e0a88db530044c5f8514701c98 0001-diff-add-support-for-no-dereference.patch -2a8e9360e1cedd26bdb70d8cc036ef0abc7588bf2eee147c1c7436d7a40763f8e31d346b980145a36649130a2f811d299e4f46f7e1b60a8165a60ae9e79727d5 1000-fbsplash-use-virtual-y-size-in-mmap-size-calculation.patch -a181dd54e8e11cf1199edb1b1fcd4b7402bbf142593b6014f32c6815bb7093b56899ad0fcc9f73c382f56203ac5274fb3d51fa070feb541436f23c31680f1a69 1001-fbsplash-support-console-switching.patch -c33073416f7da2805a20f3f456f869217171c8fbfdef85f4ae481307aeb1e1b5717084bbbc619010fa5500c3f3f49b6468d5c122024fcc49d637c82427a3f553 1002-fbsplash-support-image-and-bar-alignment-and-positio.patch -d94d17806f08ad54366ca623fbe8663b6397b28d68860239edc9305e6006f01d4ea1c1fd2033b30d302fd095145b018aa6a1707b07b7b4dfcaa8e0388b6737d0 2001-modutils-merge-module_entry-and-module_info-to-commo.patch -daadb1b255a8d30f2a13b84c2120427998d8173cf10754b9117e19a6fea8926d1820005f4d99a4a6999a559e731b5339c12ead22b3efbe1f0e752671363129a5 2002-depmod-support-generating-kmod-binary-index-files.patch -80589e03021fd0cb7bf29c3747e5396bf53dc99ecfecf78de86759e5c3939652d7f022f4534de0a35228bd782c1a44c4762f027d198790ec2c1bb76d6f7f102d 2003-modinfo-fix-argument-parsing-and-printing-of-firmwar.patch -1832d2a09625cb60998c54330a751f13dec97da2c4133db29c10f77fa3314fd2ef2002a45eab7215ed1a0dd8b84a8a4c7d4c1d225b5ee012fe357a8777707a17 3001-login-move-check_securetty-to-libbb.patch -ed8d060b85d4da1681eb35ba64c5b249391e6a7edbeb55b8952897f08fe9bafac33593992772d80a6df42dd3af0e175ce9575ee51c49fbc875008ad0ac2f6f06 3002-libbb-allow_blank-argument-for-ask_and_check_passwor.patch -c6579970450e7c711461ab1953f534ae855c4a355b4a452b3fc52a286355c87e41f8951b1b5217d0f659e3173ace8718d42dad3dcc878899cf9decdf4d3fe238 3003-su-FEATURE_SU_NULLOK_SECURE.patch -4675882f0b255ca73e88b9b4c9ef8b19c0141b8d1a92ea6fd3758c284b9835ac97bf0340f2ce629160c4cb8e5783f32d315187e00596c00d59f1f9cf6d83241d 4001-ntpd-step-when-offset-1-sec-not-0.125-sec.patch -b5a22fb015e45231b9a4d827d2ef3ecea1f6c56c401d4ed228e5ce0fc6c282fe692da57ecbb31fbe25058a80d310e6058d2ee59b0a32b187a7b76051a1736f24 4002-ntpd-shorter-message.patch -9a4462dbb1bb9976c72adde30597455602110bc6cb992fbad1e3374d9bb806912d549084c5ee096d95345c23cc59e7dc7ab102a83272f66a0d1898399f5b4640 4003-ntpd-print-packet-delay-in-clock-update-message.patch -0fd4554b5f2752e6989772bbafb0360df3a79bb7a6828e5026c2b7adbdb474e20d82a5e6b32a52f1acb899e27b3d6329f61fa706d35ccf05977c58aeb2d39754 4004-ntpd-more-informative-poll-lowering-message.patch -e27e4d07cc1d13d8eb8e04ab282fa89bf7511c2ed1cdeb35721e6dbe14756c20486a462bf5f5b5caced4a2ad3de79780c5ea59ce1a7d7639aea21c9afe929699 4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch -71cdd9e06cdf670c249177408ef66c1de8590a82bdfe616fa002f0f2385c043876d1529bf8352e8da834f0e68807650c531975f70a28ec82f2b16fc596271351 4006-ntpd-if-peer-does-not-reply-anymore-try-re-resolving.patch -2241d12663cd3479e29080a680dd0d22f30db15a672b5143433ce6fdf249ab18fd0edfcc34dafd65308db49f1c7cbd77066050d8b8920871ecb5c7b5a77ba035 4007-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch -d55cab6ed08434e2a278edf1be6171b921bcaee47598988e4de6b390a01569e10394c54d5d4a27e6eba251ce68df5cc1ece358be32a9c31bdf1f7e9147cf5180 0001-ash-backport-fix-for-here-document-issues.patch -c14a632f9477c13ea99b24a73c81c9c44ead8b536970acd758e739b43a6260860039674341192ce7bb20a9204ee7d93dcd9541e526f2437d4d2d88637b400867 0001-ash-fix-error-during-recursive-processing-of-here-do.patch -6fc77e0edcbb61a64c179b0259e0634a82362ac0ca9a77f305eb75f6a89a10395e8a37cbcef925821b428c00237a0a3575af2c3ef194933f52ad55b0eb0dd6f2 0001-libbb-fix-time-parsing-of-CC-YY-MMDDhhmm-.SS.patch -a42d4b992b3ba3b33a605d7f919c574783034b99cd046fd394c040948360daef7f9fb5717994c5326187a185ee9f357b36f405e960ab632c2f59f5b9fba402f7 0001-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch -afa0aa2fee08b28b6f4a32bd761d9fd7ab6989a13651ffa9dc8a3a3c4de3c646ce0881c2abd1be96768ddb326451f2e06125e2959c42de6f339e90994461a803 0001-gzip-fix-compression-level-bug.-Closes-9131.patch +2d8ab0c6ac5610adaf8fd1c094da32727f23fda69434e1ab9cc115744cfa712b busyboxconfig +52bd2c7c44779f910eedd2fea73ec0de520add400894cc132276587e25c73e39 bbsuid.c +9bbf0bec82e6d6907474958f3be048c54657fbf49207810b7e4d4d6146f0069d nologin.c" +sha512sums="4122a457709a19f697547f1f84fb37da6ae85dd22afefcb49f551b2c6386838e07bfed0d7d58e70ee8199ae8fd35fd4397bf7d8b3bdd66f60aefb3153376efe4 busybox-1.25.0.tar.bz2 +1d5eaba0531263c2b60697d5c7652a2f700a23132c6d2923b45127ba6d7dcc8ccc6c9bd9054e1639fe0dc40e61147348399692c4f08dbf6a6b7bac3c1f2811f7 0001-ash-exec-busybox.static.patch +14a8c43be87b6d6c19787f476405ad6de1a575198ff2420e32d7f952bc72f4869419ef8189ff0e7b11f078a48013eb1f6c73e4b82aff316abba287a5bda96195 0002-set-applet-location-to-correspond-to-upstream-for-vi.patch +1157d65dbb0b2391b29222770dc8d67c87cea40c66e8734db15435dce413437f7bc54fa0b88412fb3618f63c5d244084870373b85d9616111d9a15a458f9734b 0003-udhcpc-set-default-discover-retries-to-5.patch +91033878d9e5efa8b1e5cebb6b18ea9a87af68b9939ac9441f791c8493b144dff46bafcc9c8d2ff3f8bc3b2c4891faad8fddf3e7335417c099b4b3051cbe9ba4 0004-ping-make-ping-work-without-root-privileges.patch +d69050a60588669b5a7719b63d13d6ecbcb5748cd7d80d0066c22c2571e3136964437c2263f33bbf1d2d17011cdbe972cc05ff753e669d8fc20844fcc211f1b8 0005-fbsplash-support-console-switching.patch +3b31d019441c2a555c5ac01c4c0a3636c7fa5000b992a487729f6fa6929d836417b81118ea422fcb6cb8509b783ab244faf8c04e132c24400a202f8c4c087334 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch +e0efce50a6bd89d04a5c0a579206f5069d2bcf8b694e9673c3c1792023d64250e156e9cfdd1de0de5399e3c4306a79eaf5ea5f4c9dd07e830e5ff0d85efab317 0007-depmod-support-generating-kmod-binary-index-files.patch +c9829ee74246a0acbccd3679f01b20399c7ea0e0c1b07edd21f4f2a26daa37f0746bba504dee2654a4f4003fbbd417017fbb3840565cb137b9c7d85e6a7a027b 0008-login-move-check_securetty-to-libbb.patch +db4f00959f44c1a85df3b4a1e1c87cdce3927929cbcd4627d8fe448413fbff44641be12f39189dc3d1fe91f44b5c083fb553aff0f32018821aa2fbad3e5a3d6a 0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch +cf244528fa204455c16cfcf0b092dc4ea07dad26a0ab96accd261afa8178d41edc8606f35d76cd1b0b24ae303c4b3f846c486f914468db344c64347d6a7c5b9c 0010-su-FEATURE_SU_NULLOK_SECURE.patch +2e4d8345bf12c8b1f59958cbdb3bc0fc7d439cf54c1f3582a5b04b407c1c1fb414aafaa8d44c26e22bd76eb7e44429bebd7b3696e737ca4792c7ac23cf4004a3 0011-df-use-f_frsize-instead-of-f_bsize-for-correct-sizes.patch +beef81211dfb16d3bc54654eab4d32df5cf5b4c23ec911ba39517760177a02223cdaef1177b54a0d8589e0b517d476d25f5decc5023558478d982d1e3008752b 0012-gzip-fix-compression-level-bug.-Closes-9131.patch +3437629d5cca10d736e40604b77ae1a51561f40b0f8a7a662be7af8c1ba69c947a14f4788845ff1689483863d7fbc4a2bf7cc25ab034dff9c02df886f6b54e64 0013-ntpd-postpone-hostname-resolution-if-fails-on-startu.patch +a175d4641954ae533a3ef30d62285d36ea890071efd52173ce6ed215bc7b834374fd96c787ba5de17302b71feb510f7eabe26055ae759783e93955778e495531 0014-ntpd-respond-only-to-client-and-symmetric-active-pac.patch +1851e83a23c0fdd2cb692e5bcb00830030a70e367b9926054295b78d38977a9fd1f8a88997c23f0425047bf4ef3e9bf6e309073497c118c049d15b27676aeca1 0015-diff-add-support-for-no-dereference.patch dadb4c953ebc755b88ee95c1489feb0c2d352f6e44abc716166024e6eea11ab9d10c84fad62c081775834d205cb04aa1be3c994676c88f4284495c54b9188e8b acpid.logrotate -580a6e15d6517641951bb1648c406cee2a82fab353552a60d37f29e5f58da664437d99d5bd313d88e260a92735c32886ffc1cad98f901bb27d1f5027fdce37d7 busyboxconfig -1d2739379dab1deb3eae7cffd4845300eb7d30f7343b4a1209b21a5680860d55080ad45fdefe098b249ce3040c01951fa7f0a79cd447b2d7b260eb000099d9dc glibc.patch" +1820adcd6b8759cf568e4b8fb78b22d8f67e1b33f2252fd05a1edd2d65aa7294769c802fdf50edf102675d0a13f8423727ade40ce5bf741ef95225c86675259c busyboxconfig +c1dd56509277c59751907a27f067f1622191ddfd498acfe390d83136d36a41f2bdfc2fd4daf35af77219a66fb00fea20483f34112afd5df2ccd9f36ab548e66f bbsuid.c +4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2 nologin.c" diff --git a/main/busybox/bb-app-location.patch b/main/busybox/bb-app-location.patch deleted file mode 100644 index 7a4c99b3536..00000000000 --- a/main/busybox/bb-app-location.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ./include/applets.src.h.orig -+++ ./include/applets.src.h -@@ -229,7 +229,7 @@ - IF_LPR(APPLET_ODDNAME(lpr, lpqr, BB_DIR_USR_BIN, BB_SUID_DROP, lpr)) - IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls)) - IF_LSATTR(APPLET(lsattr, BB_DIR_BIN, BB_SUID_DROP)) --IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP)) -+IF_LSPCI(APPLET(lspci, BB_DIR_USR_SBIN, BB_SUID_DROP)) - IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP)) - IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) - IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma)) ---- ./editors/vi.c.orig -+++ ./editors/vi.c -@@ -145,7 +145,7 @@ - //config: This will make the cursor movement faster, but requires more memory - //config: and it makes the applet a tiny bit larger. - --//applet:IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP)) -+//applet:IF_VI(APPLET(vi, BB_DIR_USR_BIN, BB_SUID_DROP)) - - //kbuild:lib-$(CONFIG_VI) += vi.o - diff --git a/main/busybox/busybox-1.11.1-bb.patch b/main/busybox/busybox-1.11.1-bb.patch deleted file mode 100644 index bb858cacd82..00000000000 --- a/main/busybox/busybox-1.11.1-bb.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ru busybox-1.11.1.orig/shell/ash.c busybox-1.11.1/shell/ash.c ---- busybox-1.11.1.orig/shell/ash.c 2008-07-28 09:04:29 +0000 -+++ busybox-1.11.1/shell/ash.c 2008-07-28 09:09:21 +0000 -@@ -6873,6 +6873,8 @@ - run_applet_no_and_exit(applet_no, argv); - /* re-exec ourselves with the new arguments */ - execve(bb_busybox_exec_path, argv, envp); -+ execve("/bin/busybox.static",argv,envp); -+ execve("/bin/busybox",argv,envp); - /* If they called chroot or otherwise made the binary no longer - * executable, fall through */ - } diff --git a/main/busybox/busybox-1.24.2-CVE-2016-2147.patch b/main/busybox/busybox-1.24.2-CVE-2016-2147.patch deleted file mode 100644 index 2187c9b6732..00000000000 --- a/main/busybox/busybox-1.24.2-CVE-2016-2147.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 3c4de6e36c4d387a648622e7b828a05f2b1b47e6 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Fri, 26 Feb 2016 15:54:56 +0100 -Subject: [PATCH] udhcpc: fix OPTION_6RD parsing (could overflow its malloced - buffer) - -Signed-off-by: Denys Vlasenko -Signed-off-by: Mike Frysinger -(cherry picked from commit 352f79acbd759c14399e39baef21fc4ffe180ac2) ---- - networking/udhcp/common.c | 15 +++++++++++++-- - networking/udhcp/dhcpc.c | 4 ++-- - 2 files changed, 15 insertions(+), 4 deletions(-) - -diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c -index bc41c8d..680852c 100644 ---- a/networking/udhcp/common.c -+++ b/networking/udhcp/common.c -@@ -142,7 +142,7 @@ const char dhcp_option_strings[] ALIGN1 = - * udhcp_str2optset: to determine how many bytes to allocate. - * xmalloc_optname_optval: to estimate string length - * from binary option length: (option[LEN] / dhcp_option_lengths[opt_type]) -- * is the number of elements, multiply in by one element's string width -+ * is the number of elements, multiply it by one element's string width - * (len_of_option_as_string[opt_type]) and you know how wide string you need. - */ - const uint8_t dhcp_option_lengths[] ALIGN1 = { -@@ -162,7 +162,18 @@ const uint8_t dhcp_option_lengths[] ALIGN1 = { - [OPTION_S32] = 4, - /* Just like OPTION_STRING, we use minimum length here */ - [OPTION_STATIC_ROUTES] = 5, -- [OPTION_6RD] = 22, /* ignored by udhcp_str2optset */ -+ [OPTION_6RD] = 12, /* ignored by udhcp_str2optset */ -+ /* The above value was chosen as follows: -+ * len_of_option_as_string[] for this option is >60: it's a string of the form -+ * "32 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 ". -+ * Each additional ipv4 address takes 4 bytes in binary option and appends -+ * another "255.255.255.255 " 16-byte string. We can set [OPTION_6RD] = 4 -+ * but this severely overestimates string length: instead of 16 bytes, -+ * it adds >60 for every 4 bytes in binary option. -+ * We cheat and declare here that option is in units of 12 bytes. -+ * This adds more than 60 bytes for every three ipv4 addresses - more than enough. -+ * (Even 16 instead of 12 should work, but let's be paranoid). -+ */ - }; - - -diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c -index 915f659..2332b57 100644 ---- a/networking/udhcp/dhcpc.c -+++ b/networking/udhcp/dhcpc.c -@@ -113,7 +113,7 @@ static const uint8_t len_of_option_as_string[] = { - [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("32 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 -@@ -220,7 +220,7 @@ static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_ - type = optflag->flags & OPTION_TYPE_MASK; - optlen = dhcp_option_lengths[type]; - upper_length = len_of_option_as_string[type] -- * ((unsigned)(len + optlen - 1) / (unsigned)optlen); -+ * ((unsigned)(len + optlen) / (unsigned)optlen); - - dest = ret = xmalloc(upper_length + strlen(opt_name) + 2); - dest += sprintf(ret, "%s=", opt_name); --- -2.7.4 - diff --git a/main/busybox/busybox-1.24.2-CVE-2016-2148.patch b/main/busybox/busybox-1.24.2-CVE-2016-2148.patch deleted file mode 100644 index 08e08bec173..00000000000 --- a/main/busybox/busybox-1.24.2-CVE-2016-2148.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 3a76bb5136d05f94ee62e377aa723e63444912c7 Mon Sep 17 00:00:00 2001 -From: Denys Vlasenko -Date: Thu, 10 Mar 2016 11:47:58 +0100 -Subject: [PATCH] udhcp: fix a SEGV on malformed RFC1035-encoded domain name - -Signed-off-by: Denys Vlasenko -Signed-off-by: Mike Frysinger -(cherry picked from commit d474ffc68290e0a83651c4432eeabfa62cd51e87) ---- - networking/udhcp/domain_codec.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c -index c1325d8..8429367 100644 ---- a/networking/udhcp/domain_codec.c -+++ b/networking/udhcp/domain_codec.c -@@ -63,11 +63,10 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre) - if (crtpos + *c + 1 > clen) /* label too long? abort */ - return NULL; - if (dst) -- memcpy(dst + len, c + 1, *c); -+ /* \3com ---> "com." */ -+ ((char*)mempcpy(dst + len, c + 1, *c))[0] = '.'; - len += *c + 1; - crtpos += *c + 1; -- if (dst) -- dst[len - 1] = '.'; - } else { - /* NUL: end of current domain name */ - if (retpos == 0) { -@@ -78,7 +77,10 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre) - crtpos = retpos; - retpos = depth = 0; - } -- if (dst) -+ if (dst && len != 0) -+ /* \4host\3com\0\4host and we are at \0: -+ * \3com was converted to "com.", change dot to space. -+ */ - dst[len - 1] = ' '; - } - -@@ -228,6 +230,9 @@ int main(int argc, char **argv) - int len; - uint8_t *encoded; - -+ uint8_t str[6] = { 0x00, 0x00, 0x02, 0x65, 0x65, 0x00 }; -+ printf("NUL:'%s'\n", dname_dec(str, 6, "")); -+ - #define DNAME_DEC(encoded,pre) dname_dec((uint8_t*)(encoded), sizeof(encoded), (pre)) - printf("'%s'\n", DNAME_DEC("\4host\3com\0", "test1:")); - printf("test2:'%s'\n", DNAME_DEC("\4host\3com\0\4host\3com\0", "")); --- -2.7.4 - diff --git a/main/busybox/busyboxconfig b/main/busybox/busyboxconfig index 76077a911ac..65e0e287cfd 100644 --- a/main/busybox/busyboxconfig +++ b/main/busybox/busyboxconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.24.2 -# Mon May 23 08:52:23 2016 +# Busybox version: 1.25.0 +# Thu Aug 4 13:18:39 2016 # CONFIG_HAVE_DOT_CONFIG=y @@ -23,6 +23,7 @@ CONFIG_FEATURE_BUFFERS_USE_MALLOC=y CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y CONFIG_FEATURE_COMPRESS_USAGE=y +CONFIG_BUSYBOX=y CONFIG_FEATURE_INSTALLER=y # CONFIG_INSTALL_NO_USR is not set CONFIG_LOCALE_SUPPORT=y @@ -75,6 +76,7 @@ CONFIG_EXTRA_LDLIBS="" # # CONFIG_DEBUG is not set # CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set # CONFIG_UNIT_TEST is not set # CONFIG_WERROR is not set CONFIG_NO_DEBUG_LIB=y @@ -96,7 +98,7 @@ CONFIG_PREFIX="/home/ncopa/aports/main/busybox/pkg/busybox" # # Busybox Library Tuning # -# CONFIG_FEATURE_SYSTEMD is not set +# CONFIG_FEATURE_USE_BSS_TAIL is not set CONFIG_FEATURE_RTMINMAX=y CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SMALL=0 @@ -140,6 +142,7 @@ CONFIG_FEATURE_SEAMLESS_Z=y # CONFIG_FEATURE_AR_CREATE is not set # CONFIG_UNCOMPRESS is not set CONFIG_GUNZIP=y +CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y CONFIG_BUNZIP2=y CONFIG_UNLZMA=y CONFIG_FEATURE_LZMA_FAST=y @@ -193,6 +196,9 @@ CONFIG_HOSTID=y CONFIG_ID=y CONFIG_GROUPS=y CONFIG_SHUF=y +CONFIG_STAT=y +CONFIG_FEATURE_STAT_FORMAT=y +CONFIG_FEATURE_STAT_FILESYSTEM=y CONFIG_SYNC=y CONFIG_FEATURE_SYNC_FANCY=y CONFIG_TEST=y @@ -284,8 +290,6 @@ CONFIG_SORT=y CONFIG_FEATURE_SORT_BIG=y CONFIG_SPLIT=y # CONFIG_FEATURE_SPLIT_FANCY is not set -CONFIG_STAT=y -CONFIG_FEATURE_STAT_FORMAT=y CONFIG_STTY=y CONFIG_SUM=y CONFIG_TAC=y @@ -456,6 +460,7 @@ CONFIG_HALT=y # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" CONFIG_INIT=y +# CONFIG_LINUXRC is not set CONFIG_FEATURE_USE_INITTAB=y CONFIG_FEATURE_KILL_REMOVED=y CONFIG_FEATURE_KILL_DELAY=0 @@ -463,31 +468,34 @@ CONFIG_FEATURE_INIT_SCTTY=y CONFIG_FEATURE_INIT_SYSLOG=y CONFIG_FEATURE_EXTRA_QUIET=y # CONFIG_FEATURE_INIT_COREDUMPS is not set -CONFIG_FEATURE_INITRD=y CONFIG_INIT_TERMINAL_TYPE="linux" +# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set CONFIG_MESG=y CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y # # Login/Password Management Utilities # -CONFIG_ADD_SHELL=y -CONFIG_REMOVE_SHELL=y -CONFIG_NOLOGIN=y CONFIG_FEATURE_SHADOWPASSWDS=y # CONFIG_USE_BB_PWD_GRP is not set # CONFIG_USE_BB_SHADOW is not set # CONFIG_USE_BB_CRYPT is not set # CONFIG_USE_BB_CRYPT_SHA is not set +CONFIG_ADD_SHELL=y +CONFIG_REMOVE_SHELL=y +CONFIG_ADDGROUP=y +# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set +CONFIG_FEATURE_ADDUSER_TO_GROUP=y CONFIG_ADDUSER=y # CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set CONFIG_FEATURE_CHECK_NAMES=y CONFIG_LAST_ID=256000 CONFIG_FIRST_SYSTEM_ID=100 CONFIG_LAST_SYSTEM_ID=999 -CONFIG_ADDGROUP=y -# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set -CONFIG_FEATURE_ADDUSER_TO_GROUP=y +CONFIG_CHPASSWD=y +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512" +CONFIG_CRYPTPW=y +CONFIG_MKPASSWD=y CONFIG_DELUSER=y CONFIG_DELGROUP=y CONFIG_FEATURE_DEL_USER_FROM_GROUP=y @@ -497,11 +505,9 @@ CONFIG_LOGIN_SESSION_AS_CHILD=y CONFIG_LOGIN_SCRIPTS=y CONFIG_FEATURE_NOLOGIN=y CONFIG_FEATURE_SECURETTY=y +CONFIG_NOLOGIN=y CONFIG_PASSWD=y CONFIG_FEATURE_PASSWD_WEAK_CHECK=y -CONFIG_CRYPTPW=y -CONFIG_CHPASSWD=y -CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="sha512" CONFIG_SU=y CONFIG_FEATURE_SU_SYSLOG=y CONFIG_FEATURE_SU_CHECKS_SHELLS=y @@ -552,6 +558,7 @@ CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" # # Linux System Utilities # +CONFIG_BLKDISCARD=y CONFIG_BLOCKDEV=y CONFIG_FATATTR=y CONFIG_FSTRIM=y @@ -571,8 +578,12 @@ CONFIG_FEATURE_MOUNT_CIFS=y CONFIG_FEATURE_MOUNT_FLAGS=y CONFIG_FEATURE_MOUNT_FSTAB=y # CONFIG_FEATURE_MOUNT_OTHERTAB is not set +CONFIG_NSENTER=y +CONFIG_FEATURE_NSENTER_LONG_OPTS=y CONFIG_REV=y +# CONFIG_SETARCH is not set # CONFIG_UEVENT is not set +CONFIG_UNSHARE=y CONFIG_ACPID=y CONFIG_FEATURE_ACPID_COMPAT=y CONFIG_BLKID=y @@ -625,7 +636,6 @@ CONFIG_READPROFILE=y # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set -# CONFIG_SETARCH is not set CONFIG_SWAPONOFF=y CONFIG_FEATURE_SWAPON_DISCARD=y CONFIG_FEATURE_SWAPON_PRI=y @@ -644,6 +654,7 @@ CONFIG_VOLUMEID=y # # Filesystem/Volume identification # +CONFIG_FEATURE_VOLUMEID_BCACHE=y CONFIG_FEATURE_VOLUMEID_BTRFS=y CONFIG_FEATURE_VOLUMEID_CRAMFS=y CONFIG_FEATURE_VOLUMEID_EXFAT=y @@ -701,6 +712,7 @@ CONFIG_SETSERIAL=y # CONFIG_UBIRMVOL is not set # CONFIG_UBIRSVOL is not set # CONFIG_UBIUPDATEVOL is not set +# CONFIG_UBIRENAME is not set # CONFIG_WALL is not set CONFIG_ADJTIMEX=y CONFIG_BBCONFIG=y @@ -736,7 +748,6 @@ CONFIG_FBSPLASH=y CONFIG_IONICE=y CONFIG_INOTIFYD=y # CONFIG_LAST is not set -# CONFIG_FEATURE_LAST_SMALL is not set # CONFIG_FEATURE_LAST_FANCY is not set # CONFIG_HDPARM is not set # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set @@ -848,6 +859,7 @@ CONFIG_FEATURE_IP_ROUTE=y CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" CONFIG_FEATURE_IP_TUNNEL=y CONFIG_FEATURE_IP_RULE=y +CONFIG_FEATURE_IP_NEIGH=y CONFIG_FEATURE_IP_SHORT_FORMS=y CONFIG_FEATURE_IP_RARE_PROTOCOLS=y CONFIG_IPADDR=y @@ -855,6 +867,7 @@ CONFIG_IPLINK=y CONFIG_IPROUTE=y CONFIG_IPTUNNEL=y CONFIG_IPRULE=y +CONFIG_IPNEIGH=y CONFIG_IPCALC=y CONFIG_FEATURE_IPCALC_FANCY=y # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set @@ -977,17 +990,17 @@ CONFIG_WATCH=y # # Runit Utilities # +# CONFIG_CHPST is not set +# CONFIG_SETUIDGID is not set +# CONFIG_ENVUIDGID is not set +# CONFIG_ENVDIR is not set +# CONFIG_SOFTLIMIT is not set # CONFIG_RUNSV is not set # CONFIG_RUNSVDIR is not set # CONFIG_FEATURE_RUNSVDIR_LOG is not set # CONFIG_SV is not set CONFIG_SV_DEFAULT_SERVICE_DIR="" # CONFIG_SVLOGD is not set -# CONFIG_CHPST is not set -# CONFIG_SETUIDGID is not set -# CONFIG_ENVUIDGID is not set -# CONFIG_ENVDIR is not set -# CONFIG_SOFTLIMIT is not set # CONFIG_CHCON is not set # CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set # CONFIG_GETENFORCE is not set @@ -1056,6 +1069,15 @@ CONFIG_FEATURE_SH_HISTFILESIZE=y # # System Logging Utilities # +CONFIG_KLOGD=y + +# +# klogd should not be used together with syslog to kernel printk buffer +# +CONFIG_FEATURE_KLOGD_KLOGCTL=y +CONFIG_LOGGER=y +CONFIG_LOGREAD=y +CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y CONFIG_SYSLOGD=y CONFIG_FEATURE_ROTATE_LOGFILE=y CONFIG_FEATURE_REMOTE_LOG=y @@ -1064,13 +1086,4 @@ CONFIG_FEATURE_SYSLOGD_CFG=y CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 CONFIG_FEATURE_IPC_SYSLOG=y CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 -CONFIG_LOGREAD=y -CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y CONFIG_FEATURE_KMSG_SYSLOG=y -CONFIG_KLOGD=y - -# -# klogd should not be used together with syslog to kernel printk buffer -# -CONFIG_FEATURE_KLOGD_KLOGCTL=y -CONFIG_LOGGER=y diff --git a/main/busybox/glibc.patch b/main/busybox/glibc.patch deleted file mode 100644 index 52c9efba1f0..00000000000 --- a/main/busybox/glibc.patch +++ /dev/null @@ -1,20 +0,0 @@ -Fix this by including sys/resource.h. - -Signed-off-by: Markus Trippelsdorf ---- - include/libbb.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/libbb.h b/include/libbb.h -index f12800f..e7806c2 100644 ---- a/include/libbb.h -+++ b/include/libbb.h -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - #include - #include - #include --- diff --git a/main/busybox/loginutils-sha512.patch b/main/busybox/loginutils-sha512.patch deleted file mode 100644 index f8f4e788e89..00000000000 --- a/main/busybox/loginutils-sha512.patch +++ /dev/null @@ -1,78 +0,0 @@ -diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c -index 39ffa08..432551c 100644 ---- a/libbb/pw_encrypt.c -+++ b/libbb/pw_encrypt.c -@@ -59,7 +59,7 @@ char* FAST_FUNC crypt_make_pw_salt(char salt[MAX_PW_SALT_LEN], const char *algo) - *salt_ptr++ = '$'; - #if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA - if (algo[0] == 's') { /* sha */ -- salt[1] = '5' + (strcmp(algo, "sha512") == 0); -+ salt[1] = '6' - (strcmp(algo, "sha256") == 0); - len = 16/2; - } - #endif -diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c -index 54ed737..59ea602 100644 ---- a/loginutils/chpasswd.c -+++ b/loginutils/chpasswd.c -@@ -13,11 +13,13 @@ - //usage: "Read user:password from stdin and update /etc/passwd\n" - //usage: IF_LONG_OPTS( - //usage: "\n -e,--encrypted Supplied passwords are in encrypted form" --//usage: "\n -m,--md5 Use MD5 encryption instead of DES" -+//usage: "\n -m,--md5 Use MD5 encryption instead of SHA512" -+//usage: "\n -d,--des Use DES encryption instead of SHA512" - //usage: ) - //usage: IF_NOT_LONG_OPTS( - //usage: "\n -e Supplied passwords are in encrypted form" --//usage: "\n -m Use MD5 encryption instead of DES" -+//usage: "\n -m Use MD5 encryption instead of SHA512" -+//usage: "\n -d Use DES encryption instead of SHA512" - //usage: ) - - //TODO: implement -c ALGO -@@ -26,11 +28,13 @@ - static const char chpasswd_longopts[] ALIGN1 = - "encrypted\0" No_argument "e" - "md5\0" No_argument "m" -+ "des\0" No_argument "d" - ; - #endif - - #define OPT_ENC 1 - #define OPT_MD5 2 -+#define OPT_DES 4 - - int chpasswd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; - int chpasswd_main(int argc UNUSED_PARAM, char **argv) -@@ -41,9 +45,9 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) - if (getuid() != 0) - bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); - -- opt_complementary = "m--e:e--m"; -+ opt_complementary = "m--e:e--m:d--e:e--d:m--d:d--m"; - IF_LONG_OPTS(applet_long_options = chpasswd_longopts;) -- opt = getopt32(argv, "em"); -+ opt = getopt32(argv, "emd"); - - while ((name = xmalloc_fgetline(stdin)) != NULL) { - char *free_me; -@@ -61,12 +65,14 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) - if (!(opt & OPT_ENC)) { - char salt[sizeof("$N$XXXXXXXX")]; - -- crypt_make_salt(salt, 1); -+ salt[0] = '$'; -+ salt[1] = '6'; -+ salt[2] = '$'; -+ crypt_make_salt(salt + 3, 4); - if (opt & OPT_MD5) { -- salt[0] = '$'; - salt[1] = '1'; -- salt[2] = '$'; -- crypt_make_salt(salt + 3, 4); -+ } else if (opt & OPT_DES) { -+ crypt_make_salt(salt, 1); - } - free_me = pass = pw_encrypt(pass, salt, 0); - } diff --git a/main/busybox/udhcpc-discover-retries.patch b/main/busybox/udhcpc-discover-retries.patch deleted file mode 100644 index e4a631c2797..00000000000 --- a/main/busybox/udhcpc-discover-retries.patch +++ /dev/null @@ -1,13 +0,0 @@ -Some slower nics needs more attempts to get a lease - ---- ./networking/udhcp/dhcpc.c.orig -+++ ./networking/udhcp/dhcpc.c -@@ -1238,7 +1238,7 @@ - llist_t *list_x = NULL; - int tryagain_timeout = 20; - int discover_timeout = 3; -- int discover_retries = 3; -+ int discover_retries = 5; - uint32_t server_addr = server_addr; /* for compiler */ - uint32_t requested_ip = 0; - uint32_t xid = xid; /* for compiler */ -- cgit v1.2.3