summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch12
-rw-r--r--system/busybox/0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch63
-rw-r--r--system/busybox/0001-wget-emit-a-message-that-certificate-verification-is.patch67
-rw-r--r--system/busybox/0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch59
-rw-r--r--system/busybox/0003-ash-exec-busybox.static.patch25
-rw-r--r--system/busybox/0004-app-location-for-cpio-vi-and-lspci.patch54
-rw-r--r--system/busybox/0005-udhcpc-set-default-discover-retries-to-5.patch35
-rw-r--r--system/busybox/0006-ping-make-ping-work-without-root-privileges.patch197
-rw-r--r--system/busybox/0007-fbsplash-support-console-switching.patch182
-rw-r--r--system/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch181
-rw-r--r--system/busybox/0009-depmod-support-generating-kmod-binary-index-files.patch510
-rw-r--r--system/busybox/0010-Add-flag-for-not-following-symlinks-when-recursing.patch59
-rw-r--r--system/busybox/0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch104
-rw-r--r--system/busybox/0012-udhcpc-Don-t-background-if-n-is-given.patch45
-rw-r--r--system/busybox/0013-testsuite-fix-cpio-tests.patch82
-rw-r--r--system/busybox/0014-miscutils-microcom-Fixed-segfault.patch31
-rw-r--r--system/busybox/0015-ash-introduce-a-config-option-to-search-current-dire.patch47
-rw-r--r--system/busybox/0016-top-handle-much-larger-VSZ-values.patch61
-rw-r--r--system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch45
-rw-r--r--system/busybox/APKBUILD116
-rw-r--r--system/busybox/bbsuid.c1
-rw-r--r--system/busybox/busybox-extras.pre-deinstall2
-rw-r--r--system/busybox/busyboxconfig91
-rw-r--r--system/busybox/busyboxconfig-extras85
-rw-r--r--system/busybox/external_ssl_client.patch52
-rw-r--r--system/busybox/nologin.c2
-rw-r--r--system/busybox/ssl_client.c158
27 files changed, 2234 insertions, 132 deletions
diff --git a/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch b/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
index e4ba6ece5..929370b9d 100644
--- a/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
+++ b/system/busybox/0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
@@ -1,8 +1,8 @@
-From f76c1ddd625b3d9912d9e6df2e90fcb94d08be99 Mon Sep 17 00:00:00 2001
+From 185ba65457e991ebd0f6e64266380df5e11cc489 Mon Sep 17 00:00:00 2001
From: William Pitcock <nenolod@dereferenced.org>
Date: Thu, 19 Oct 2017 17:24:40 +0000
-Subject: [PATCH] ash: add support for command_not_found_handle hook function,
- like bash
+Subject: [PATCH 01/16] ash: add support for command_not_found_handle hook
+ function, like bash
This implements support for the command_not_found_handle hook function, which is
useful for allowing package managers to suggest packages which could provide the
@@ -17,7 +17,7 @@ Signed-off-by: William Pitcock <nenolod@dereferenced.org>
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
-index 88e607f08..c3c4f4e93 100644
+index b73a79975..7ceb91920 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -132,6 +132,15 @@
@@ -36,7 +36,7 @@ index 88e607f08..c3c4f4e93 100644
//config:endif # ash options
//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
-@@ -13123,8 +13132,19 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
+@@ -13166,8 +13175,19 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
/* We failed. If there was an entry for this command, delete it */
if (cmdp && updatetbl)
delete_cmd_entry();
@@ -59,5 +59,5 @@ index 88e607f08..c3c4f4e93 100644
return;
--
-2.14.2
+2.16.2
diff --git a/system/busybox/0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch b/system/busybox/0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch
new file mode 100644
index 000000000..4680b920e
--- /dev/null
+++ b/system/busybox/0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch
@@ -0,0 +1,63 @@
+From d80eecb86812c1fbda652f9b995060c26ba0b155 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Sun, 29 Apr 2018 14:05:43 +0200
+Subject: [PATCH] cat: fix cat -e and cat -v erroneously numbering 1st line
+
+function old new delta
+cat_main 418 421 +3
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ coreutils/cat.c | 6 +++---
+ testsuite/cat.tests | 21 +++++++++++++++++++++
+ 2 files changed, 24 insertions(+), 3 deletions(-)
+ create mode 100755 testsuite/cat.tests
+
+diff --git a/coreutils/cat.c b/coreutils/cat.c
+index 5f02233ca..fb735f994 100644
+--- a/coreutils/cat.c
++++ b/coreutils/cat.c
+@@ -112,10 +112,10 @@ static int catv(unsigned opts, char **argv)
+ int retval = EXIT_SUCCESS;
+ int fd;
+ #if ENABLE_FEATURE_CATN
+- unsigned lineno = 0;
+- unsigned eol_char = (opts & (CAT_OPT_n|CAT_OPT_b)) ? '\n' : 0x100;
++ bool eol_seen = (opts & (CAT_OPT_n|CAT_OPT_b));
++ unsigned eol_char = (eol_seen ? '\n' : 0x100);
+ unsigned skip_num_on = (opts & CAT_OPT_b) ? '\n' : 0x100;
+- bool eol_seen = 1;
++ unsigned lineno = 0;
+ #endif
+
+ BUILD_BUG_ON(CAT_OPT_e != VISIBLE_ENDLINE);
+diff --git a/testsuite/cat.tests b/testsuite/cat.tests
+new file mode 100755
+index 000000000..404ebedeb
+--- /dev/null
++++ b/testsuite/cat.tests
+@@ -0,0 +1,21 @@
++#!/bin/sh
++
++# Copyright 2018 by Denys Vlasenko <vda.linux@googlemail.com>
++# Licensed under GPLv2, see file LICENSE in this source tree.
++
++. ./testing.sh
++
++# testing "description" "command" "result" "infile" "stdin"
++testing 'cat -e' \
++ 'cat -e' \
++ 'foo$\n' \
++ '' \
++ 'foo\n'
++
++testing 'cat -v' \
++ 'cat -v' \
++ 'foo\n' \
++ '' \
++ 'foo\n'
++
++exit $FAILCOUNT
+--
+2.17.0
+
diff --git a/system/busybox/0001-wget-emit-a-message-that-certificate-verification-is.patch b/system/busybox/0001-wget-emit-a-message-that-certificate-verification-is.patch
new file mode 100644
index 000000000..3780b039e
--- /dev/null
+++ b/system/busybox/0001-wget-emit-a-message-that-certificate-verification-is.patch
@@ -0,0 +1,67 @@
+From 948090c675f8b60b74c7357fcafb1cc8c179e0a6 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Mon, 28 May 2018 14:36:26 +0200
+Subject: [PATCH] wget: emit a message that certificate verification is not
+ implemented
+
+function old new delta
+spawn_ssl_client 185 209 +24
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ networking/wget.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/networking/wget.c b/networking/wget.c
+index d1d85230c..cd92b3a28 100644
+--- a/networking/wget.c
++++ b/networking/wget.c
+@@ -136,6 +136,7 @@
+ //usage: "Retrieve files via HTTP or FTP\n"
+ //usage: IF_FEATURE_WGET_LONG_OPTIONS(
+ //usage: "\n --spider Only check URL existence: $? is 0 if exists"
++///////: "\n --no-check-certificate Don't validate the server's certificate"
+ //usage: )
+ //usage: "\n -c Continue retrieval of aborted transfer"
+ //usage: "\n -q Quiet"
+@@ -267,6 +268,7 @@ enum {
+ WGET_OPT_HEADER = (1 << 10) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
+ WGET_OPT_POST_DATA = (1 << 11) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
+ WGET_OPT_SPIDER = (1 << 12) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
++ WGET_OPT_NO_CHECK_CERT = (1 << 13) * ENABLE_FEATURE_WGET_LONG_OPTIONS,
+ };
+
+ enum {
+@@ -765,6 +767,9 @@ static void spawn_ssl_client(const char *host, int network_fd)
+ int pid;
+ char *servername, *p;
+
++ if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT))
++ bb_error_msg("note: TLS certificate validation not implemented");
++
+ servername = xstrdup(host);
+ p = strrchr(servername, ':');
+ if (p) *p = '\0';
+@@ -1353,10 +1358,9 @@ IF_DESKTOP( "tries\0" Required_argument "t")
+ "header\0" Required_argument "\xff"
+ "post-data\0" Required_argument "\xfe"
+ "spider\0" No_argument "\xfd"
++ "no-check-certificate\0" No_argument "\xfc"
+ /* Ignored (we always use PASV): */
+ IF_DESKTOP( "passive-ftp\0" No_argument "\xf0")
+- /* Ignored (we don't do ssl) */
+-IF_DESKTOP( "no-check-certificate\0" No_argument "\xf0")
+ /* Ignored (we don't support caching) */
+ IF_DESKTOP( "no-cache\0" No_argument "\xf0")
+ IF_DESKTOP( "no-verbose\0" No_argument "\xf0")
+@@ -1416,6 +1420,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0")
+ if (option_mask32 & WGET_OPT_HEADER) bb_error_msg("--header");
+ if (option_mask32 & WGET_OPT_POST_DATA) bb_error_msg("--post-data");
+ if (option_mask32 & WGET_OPT_SPIDER) bb_error_msg("--spider");
++ if (option_mask32 & WGET_OPT_NO_CHECK_CERT) bb_error_msg("--no-check-certificate");
+ exit(0);
+ #endif
+ argv += optind;
+--
+2.17.0
+
diff --git a/system/busybox/0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch b/system/busybox/0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
new file mode 100644
index 000000000..72df8ecf9
--- /dev/null
+++ b/system/busybox/0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
@@ -0,0 +1,59 @@
+From bce882404ab41d32d5d9def274e49264717135b2 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 28 Nov 2017 13:23:17 +0100
+Subject: [PATCH 02/16] fsck: resolve LABEL=.../UUID=... spec to device
+
+---
+ e2fsprogs/fsck.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
+index 1c285bb92..5af38c0aa 100644
+--- a/e2fsprogs/fsck.c
++++ b/e2fsprogs/fsck.c
+@@ -60,6 +60,7 @@
+ //usage: "\n -t TYPE List of filesystem types to check"
+
+ #include "libbb.h"
++#include "volume_id.h"
+ #include "common_bufsiz.h"
+
+ /* "progress indicator" code is somewhat buggy and ext[23] specific.
+@@ -523,12 +524,13 @@ static int wait_many(int flags)
+ * Execute a particular fsck program, and link it into the list of
+ * child processes we are waiting for.
+ */
+-static void execute(const char *type, const char *device,
++static void execute(const char *type, const char *spec,
+ const char *mntpt /*, int interactive */)
+ {
+ int i;
+ struct fsck_instance *inst;
+ pid_t pid;
++ char *device = (char *)spec;
+
+ G.args[0] = xasprintf("fsck.%s", type);
+
+@@ -543,7 +545,8 @@ static void execute(const char *type, const char *device,
+ }
+ #endif
+
+- G.args[G.num_args - 2] = (char*)device;
++ resolve_mount_spec(&device);
++ G.args[G.num_args - 2] = device;
+ /* G.args[G.num_args - 1] = NULL; - already is */
+
+ if (G.verbose || G.noexecute) {
+@@ -972,9 +975,6 @@ int fsck_main(int argc UNUSED_PARAM, char **argv)
+
+ /* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */
+ if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
+-// FIXME: must check that arg is a blkdev, or resolve
+-// "/path", "UUID=xxx" or "LABEL=xxx" into block device name
+-// ("UUID=xxx"/"LABEL=xxx" can probably shifted to fsck.auto duties)
+ devices = xrealloc_vector(devices, 2, num_devices);
+ devices[num_devices++] = arg;
+ continue;
+--
+2.16.2
+
diff --git a/system/busybox/0003-ash-exec-busybox.static.patch b/system/busybox/0003-ash-exec-busybox.static.patch
new file mode 100644
index 000000000..94239a2eb
--- /dev/null
+++ b/system/busybox/0003-ash-exec-busybox.static.patch
@@ -0,0 +1,25 @@
+From 36b6cc36d1f259e4ac76a1c2de743113845ff4cd Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 4 Aug 2016 11:03:07 +0200
+Subject: [PATCH 03/16] ash: exec busybox.static
+
+---
+ shell/ash.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/shell/ash.c b/shell/ash.c
+index 7ceb91920..d04096a9b 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -7845,6 +7845,8 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c
+ }
+ /* 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.16.2
+
diff --git a/system/busybox/0004-app-location-for-cpio-vi-and-lspci.patch b/system/busybox/0004-app-location-for-cpio-vi-and-lspci.patch
new file mode 100644
index 000000000..7f105cb67
--- /dev/null
+++ b/system/busybox/0004-app-location-for-cpio-vi-and-lspci.patch
@@ -0,0 +1,54 @@
+From 9bbc93f12f7cff8fb51a0bf89907d9875f5c14e6 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 27 Dec 2016 20:46:59 +0100
+Subject: [PATCH 04/16] app location for cpio, vi and lspci
+
+Adjust location to where alpine linux installs them
+---
+ archival/cpio.c | 2 +-
+ editors/vi.c | 2 +-
+ util-linux/lspci.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/archival/cpio.c b/archival/cpio.c
+index 1d6cbd1e2..0c14f79e7 100644
+--- a/archival/cpio.c
++++ b/archival/cpio.c
+@@ -39,7 +39,7 @@
+ //config: help
+ //config: Passthrough mode. Rarely used.
+
+-//applet:IF_CPIO(APPLET(cpio, BB_DIR_BIN, BB_SUID_DROP))
++//applet:IF_CPIO(APPLET(cpio, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+ //kbuild:lib-$(CONFIG_CPIO) += cpio.o
+
+diff --git a/editors/vi.c b/editors/vi.c
+index cdfb27cc5..20077727e 100644
+--- a/editors/vi.c
++++ b/editors/vi.c
+@@ -161,7 +161,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/util-linux/lspci.c b/util-linux/lspci.c
+index 0000fbfda..34189d2b5 100644
+--- a/util-linux/lspci.c
++++ b/util-linux/lspci.c
+@@ -16,7 +16,7 @@
+ //config:
+ //config: This version uses sysfs (/sys/bus/pci/devices) only.
+
+-//applet:IF_LSPCI(APPLET_NOEXEC(lspci, lspci, BB_DIR_USR_BIN, BB_SUID_DROP, lspci))
++//applet:IF_LSPCI(APPLET_NOEXEC(lspci, lspci, BB_DIR_USR_SBIN, BB_SUID_DROP, lspci))
+
+ //kbuild:lib-$(CONFIG_LSPCI) += lspci.o
+
+--
+2.16.2
+
diff --git a/system/busybox/0005-udhcpc-set-default-discover-retries-to-5.patch b/system/busybox/0005-udhcpc-set-default-discover-retries-to-5.patch
new file mode 100644
index 000000000..181acdb9a
--- /dev/null
+++ b/system/busybox/0005-udhcpc-set-default-discover-retries-to-5.patch
@@ -0,0 +1,35 @@
+From b67940090709f3bbd868557dd4d5317cb807250d Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 4 Aug 2016 11:08:35 +0200
+Subject: [PATCH 05/16] udhcpc: set default discover retries to 5
+
+Some slower nics needs more attempts to get a lease
+---
+ networking/udhcp/dhcpc.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
+index 55f21c187..cc1d22c8e 100644
+--- a/networking/udhcp/dhcpc.c
++++ b/networking/udhcp/dhcpc.c
+@@ -1203,7 +1203,7 @@ static void client_background(void)
+ //usage: "\n -p FILE Create pidfile"
+ //usage: "\n -B Request broadcast replies"
+ //usage: "\n -t N Send up to N discover packets (default 3)"
+-//usage: "\n -T SEC Pause between packets (default 3)"
++//usage: "\n -T SEC Pause between packets (default 5)"
+ //usage: "\n -A SEC Wait if lease is not obtained (default 20)"
+ //usage: "\n -n Exit if lease is not obtained"
+ //usage: "\n -q Exit after obtaining lease"
+@@ -1247,7 +1247,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.16.2
+
diff --git a/system/busybox/0006-ping-make-ping-work-without-root-privileges.patch b/system/busybox/0006-ping-make-ping-work-without-root-privileges.patch
new file mode 100644
index 000000000..630619b4a
--- /dev/null
+++ b/system/busybox/0006-ping-make-ping-work-without-root-privileges.patch
@@ -0,0 +1,197 @@
+From 21d74f2989d0046e5b7c586f5a052643d5da8dcc Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 29 Mar 2016 18:59:22 +0200
+Subject: [PATCH 06/16] 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 d1d59d545..c0ebc0f9a 100644
+--- a/networking/ping.c
++++ b/networking/ping.c
+@@ -163,6 +163,7 @@ enum {
+ pingsock = 0,
+ };
+
++static int using_dgram;
+ static void
+ #if ENABLE_PING6
+ create_icmp_socket(len_and_sockaddr *lsa)
+@@ -179,9 +180,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);
+@@ -234,10 +249,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_id != G.myid)
+ continue; /* not our ping */
+ if (pkt->icmp_type == ICMP_ECHOREPLY)
+@@ -634,19 +651,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 */
+
+@@ -658,7 +677,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,
+@@ -702,11 +721,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 */
+@@ -723,6 +762,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 ... */
+@@ -756,10 +804,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)) {
+@@ -890,7 +961,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.16.2
+
diff --git a/system/busybox/0007-fbsplash-support-console-switching.patch b/system/busybox/0007-fbsplash-support-console-switching.patch
new file mode 100644
index 000000000..ef226d009
--- /dev/null
+++ b/system/busybox/0007-fbsplash-support-console-switching.patch
@@ -0,0 +1,182 @@
+From 377e2f20c1034de1195fd900fc637821952cfa49 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Mon, 24 Sep 2012 07:58:29 +0300
+Subject: [PATCH 07/16] fbsplash: support console switching
+
+---
+ miscutils/fbsplash.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 75 insertions(+), 7 deletions(-)
+
+diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
+index 5b2e5ac56..bc80f728c 100644
+--- a/miscutils/fbsplash.c
++++ b/miscutils/fbsplash.c
+@@ -47,7 +47,7 @@
+ //kbuild:lib-$(CONFIG_FBSPLASH) += fbsplash.o
+
+ //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"
+@@ -57,11 +57,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 <linux/fb.h>
+
++#include <sys/vt.h>
++#include <sys/ioctl.h>
++#include <linux/tiocl.h>
++#include <linux/kd.h>
++
+ /* If you want logging messages on /tmp/fbsplash.log... */
+ #define DEBUG 0
+
+@@ -75,6 +81,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;
+@@ -485,6 +493,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)
+@@ -494,6 +507,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();
+
+@@ -501,8 +517,9 @@ 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);
++ 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)
+@@ -512,11 +529,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, ESC"[?25l", 6);
++ full_write(G.fd_tty_s, ESC"[?25l", 6);
+ }
+
+ fb_drawimage();
+@@ -524,6 +573,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:
+@@ -539,8 +589,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 <stdio.h> style I/O allows to correctly
+ // handle a case when we have many buffered lines
+@@ -555,12 +606,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, ESC"[?25h", 6);
+
+ return EXIT_SUCCESS;
+--
+2.16.2
+
diff --git a/system/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch b/system/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
new file mode 100644
index 000000000..b0cb5cc3d
--- /dev/null
+++ b/system/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
@@ -0,0 +1,181 @@
+From 97fcb49bfbe74fa17a52e63b2196d8a5c3b27d93 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Fri, 21 Nov 2014 16:06:34 +0200
+Subject: [PATCH 08/16] fbsplash: support image and bar alignment and
+ positioning
+
+---
+ miscutils/fbsplash.c | 91 +++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 76 insertions(+), 15 deletions(-)
+
+diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
+index bc80f728c..9089131b8 100644
+--- a/miscutils/fbsplash.c
++++ b/miscutils/fbsplash.c
+@@ -53,6 +53,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)"
+@@ -73,13 +74,38 @@
+
+ #define ESC "\033"
+
++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;
+@@ -96,14 +122,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) { \
+@@ -384,7 +402,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;
+@@ -434,18 +452,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);
+@@ -464,9 +510,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"
+@@ -476,14 +530,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.16.2
+
diff --git a/system/busybox/0009-depmod-support-generating-kmod-binary-index-files.patch b/system/busybox/0009-depmod-support-generating-kmod-binary-index-files.patch
new file mode 100644
index 000000000..2034f5c88
--- /dev/null
+++ b/system/busybox/0009-depmod-support-generating-kmod-binary-index-files.patch
@@ -0,0 +1,510 @@
+From d13cb44f10d730eeac83340f71ea95b6faa0c142 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Sun, 25 Oct 2015 22:21:41 +0200
+Subject: [PATCH 09/16] depmod: support generating kmod binary index files
+
+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.
+---
+ modutils/Config.src | 9 ++
+ modutils/depmod.c | 281 ++++++++++++++++++++++++++++++++++++++++++----------
+ modutils/modprobe.c | 15 ---
+ modutils/modutils.c | 31 ++++++
+ modutils/modutils.h | 16 +++
+ 5 files changed, 286 insertions(+), 66 deletions(-)
+
+diff --git a/modutils/Config.src b/modutils/Config.src
+index e413702bb..1be7434a5 100644
+--- a/modutils/Config.src
++++ b/modutils/Config.src
+@@ -152,6 +152,15 @@ 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
++ 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 module.symbols file"
+ default y
+diff --git a/modutils/depmod.c b/modutils/depmod.c
+index 004c67a11..05c1a9bce 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 <timo.teras@iki.fi>
++ * Copyrihgt (c) 2008-2015 Timo Teras <timo.teras@iki.fi>
+ * Copyright (c) 2008 Vladimir Dronnikov
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+@@ -26,6 +26,24 @@
+ #include "modutils.h"
+ #include <sys/utsname.h> /* 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
+@@ -53,18 +71,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_")
+ ) {
+@@ -74,9 +86,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);
+
+@@ -108,12 +121,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"
+@@ -167,6 +174,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)
+ {
+@@ -178,6 +348,8 @@ int depmod_main(int argc UNUSED_PARAM, char **argv)
+ unsigned i;
+ int tmp;
+
++ INIT_G();
++
+ getopt32(argv, "aAb:eF:nruqC:", &moddir_base, NULL, NULL);
+ argv += optind;
+
+@@ -210,53 +382,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, "");
+ }
+-
+-#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);
++ index_dump(CONFIG_DEFAULT_DEPMOD_FILE, 1);
++
++ 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 59f6d54f3..0a398a60f 100644
+--- a/modutils/modprobe.c
++++ b/modutils/modprobe.c
+@@ -192,21 +192,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 6f7cd9721..257089af4 100644
+--- a/modutils/modutils.c
++++ b/modutils/modutils.c
+@@ -66,6 +66,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) {
+@@ -75,6 +90,22 @@ void FAST_FUNC replace(char *s, char what, char with)
+ }
+ }
+
++char* FAST_FUNC replace_underscores(char *s)
++{
++ int i;
++ for (i = 0; s[i]; i++) {
++ switch (s[i]) {
++ case '-':
++ s[i] = '_';
++ break;
++ case '[':
++ i += strcspn(&s[i], "]");
++ break;
++ }
++ }
++ return s;
++}
++
+ int FAST_FUNC string_to_llist(char *string, llist_t **llist, const char *delim)
+ {
+ char *tok;
+diff --git a/modutils/modutils.h b/modutils/modutils.h
+index 4a702e97c..73e816028 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,7 +61,9 @@ 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;
+ char *filename2modname(const char *filename, char *modname) FAST_FUNC;
+ #if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS
+--
+2.16.2
+
diff --git a/system/busybox/0010-Add-flag-for-not-following-symlinks-when-recursing.patch b/system/busybox/0010-Add-flag-for-not-following-symlinks-when-recursing.patch
new file mode 100644
index 000000000..a45c46d09
--- /dev/null
+++ b/system/busybox/0010-Add-flag-for-not-following-symlinks-when-recursing.patch
@@ -0,0 +1,59 @@
+From 1c8c2316f98c2e4894c4c1686f0aa7937fcc0a17 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Fri, 25 Jul 2014 15:28:33 +0200
+Subject: [PATCH 10/16] 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
+---
+ editors/diff.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/editors/diff.c b/editors/diff.c
+index 1462a9b18..2c899578e 100644
+--- a/editors/diff.c
++++ b/editors/diff.c
+@@ -113,6 +113,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"
+@@ -154,6 +157,7 @@ enum { /* Commandline flags */
+ FLAG_p, /* not implemented */
+ FLAG_B,
+ FLAG_E, /* not implemented */
++ FLAG_no_deref,
+ };
+ #define FLAG(x) (1 << FLAG_##x)
+
+@@ -867,7 +871,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.
+@@ -964,6 +969,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"
+ ;
+ # define GETOPT32 getopt32long
+ # define LONGOPTS ,diff_longopts
+--
+2.16.2
+
diff --git a/system/busybox/0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch b/system/busybox/0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch
new file mode 100644
index 000000000..b4ba240c4
--- /dev/null
+++ b/system/busybox/0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch
@@ -0,0 +1,104 @@
+From 889a08dc0ae0d6b76692e6ed811f431c5b5db53c Mon Sep 17 00:00:00 2001
+From: Shiz <hi@shiz.me>
+Date: Mon, 8 May 2017 23:09:13 +0200
+Subject: [PATCH 11/16] sysklogd: add -Z option to adjust message timezones
+
+Some syslog() implementations like musl's[1] always send timestamps in UTC.
+This change adds a new option to syslogd, -Z, to assume incoming timestamps
+are always UTC and adjust them to the local timezone (of the syslogd) before
+logging.
+
+[1]: http://www.openwall.com/lists/musl/2014/01/29/1
+
+Signed-off-by: Shiz <hi@shiz.me>
+---
+ sysklogd/syslogd.c | 23 +++++++++++++++++++----
+ 1 file changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
+index 4265f4f90..eca955891 100644
+--- a/sysklogd/syslogd.c
++++ b/sysklogd/syslogd.c
+@@ -122,6 +122,7 @@
+ //usage: "(this version of syslogd ignores /etc/syslog.conf)\n"
+ //usage: )
+ //usage: "\n -n Run in foreground"
++//usage: "\n -Z Adjust incoming UTC times to local time"
+ //usage: IF_FEATURE_REMOTE_LOG(
+ //usage: "\n -R HOST[:PORT] Log to HOST:PORT (default PORT:514)"
+ //usage: "\n -L Log locally and via network (default is network only if -R)"
+@@ -233,6 +234,8 @@ typedef struct logRule_t {
+ /*int markInterval;*/ \
+ /* level of messages to be logged */ \
+ int logLevel; \
++ /* whether to adjust message timezone */\
++ int adjustTimezone; \
+ IF_FEATURE_ROTATE_LOGFILE( \
+ /* max size of file before rotation */ \
+ unsigned logFileSize; \
+@@ -316,6 +319,7 @@ enum {
+ OPTBIT_outfile, // -O
+ OPTBIT_loglevel, // -l
+ OPTBIT_small, // -S
++ OPTBIT_adjusttz, // -Z
+ IF_FEATURE_ROTATE_LOGFILE(OPTBIT_filesize ,) // -s
+ IF_FEATURE_ROTATE_LOGFILE(OPTBIT_rotatecnt ,) // -b
+ IF_FEATURE_REMOTE_LOG( OPTBIT_remotelog ,) // -R
+@@ -330,6 +334,7 @@ enum {
+ OPT_outfile = 1 << OPTBIT_outfile ,
+ OPT_loglevel = 1 << OPTBIT_loglevel,
+ OPT_small = 1 << OPTBIT_small ,
++ OPT_adjusttz = 1 << OPTBIT_adjusttz,
+ OPT_filesize = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_filesize )) + 0,
+ OPT_rotatecnt = IF_FEATURE_ROTATE_LOGFILE((1 << OPTBIT_rotatecnt )) + 0,
+ OPT_remotelog = IF_FEATURE_REMOTE_LOG( (1 << OPTBIT_remotelog )) + 0,
+@@ -339,7 +344,7 @@ enum {
+ OPT_cfg = IF_FEATURE_SYSLOGD_CFG( (1 << OPTBIT_cfg )) + 0,
+ OPT_kmsg = IF_FEATURE_KMSG_SYSLOG( (1 << OPTBIT_kmsg )) + 0,
+ };
+-#define OPTION_STR "m:nO:l:S" \
++#define OPTION_STR "m:nO:l:SZ" \
+ IF_FEATURE_ROTATE_LOGFILE("s:" ) \
+ IF_FEATURE_ROTATE_LOGFILE("b:" ) \
+ IF_FEATURE_REMOTE_LOG( "R:*") \
+@@ -815,17 +820,23 @@ static void timestamp_and_log(int pri, char *msg, int len)
+ {
+ char *timestamp;
+ time_t now;
++ struct tm nowtm = { .tm_isdst = 0 };
+
+ /* Jan 18 00:11:22 msg... */
+ /* 01234567890123456 */
+ if (len < 16 || msg[3] != ' ' || msg[6] != ' '
+ || msg[9] != ':' || msg[12] != ':' || msg[15] != ' '
+ ) {
+- time(&now);
++ now = time(NULL);
+ timestamp = ctime(&now) + 4; /* skip day of week */
+ } else {
+- now = 0;
+- timestamp = msg;
++ if (G.adjustTimezone && strptime(msg, "%b %e %T", &nowtm)) {
++ now = mktime(&nowtm) - timezone;
++ timestamp = ctime(&now) + 4; /* skip day of week */
++ } else {
++ now = 0;
++ timestamp = msg;
++ }
+ msg += 16;
+ }
+ timestamp[15] = '\0';
+@@ -1129,6 +1140,10 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
+ if (opts & OPT_loglevel) // -l
+ G.logLevel = xatou_range(opt_l, 1, 8);
+ //if (opts & OPT_small) // -S
++ if (opts & OPT_adjusttz) { // -Z
++ G.adjustTimezone = 1;
++ tzset();
++ }
+ #if ENABLE_FEATURE_ROTATE_LOGFILE
+ if (opts & OPT_filesize) // -s
+ G.logFileSize = xatou_range(opt_s, 0, INT_MAX/1024) * 1024;
+--
+2.16.2
+
diff --git a/system/busybox/0012-udhcpc-Don-t-background-if-n-is-given.patch b/system/busybox/0012-udhcpc-Don-t-background-if-n-is-given.patch
new file mode 100644
index 000000000..50719b003
--- /dev/null
+++ b/system/busybox/0012-udhcpc-Don-t-background-if-n-is-given.patch
@@ -0,0 +1,45 @@
+From 7f3d0620051c30e2047593092aa054565756b57f Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 6 Jul 2017 13:39:15 +0200
+Subject: [PATCH 12/16] udhcpc: Don't background if -n is given
+
+we need add -b to our udhcpc options to prevent boot forever if there are no
+dhcp server. We also need a way for users to disable this behavior by making
+it possible to set -n option at runtime.
+---
+ networking/udhcp/dhcpc.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
+index cc1d22c8e..10b846b0a 100644
+--- a/networking/udhcp/dhcpc.c
++++ b/networking/udhcp/dhcpc.c
+@@ -1479,19 +1479,19 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
+ }
+ leasefail:
+ udhcp_run_script(NULL, "leasefail");
++ if (opt & OPT_n) { /* abort if no lease */
++ bb_error_msg("no lease, failing");
++ retval = 1;
++ goto ret;
++ }
+ #if BB_MMU /* -b is not supported on NOMMU */
+ if (opt & OPT_b) { /* background if no lease */
+ bb_error_msg("no lease, forking to background");
+ client_background();
+ /* do not background again! */
+ opt = ((opt & ~OPT_b) | OPT_f);
+- } else
+-#endif
+- if (opt & OPT_n) { /* abort if no lease */
+- bb_error_msg("no lease, failing");
+- retval = 1;
+- goto ret;
+ }
++#endif
+ /* wait before trying again */
+ timeout = tryagain_timeout;
+ packet_num = 0;
+--
+2.16.2
+
diff --git a/system/busybox/0013-testsuite-fix-cpio-tests.patch b/system/busybox/0013-testsuite-fix-cpio-tests.patch
new file mode 100644
index 000000000..a9ba0c4d0
--- /dev/null
+++ b/system/busybox/0013-testsuite-fix-cpio-tests.patch
@@ -0,0 +1,82 @@
+From 495a53387a12bffe393dcd0d6de2bc64374d38d2 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 6 Jul 2017 13:41:32 +0200
+Subject: [PATCH 13/16] testsuite: fix cpio tests
+
+The cpio tests don't search for the right output line correctly,
+using a hardcoded tail offset. Instead, grep for the file entry
+just added.
+
+The reverse-hunk patch tests seem to get the output order wrong,
+and the tests pass when this is corrected.
+---
+ testsuite/cpio.tests | 6 +++---
+ testsuite/patch.tests | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
+index 88ec086b6..40f72c363 100755
+--- a/testsuite/cpio.tests
++++ b/testsuite/cpio.tests
+@@ -129,7 +129,7 @@ SKIP=
+
+ optional FEATURE_CPIO_O
+ testing "cpio uses by default uid/gid" \
+-"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
++"echo $0 | cpio -o -H newc | cpio -tv 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
+ "\
+ $user/$group
+ 0
+@@ -138,7 +138,7 @@ SKIP=
+
+ optional FEATURE_CPIO_O
+ testing "cpio -R with create" \
+-"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
++"echo $0 | cpio -o -H newc -R 1234:5678 | cpio -tv 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
+ "\
+ 1234/5678
+ 0
+@@ -147,7 +147,7 @@ SKIP=
+
+ optional FEATURE_CPIO_O
+ testing "cpio -R with extract" \
+-"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | tail -n +2 | awk ' { print \$2 } '; echo \$?" \
++"echo $0 | cpio -o -H newc | cpio -tv -R 8765:4321 2>&1 | grep -F $(basename $0) | awk ' { print \$2 } '; echo \$?" \
+ "\
+ 8765/4321
+ 0
+diff --git a/testsuite/patch.tests b/testsuite/patch.tests
+index 39205242c..1d48e90be 100755
+--- a/testsuite/patch.tests
++++ b/testsuite/patch.tests
+@@ -75,12 +75,12 @@ zxc
+ testing "patch detects already applied hunk" \
+ 'patch 2>&1; echo $?; cat input' \
+ "\
++patching file input
+ Possibly reversed hunk 1 at 4
+ Hunk 1 FAILED 1/1.
+ abc
+ +def
+ 123
+-patching file input
+ 1
+ abc
+ def
+@@ -103,12 +103,12 @@ def
+ testing "patch detects already applied hunk at the EOF" \
+ 'patch 2>&1; echo $?; cat input' \
+ "\
++patching file input
+ Possibly reversed hunk 1 at 4
+ Hunk 1 FAILED 1/1.
+ abc
+ 123
+ +456
+-patching file input
+ 1
+ abc
+ 123
+--
+2.16.2
+
diff --git a/system/busybox/0014-miscutils-microcom-Fixed-segfault.patch b/system/busybox/0014-miscutils-microcom-Fixed-segfault.patch
new file mode 100644
index 000000000..59114460a
--- /dev/null
+++ b/system/busybox/0014-miscutils-microcom-Fixed-segfault.patch
@@ -0,0 +1,31 @@
+From 2881266313824ed1c2d422ea905e25509f9bc924 Mon Sep 17 00:00:00 2001
+From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+Date: Wed, 2 Aug 2017 23:36:08 +0200
+Subject: [PATCH 14/16] miscutils/microcom: Fixed segfault
+
+microcom did not check if required parameter TTY is present. Thus,
+bb_basename() was called with a NULL pointer if TTY was missing.
+This commit adds the missing check.
+---
+ miscutils/microcom.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/miscutils/microcom.c b/miscutils/microcom.c
+index fa090057e..96ea02b16 100644
+--- a/miscutils/microcom.c
++++ b/miscutils/microcom.c
+@@ -76,6 +76,11 @@ int microcom_main(int argc UNUSED_PARAM, char **argv)
+ // argc -= optind;
+ argv += optind;
+
++ if (*argv == NULL){
++ bb_show_usage();
++ return EXIT_FAILURE;
++ }
++
+ // try to create lock file in /var/lock
+ device_lock_file = (char *)bb_basename(argv[0]);
+ device_lock_file = xasprintf("/var/lock/LCK..%s", device_lock_file);
+--
+2.16.2
+
diff --git a/system/busybox/0015-ash-introduce-a-config-option-to-search-current-dire.patch b/system/busybox/0015-ash-introduce-a-config-option-to-search-current-dire.patch
new file mode 100644
index 000000000..9fc6f7e68
--- /dev/null
+++ b/system/busybox/0015-ash-introduce-a-config-option-to-search-current-dire.patch
@@ -0,0 +1,47 @@
+From 13c7e0cc7767b84e183ddbc3400171874478bf06 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Fri, 26 Jan 2018 15:15:43 +0100
+Subject: [PATCH 15/16] ash: introduce a config option to search current
+ directory for sourced files
+
+---
+ shell/ash.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/shell/ash.c b/shell/ash.c
+index d04096a9b..5dd184360 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -132,6 +132,13 @@
+ //config: you to run the specified command or builtin,
+ //config: even when there is a function with the same name.
+ //config:
++//config:config ASH_BASH_SOURCE_CURDIR
++//config: bool "'source' and '.' builtins search current directory after $PATH"
++//config: default n # do not encourage non-standard behavior
++//config: depends ASH_BASH_COMPAT
++//config: help
++//config: This is not compliant with standards. Avoid if possible.
++//config:
+ //config:config ASH_COMMAND_NOT_FOUND_HOOK
+ //config: bool "command_not_found_handle hook support"
+ //config: default y
+@@ -12919,10 +12926,14 @@ find_dot_file(char *name)
+ if (fullname != name)
+ stunalloc(fullname);
+ }
++ /* not found in PATH */
+
+- /* not found in the PATH */
++#if ENABLE_ASH_BASH_SOURCE_CURDIR
++ return name;
++#else
+ ash_msg_and_raise_error("%s: not found", name);
+ /* NOTREACHED */
++#endif
+ }
+
+ static int FAST_FUNC
+--
+2.16.2
+
diff --git a/system/busybox/0016-top-handle-much-larger-VSZ-values.patch b/system/busybox/0016-top-handle-much-larger-VSZ-values.patch
new file mode 100644
index 000000000..c8013403f
--- /dev/null
+++ b/system/busybox/0016-top-handle-much-larger-VSZ-values.patch
@@ -0,0 +1,61 @@
+From 9d37e0e491d53e71c2e3ede1e002790e1026b9c6 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Wed, 7 Mar 2018 03:59:52 +0100
+Subject: [PATCH 16/16] top: handle much larger VSZ values
+
+function old new delta
+display_process_list 1018 999 -19
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ procps/top.c | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/procps/top.c b/procps/top.c
+index b777c494e..9bb3eed29 100644
+--- a/procps/top.c
++++ b/procps/top.c
+@@ -607,7 +607,6 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
+ };
+
+ top_status_t *s;
+- char vsz_str_buf[8];
+ unsigned long total_memory = display_header(scr_width, &lines_rem); /* or use total_vsz? */
+ /* xxx_shift and xxx_scale variables allow us to replace
+ * expensive divides with multiply and shift */
+@@ -688,19 +687,18 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
+ lines_rem = ntop - G_scroll_ofs;
+ s = top + G_scroll_ofs;
+ while (--lines_rem >= 0) {
++ char vsz_str_buf[8];
+ unsigned col;
++
+ CALC_STAT(pmem, (s->vsz*pmem_scale + pmem_half) >> pmem_shift);
+ #if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
+ CALC_STAT(pcpu, (s->pcpu*pcpu_scale + pcpu_half) >> pcpu_shift);
+ #endif
+
+- if (s->vsz >= 100000)
+- sprintf(vsz_str_buf, "%6ldm", s->vsz/1024);
+- else
+- sprintf(vsz_str_buf, "%7lu", s->vsz);
++ smart_ulltoa5(s->vsz, vsz_str_buf, " mgtpezy");
+ /* PID PPID USER STAT VSZ %VSZ [%CPU] COMMAND */
+ col = snprintf(line_buf, scr_width,
+- "\n" "%5u%6u %-8.8s %s%s" FMT
++ "\n" "%5u%6u %-8.8s %s %.5s" FMT
+ IF_FEATURE_TOP_SMP_PROCESS(" %3d")
+ IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(FMT)
+ " ",
+@@ -710,7 +708,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
+ IF_FEATURE_TOP_SMP_PROCESS(, s->last_seen_on_cpu)
+ IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(, SHOW_STAT(pcpu))
+ );
+- if ((int)(col + 1) < scr_width)
++ if ((int)(scr_width - col) > 1)
+ read_cmdline(line_buf + col, scr_width - col, s->pid, s->comm);
+ fputs(line_buf, stdout);
+ /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
+--
+2.16.2
+
diff --git a/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch b/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
new file mode 100644
index 000000000..bdf24b783
--- /dev/null
+++ b/system/busybox/0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
@@ -0,0 +1,45 @@
+From 444a2f6be54186ae9ade1f2c3d4356cd62a720c5 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Fri, 23 Mar 2018 14:56:52 +0200
+Subject: [PATCH] ifupdown: do not fail if interface disappears during ifdown
+
+Interface may not exist because it got deleted by an ifdown hook script
+earlier. This may happen when a virtual interface, such as VLAN, has multiple
+iface blocks defined.
+
+Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+---
+ networking/ifupdown.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/networking/ifupdown.c b/networking/ifupdown.c
+index 534c9f0c7..35d13c5e1 100644
+--- a/networking/ifupdown.c
++++ b/networking/ifupdown.c
+@@ -141,6 +141,7 @@
+ #include "libbb.h"
+ #include "common_bufsiz.h"
+ /* After libbb.h, since it needs sys/types.h on some systems */
++#include <net/if.h>
+ #include <sys/utsname.h>
+ #include <fnmatch.h>
+
+@@ -503,6 +504,7 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec)
+
+ static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec)
+ {
++ if (!if_nametoindex(ifd->iface)) return 1;
+ # if ENABLE_FEATURE_IFUPDOWN_IP
+ return execute("ip link set %iface% down", ifd, exec);
+ # else
+@@ -598,6 +600,7 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
+ static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec)
+ {
+ int result;
++ if (!if_nametoindex(ifd->iface)) return 2;
+ # if ENABLE_FEATURE_IFUPDOWN_IP
+ /* Optional "label LBL" is necessary if interface is an alias (eth0:0),
+ * otherwise "ip addr flush dev eth0:0" flushes all addresses on eth0.
+--
+2.14.3
+
diff --git a/system/busybox/APKBUILD b/system/busybox/APKBUILD
index b88335306..f48d446d2 100644
--- a/system/busybox/APKBUILD
+++ b/system/busybox/APKBUILD
@@ -1,40 +1,45 @@
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Oliver Smith <ollieparanoid@bitmessage.ch>
-# Maintainer:
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
-pkgver=1.27.2
-pkgrel=5
+pkgver=1.28.4
+pkgrel=0
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
-options="suid !check" # Test suite?
-license="GPL-2.0-only"
-makedepends_build=""
+license="GPL-2.0-only GPL-2.0+"
+makedepends_build="openssl-dev"
makedepends_host="linux-headers"
makedepends="$makedepends_build $makedepends_host"
checkdepends="zip"
-provides="/sbin/init"
-install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall
+provides="/bin/sh"
+install="$pkgname.post-install $pkgname.post-upgrade
$pkgname-extras.post-install $pkgname-extras.pre-deinstall"
-subpackages="$pkgname-static $pkgname-suid $pkgname-extras $pkgname-binsh"
+subpackages="$pkgname-static $pkgname-suid $pkgname-extras"
+options="suid !check"
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
-
- 0001-ash-exec-busybox.static.patch
- 0002-app-location-for-cpio-vi-and-lspci.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-diff-add-support-for-no-dereference.patch
- 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch
- 0010-udhcpc-Don-t-background-if-n-is-given.patch
- 0011-testsuite-fix-cpio-tests.patch
- 0012-microcom-segfault.patch
-
- top-buffer-overflow.patch
+ 0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
+ 0003-ash-exec-busybox.static.patch
+ 0004-app-location-for-cpio-vi-and-lspci.patch
+ 0005-udhcpc-set-default-discover-retries-to-5.patch
+ 0006-ping-make-ping-work-without-root-privileges.patch
+ 0007-fbsplash-support-console-switching.patch
+ 0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
+ 0009-depmod-support-generating-kmod-binary-index-files.patch
+ 0010-Add-flag-for-not-following-symlinks-when-recursing.patch
+ 0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch
+ 0012-udhcpc-Don-t-background-if-n-is-given.patch
+ 0013-testsuite-fix-cpio-tests.patch
+ 0014-miscutils-microcom-Fixed-segfault.patch
+ 0015-ash-introduce-a-config-option-to-search-current-dire.patch
+ 0016-top-handle-much-larger-VSZ-values.patch
+ 0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
+
+ 0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch
+
+ 0001-wget-emit-a-message-that-certificate-verification-is.patch
acpid.logrotate
busyboxconfig
@@ -44,6 +49,14 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
nologin.c
"
+# secfixes:
+# 1.27.2-r4:
+# - CVE-2017-16544
+# - CVE-2017-15873
+# - CVE-2017-15874
+
+builddir="$srcdir"/$pkgname-$pkgver
+
_staticdir="$srcdir"/build-static
_dyndir="$srcdir"/build-dynamic
_dyndir_extras="$srcdir"/build-dynamic-extras
@@ -87,8 +100,10 @@ build() {
# build static
cd "$_staticdir"
msg "Building static busybox"
+ # enable internal ssl_client for static build
sed -e "s/.*CONFIG_PIE.*/\# CONFIG_PIE is not set/" \
-e "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" \
+ -e "s/.*CONFIG_SSL_CLIENT.*/CONFIG_SSL_CLIENT=y/" \
"$_config" > .config
# musl does not support GNU regex
[ "$CLIBC" = musl ] && sed -i \
@@ -163,16 +178,6 @@ suid() {
install -m4111 bbsuid "$subpkgdir"/bin/bbsuid
}
-binsh() {
- pkgdesc="Provide /bin/sh with BusyBox ash"
- depends="${pkgname}"
- provides="/bin/sh"
- provider_priority=0
-
- mkdir -p "$subpkgdir"/bin
- mv "$pkgdir"/bin/sh "$subpkgdir"/bin
-}
-
static() {
pkgdesc="Statically linked Busybox"
mkdir -p "$subpkgdir"/bin
@@ -180,24 +185,29 @@ static() {
"$subpkgdir"/bin/busybox.static
}
-sha512sums="d99e86b652562ebe1a5d50e1ba3877a1d1612997c17cb8d8e4212da181211a9b741a881cb051f14cb3ee8aea40226cf2cde80a076baed265d3bc0a4e96a5031c busybox-1.27.2.tar.bz2
-dc08288c8e9e29d36be7174d58f3bee2d0508465977fb40d39807aa0b03149f7814f8cfed113d0a7589ef49890beb1805ef00f0d37b563447fe875e3cff08d1c 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
-1930775839354a63c30970f0d52d00cfd3a8f6b9f48d6de45ea7d2478d080bde7193c1c2cce026dc7337d9ecf0b65f5ff1dd4351c1eb195e6f0c0c5126f10511 0001-ash-exec-busybox.static.patch
-a756aa89c4602cd091df0052e2e3d7b45a359fbfe953b70aa3029e3eeb8e5d1772cbf1525bb62df6ce6547f1e5605617195ddae336e1ffe41f5c58d524af6ba6 0002-app-location-for-cpio-vi-and-lspci.patch
-fc17ce9b12726e3449518692bf0d4906c36f091534706b5b91c910866bd8cd50d8f7d4b449d54eeed24ee656012a6ef04612bf092874e4b83b0723f852fdce0e 0003-udhcpc-set-default-discover-retries-to-5.patch
-dc0b660b60ef3028a4cc86f712e7f6d08ad7c00d27056f9978a2a103434f45edc7385d2c48eca5ee83efab8fc81735674bf1c40e78fb07a1b5d07ca9da37811a 0004-ping-make-ping-work-without-root-privileges.patch
-63838512679586eb6d83e7b7d3b1e318bb693b91dfb9675a48480e6623e03472b1aa7f86fb7e2ab9e8d6db7a9609b2bcf1c3c1de64fc7d73b65b4794cab87cbf 0005-fbsplash-support-console-switching.patch
-1afe261da507ca13869923033a4adbb3c22e512136cc4b771a2d14d0c25d8de6514cec1dd0363b0684410f0e6a274c3250c1ca8a8a839111f3ed16f800b1d403 0006-fbsplash-support-image-and-bar-alignment-and-positio.patch
-16804d38000bf4395ed2657c19ddf0a1414214db8d2e43541034d5a6db29f74c53c6d8fd28c4c865c7e87fa4a9b914d414e5a00430a261aeaa69ec86bf865780 0007-depmod-support-generating-kmod-binary-index-files.patch
-baac796f8aa96fbeab19f96eea7787ace5737b182f49e02f1b1e911d0a927ae14f3c334daad4241858617dc79607541b9ce66b367d0379b2cb32f67a1e9efc5b 0008-diff-add-support-for-no-dereference.patch
-d1c375184f806f7550bac5c82ab5471bdb8085d845172c973724b22af05ab3759b3ce982e088b4c45815ade56b9adfb7a677d0c180e077545ac7ec003c8aa7c4 0009-sysklogd-add-Z-option-to-adjust-message-timezones.patch
-9b5143d0be615b1604d82007628d59a62721f1e61a63cca7a4ffa5e60fa8da102bfc21fa20cc35c2f5a0a24bc8013598f8eff5888f9d0f3bcfa796343b5f5a91 0010-udhcpc-Don-t-background-if-n-is-given.patch
-f4e00eb13fda752df13f300a7ed9b1320ca9f573c4309247f292c8710464d7be8740148f42e4aff16312335eadabce5a629dce4af58334b9199faf2fd658e4f9 0011-testsuite-fix-cpio-tests.patch
-a09a64b3bce8048c58a68dcd2dd9e63c911009c06195d6bb4e5aecfb5700e479c25b34635c60899127975fae32275ad51846ee75f840d612e00668ce9aba8322 0012-microcom-segfault.patch
-524e858b52cb31fb8d24e8c7f18606fff349aeab6a14da9cca3902641f6127980daed73c53586c6e8b41eecda06cdb29c40ff1dde2dc82a318c2649680458921 top-buffer-overflow.patch
+sha512sums="92471617fcf3c1e28b468f3de2c83a1041f5ba5106580cc791e9c4cd602b7ccffabc51ce0807881ed734a89c3089113048265d6659a4d595528bd9150288d2ed busybox-1.28.4.tar.bz2
+51d4d58baff825a51d476bd4594cb8980ec2aa4d0c864a0eec39ccbbadd1ae9f1cd1b20f492a735ffcdf7c925573594f3c4363b0561c8aa7b91ef534bfc7b2e0 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
+5d2fd3e521ee29d970f377363e3a3144eaf9f7714bc57494d743ded9e39c1ad93ea8759b2febd9c3786968b41e61b8d01ce2361aa997df177b644d63718470ba 0002-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
+cc5e5ce7a822ef51eb6b8065e1b802bc9d690857b8123cb4decf51b09c4ef655784401a68dd26e0a681fbb64bd2c0fed4001be6e33cac9049e516587ea53c17d 0003-ash-exec-busybox.static.patch
+5f0611d21d1dc106d43ba23234babd41a2167d7032f3b09e825ae3dc9f9aaeb8d1882f59341daff99adecdfb8ba52a5c9fb423c8df3168b2e2304c5bd0ac4991 0004-app-location-for-cpio-vi-and-lspci.patch
+bd4bb1f29f0287aa2ae4e43d791072802ba4f8863ea968612410a2819f7afaec5c0c731b4d91f360461ebfe26942f21e9ff69cbd5fb7d9800e62ef59fe954ab2 0005-udhcpc-set-default-discover-retries-to-5.patch
+f03f852b97f3875d3051b225e6ffe52ed02ae8a8550287b3e09c2ef4d63914e1ab045ba5e2bc2dc2f3c8bf643485de4ebb36b97c74a8a6e49b6ba0261f2ddb94 0006-ping-make-ping-work-without-root-privileges.patch
+a7b4ddb838f51e86040246e11a4b0df7bce37ed5159634bd2a8f388cf57be0551e6e63887b71b530a8a7b86dbdda6bbb3a090173f040050ea864b5f07674395d 0007-fbsplash-support-console-switching.patch
+f8655833f71715629a4a93997939ca295cacb35f17843a36cb6fda285213bdbd258b2f84e321f81859491971412a520f697748ebd6fb46808f830f4ccfa77af4 0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
+f69031d048aa5e087cb6597ad2f7b39b520a5ef3713731e9090c5b65680cd7075bdf3a9443725fac49dce4345bc3345dc702b95d618d45a6d3be8682844784f4 0009-depmod-support-generating-kmod-binary-index-files.patch
+b558f3ceb63e39545c3219796da64a7962bb53515a4eedea2bf9d81057774096b429145f0cd98da2542e3bdadaf92fb11d710fb1879768c9980bf58ccd104b6e 0010-Add-flag-for-not-following-symlinks-when-recursing.patch
+f81d7966133d40a5d79cab4a4edf695bf7cc1f06cf2382c4ed99eea3a72cd222fe36c7b92e427262f67a81fcc2e7f6bff5986b32362c38da3c5163a49fd1ecab 0011-sysklogd-add-Z-option-to-adjust-message-timezones.patch
+a96aa81d2f0104b5c28f02e80b3f77dbce77af93c174c09015a34850474d69e42c160fc8061c62f03465b6f793ead109dde7b0cc367d1e87694805d823f19d7e 0012-udhcpc-Don-t-background-if-n-is-given.patch
+40c125a2ba19bcfaec46084bef98acb775a7f2521d854df41411afcfbc3025a1bdd029b0baf74550923db2541c23c1e9df5d5ded799d1d46dd7cf86a495e4c57 0013-testsuite-fix-cpio-tests.patch
+4cbd38a3c2730ae38e34c5973bb63e40609c32f700d4943cc0e922394e8ee522d1512eb19c7885f5cee49834ab22b2594cb07164cacffefa39964a3b863f4e50 0014-miscutils-microcom-Fixed-segfault.patch
+832eb44c52d2caad4bf6ea79fb17f10c116de3e90ed79038dabe3736d8e74507d1e0cb6f4f7689b4dd506b92437d8df7862038fc0213ecda259e40baf9d9b3de 0015-ash-introduce-a-config-option-to-search-current-dire.patch
+185f11578dc3c3637f1acd1285c71b9e31f4244c57cd85b0848912c085a7a8c833d4c935ab1cadcb9852cf3185c7ffb08db8ea728fb19ab6e6fa90d89f13c75b 0016-top-handle-much-larger-VSZ-values.patch
+d90d6b3406760fe3df6dbed46a0f4d1c02a69d5184ebc86d8c1692bc4576532127283ba3ff9a81e64f3660c279b8ee324dac7a426350873c45957067648651c6 0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch
+0dbe3ee424c0a6e4aba4f551f6b6b9ee087655a03747a40906961b141d40b1cbb2345438f17887a1b78d880cb3a7ad0116936dd7c05e95160febfd299423e83b 0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch
+90f9e95f6f953df2cf579f701b3135bad910f514e94b3e23b953acec12b10f33aa9200169dc7b454c6a04fbd992a370e6ca835406f9b5495951e0a8416137000 0001-wget-emit-a-message-that-certificate-verification-is.patch
a9b1403c844c51934637215307dd9e2adb9458921047acff0d86dcf229b6e0027f4b2c6cdaa25a58407aad9d098fb5685d58eb5ff8d2aa3de4912cdea21fe54c acpid.logrotate
-02102f0764ffbec86e97ccab99b3a1e55ffa5b25aa2cdc1fe270d5b575610bdb50568574c7cbd05aba91b13151f84f536b44320c180051cbd77cf258e4fc89a4 busyboxconfig
-7759d1611ce72f7aa9e4afbd48f410806b3bd59701fe8a570675898c504c0e15f85bacbc1578f87345197844ee6175117d348acc4fe29a742b7ac96b84fe7386 busyboxconfig-extras
-e84087a453f8c9814951c9ad496cce19f8280b80a8ab6a1c8e21385f1facb17e987adc8d1d72c7cb463c04eb0cadd2bd6fb9b6f6c0067ddd21eeacf91ca42f32 bbsuid.c
+d65dc165488a179ab19482ad74e350df9dfdccf2363b26424d2d145e27ab0819cd0cfdfb79b4a2bd0bd7c6eda3b95ea61f3c264357986e78c4675df94d487aec busyboxconfig
+0efbe22e2fd56993d92b6542d4ccffb2b42d50495be085c98f417a71f503b4071e2f092afcec77f78064d33ffb0922c28daa3cb9958e6d7fb26d5a660abd90f4 busyboxconfig-extras
+0becc2186d6c32fb0c401cf7bc0e46268b38ce8892db33be1daf40273024c1c02d518283f44086a313a2ccef34230a1d945ec148cc173f26e6aa9d88a7426e54 bbsuid.c
a1127c8a384294135e11500fde7ead33b73d24b11c21911b08447a4c4ef71d7a9965d6466f60f2da64e3b877213b0a3e924a5add3c5333ee3ecde8c2a91c5e02 dad.if-up
-4e7c291a70e879b74c0fc07c54a73ef50537d8be68fee6b2d409425c07afd2d67f9b6afcd8c33a7971014913cc5de85e45079681c9e77200c6cc2f34acfba6d2 nologin.c"
+061f7417c1cbf0424a5fab77e2f5912aa1593f39b33ea294af4c03518ca712d793a77ea82ff1f36e9cb98751d9faacb9d0240cdf0894efd8f26c13c28a692404 nologin.c"
diff --git a/system/busybox/bbsuid.c b/system/busybox/bbsuid.c
index 8be2671b1..24d0d7d3e 100644
--- a/system/busybox/bbsuid.c
+++ b/system/busybox/bbsuid.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <err.h>
#define BBSUID_PATH "/bin/bbsuid"
diff --git a/system/busybox/busybox-extras.pre-deinstall b/system/busybox/busybox-extras.pre-deinstall
index 5ae91ccbc..15461302c 100644
--- a/system/busybox/busybox-extras.pre-deinstall
+++ b/system/busybox/busybox-extras.pre-deinstall
@@ -2,7 +2,7 @@
# Remove all symlinks to busybox-extras
cd /
-for link in $(busybox-extras --list-full); do
+for link in $(busybox-extras --list --full); do
if [ -L "$link" ] && [ "$(readlink $link)" = "/bin/busybox-extras" ]; then
rm "$link"
fi
diff --git a/system/busybox/busyboxconfig b/system/busybox/busyboxconfig
index 979646071..d2ea6fd75 100644
--- a/system/busybox/busyboxconfig
+++ b/system/busybox/busyboxconfig
@@ -1,40 +1,39 @@
#
# Automatically generated make config: don't edit
-# Busybox version: 1.27.2
-# Fri Oct 27 21:22:08 2017
+# Busybox version: 1.28.2
+# Wed Mar 28 12:24:02 2018
#
CONFIG_HAVE_DOT_CONFIG=y
#
-# Busybox Settings
+# Settings
#
CONFIG_DESKTOP=y
# CONFIG_EXTRA_COMPAT is not set
# CONFIG_FEDORA_COMPAT is not set
# CONFIG_INCLUDE_SUSv2 is not set
-# CONFIG_USE_PORTABLE_CODE is not set
+CONFIG_LONG_OPTS=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_LFS=y
# CONFIG_PAM is not set
-CONFIG_LONG_OPTS=y
CONFIG_FEATURE_DEVPTS=y
-# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_UTMP is not set
# CONFIG_FEATURE_WTMP is not set
CONFIG_FEATURE_PIDFILE=y
CONFIG_PID_FILE_PATH="/var/run"
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_INSTALLER=y
+# CONFIG_INSTALL_NO_USR is not set
CONFIG_FEATURE_SUID=y
# CONFIG_FEATURE_SUID_CONFIG is not set
# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
-# CONFIG_SELINUX is not set
# CONFIG_FEATURE_PREFER_APPLETS is not set
CONFIG_BUSYBOX_EXEC_PATH="/bin/busybox"
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
CONFIG_FEATURE_SYSLOG=y
-# CONFIG_FEATURE_HAVE_RPC is not set
CONFIG_PLATFORM_LINUX=y
#
@@ -44,14 +43,15 @@ CONFIG_PLATFORM_LINUX=y
CONFIG_PIE=y
# CONFIG_NOMMU is not set
# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
# CONFIG_FEATURE_INDIVIDUAL is not set
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
-CONFIG_LFS=y
CONFIG_CROSS_COMPILER_PREFIX=""
CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
+# CONFIG_USE_PORTABLE_CODE is not set
#
# Installation Options ("make install" behavior)
@@ -78,7 +78,7 @@ CONFIG_NO_DEBUG_LIB=y
# CONFIG_EFENCE is not set
#
-# Busybox Library Tuning
+# Library Tuning
#
# CONFIG_FEATURE_USE_BSS_TAIL is not set
CONFIG_FEATURE_RTMINMAX=y
@@ -145,7 +145,6 @@ CONFIG_BZCAT=y
CONFIG_UNLZMA=y
CONFIG_LZCAT=y
CONFIG_LZMA=y
-CONFIG_FEATURE_LZMA_FAST=y
CONFIG_UNXZ=y
CONFIG_XZCAT=y
# CONFIG_XZ is not set
@@ -184,12 +183,14 @@ CONFIG_FEATURE_UNZIP_CDF=y
CONFIG_FEATURE_UNZIP_BZIP2=y
CONFIG_FEATURE_UNZIP_LZMA=y
CONFIG_FEATURE_UNZIP_XZ=y
+CONFIG_FEATURE_LZMA_FAST=y
#
# Coreutils
#
CONFIG_BASENAME=y
CONFIG_CAT=y
+CONFIG_FEATURE_CATN=y
CONFIG_FEATURE_CATV=y
CONFIG_CHGRP=y
CONFIG_CHMOD=y
@@ -220,11 +221,8 @@ CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
CONFIG_ECHO=y
CONFIG_FEATURE_FANCY_ECHO=y
CONFIG_ENV=y
-# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
CONFIG_EXPAND=y
-# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
CONFIG_UNEXPAND=y
-# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
CONFIG_EXPR=y
CONFIG_EXPR_MATH_SUPPORT_64=y
CONFIG_FACTOR=y
@@ -262,12 +260,10 @@ CONFIG_SHA3SUM=y
#
CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
CONFIG_MKDIR=y
-# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
CONFIG_MKFIFO=y
CONFIG_MKNOD=y
CONFIG_MKTEMP=y
CONFIG_MV=y
-# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
CONFIG_NICE=y
CONFIG_NL=y
CONFIG_NOHUP=y
@@ -282,7 +278,6 @@ CONFIG_FEATURE_READLINK_FOLLOW=y
CONFIG_REALPATH=y
CONFIG_RM=y
CONFIG_RMDIR=y
-# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
CONFIG_SEQ=y
CONFIG_SHRED=y
CONFIG_SHUF=y
@@ -321,6 +316,7 @@ CONFIG_TRUNCATE=y
CONFIG_TTY=y
CONFIG_UNAME=y
CONFIG_UNAME_OSNAME="Linux"
+CONFIG_BB_ARCH=y
CONFIG_UNIQ=y
CONFIG_UNLINK=y
CONFIG_USLEEP=y
@@ -393,6 +389,14 @@ CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
CONFIG_WHICH=y
#
+# klibc-utils
+#
+# CONFIG_MINIPS is not set
+# CONFIG_NUKE is not set
+# CONFIG_RESUME is not set
+# CONFIG_RUN_INIT is not set
+
+#
# Editors
#
CONFIG_AWK=y
@@ -461,6 +465,8 @@ CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
+CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL=y
+CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y
#
# Init Utilities
@@ -496,10 +502,8 @@ CONFIG_FEATURE_SHADOWPASSWDS=y
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
@@ -611,7 +615,6 @@ CONFIG_FEATURE_HEXDUMP_REVERSE=y
CONFIG_HD=y
CONFIG_XXD=y
CONFIG_HWCLOCK=y
-CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
CONFIG_IONICE=y
CONFIG_IPCRM=y
@@ -651,7 +654,6 @@ CONFIG_FEATURE_MOUNT_FSTAB=y
# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
CONFIG_MOUNTPOINT=y
CONFIG_NSENTER=y
-CONFIG_FEATURE_NSENTER_LONG_OPTS=y
# CONFIG_PIVOT_ROOT is not set
CONFIG_RDATE=y
CONFIG_RDEV=y
@@ -665,11 +667,15 @@ CONFIG_REV=y
CONFIG_LINUX32=y
CONFIG_LINUX64=y
CONFIG_SETPRIV=y
+CONFIG_FEATURE_SETPRIV_DUMP=y
+CONFIG_FEATURE_SETPRIV_CAPABILITIES=y
+CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES=y
CONFIG_SETSID=y
CONFIG_SWAPON=y
CONFIG_FEATURE_SWAPON_DISCARD=y
CONFIG_FEATURE_SWAPON_PRI=y
CONFIG_SWAPOFF=y
+CONFIG_FEATURE_SWAPONOFF_LABEL=y
CONFIG_SWITCH_ROOT=y
# CONFIG_TASKSET is not set
# CONFIG_FEATURE_TASKSET_FANCY is not set
@@ -703,6 +709,7 @@ CONFIG_FEATURE_VOLUMEID_JFS=y
CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
CONFIG_FEATURE_VOLUMEID_LUKS=y
+CONFIG_FEATURE_VOLUMEID_MINIX=y
CONFIG_FEATURE_VOLUMEID_NILFS=y
CONFIG_FEATURE_VOLUMEID_NTFS=y
CONFIG_FEATURE_VOLUMEID_OCFS2=y
@@ -735,6 +742,7 @@ CONFIG_CONSPY=y
CONFIG_CROND=y
CONFIG_FEATURE_CROND_D=y
CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
+CONFIG_FEATURE_CROND_SPECIAL_TIMES=y
CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
CONFIG_CRONTAB=y
CONFIG_DC=y
@@ -757,6 +765,7 @@ CONFIG_HDPARM=y
# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_HEXEDIT is not set
# CONFIG_I2CGET is not set
# CONFIG_I2CSET is not set
# CONFIG_I2CDUMP is not set
@@ -788,6 +797,7 @@ CONFIG_READAHEAD=y
CONFIG_RFKILL=y
# CONFIG_RUNLEVEL is not set
# CONFIG_RX is not set
+# CONFIG_SETFATTR is not set
CONFIG_SETSERIAL=y
CONFIG_STRINGS=y
CONFIG_TIME=y
@@ -883,6 +893,7 @@ CONFIG_NAMEIF=y
CONFIG_FEATURE_NAMEIF_EXTENDED=y
CONFIG_NBDCLIENT=y
CONFIG_NC=y
+# CONFIG_NETCAT is not set
CONFIG_NC_SERVER=y
CONFIG_NC_EXTRA=y
CONFIG_NC_110_COMPAT=y
@@ -899,7 +910,7 @@ CONFIG_FEATURE_FANCY_PING=y
CONFIG_PSCAN=y
CONFIG_ROUTE=y
CONFIG_SLATTACH=y
-CONFIG_SSL_CLIENT=y
+# CONFIG_SSL_CLIENT is not set
# CONFIG_TCPSVD is not set
# CONFIG_UDPSVD is not set
# CONFIG_TELNET is not set
@@ -910,13 +921,13 @@ CONFIG_SSL_CLIENT=y
# CONFIG_FEATURE_TELNETD_STANDALONE is not set
# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
# CONFIG_TFTP is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
# CONFIG_TFTPD is not set
# CONFIG_FEATURE_TFTP_GET is not set
# CONFIG_FEATURE_TFTP_PUT is not set
# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
-# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
# CONFIG_TFTP_DEBUG is not set
-CONFIG_TLS=y
+# CONFIG_TLS is not set
CONFIG_TRACEROUTE=y
CONFIG_TRACEROUTE6=y
CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
@@ -930,16 +941,12 @@ CONFIG_FEATURE_WGET_STATUSBAR=y
CONFIG_FEATURE_WGET_AUTHENTICATION=y
CONFIG_FEATURE_WGET_TIMEOUT=y
CONFIG_FEATURE_WGET_HTTPS=y
-CONFIG_FEATURE_WGET_OPENSSL=y
+# CONFIG_FEATURE_WGET_OPENSSL is not set
CONFIG_WHOIS=y
# CONFIG_ZCIP is not set
-CONFIG_UDHCPC6=y
-CONFIG_FEATURE_UDHCPC6_RFC3646=y
-CONFIG_FEATURE_UDHCPC6_RFC4704=y
-CONFIG_FEATURE_UDHCPC6_RFC4833=y
# CONFIG_UDHCPD is not set
-# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
CONFIG_DHCPD_LEASES_FILE=""
CONFIG_DUMPLEASES=y
# CONFIG_DHCPRELAY is not set
@@ -947,11 +954,19 @@ CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+CONFIG_UDHCPC6=y
+CONFIG_FEATURE_UDHCPC6_RFC3646=y
+CONFIG_FEATURE_UDHCPC6_RFC4704=y
+CONFIG_FEATURE_UDHCPC6_RFC4833=y
+
+#
+# Common options for DHCP applets
+#
# CONFIG_FEATURE_UDHCP_PORT is not set
CONFIG_UDHCP_DEBUG=0
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_FEATURE_UDHCP_RFC3397=y
CONFIG_FEATURE_UDHCP_8021Q=y
-CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-b"
#
@@ -1031,13 +1046,11 @@ CONFIG_SV_DEFAULT_SERVICE_DIR=""
# CONFIG_SVC is not set
# CONFIG_SVLOGD is not set
# CONFIG_CHCON is not set
-# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
# CONFIG_GETENFORCE is not set
# CONFIG_GETSEBOOL is not set
# CONFIG_LOAD_POLICY is not set
# CONFIG_MATCHPATHCON is not set
# CONFIG_RUNCON is not set
-# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
# CONFIG_SELINUXENABLED is not set
# CONFIG_SESTATUS is not set
# CONFIG_SETENFORCE is not set
@@ -1071,6 +1084,7 @@ CONFIG_ASH_TEST=y
CONFIG_ASH_HELP=y
CONFIG_ASH_GETOPTS=y
CONFIG_ASH_CMDCMD=y
+CONFIG_ASH_BASH_SOURCE_CURDIR=y
CONFIG_ASH_COMMAND_NOT_FOUND_HOOK=y
# CONFIG_CTTYHACK is not set
# CONFIG_HUSH is not set
@@ -1093,17 +1107,19 @@ CONFIG_ASH_COMMAND_NOT_FOUND_HOOK=y
# CONFIG_HUSH_HELP is not set
# CONFIG_HUSH_EXPORT is not set
# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_READONLY is not set
# CONFIG_HUSH_KILL is not set
# CONFIG_HUSH_WAIT is not set
# CONFIG_HUSH_TRAP is not set
# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_TIMES is not set
# CONFIG_HUSH_READ is not set
# CONFIG_HUSH_SET is not set
# CONFIG_HUSH_UNSET is not set
# CONFIG_HUSH_ULIMIT is not set
# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_GETOPTS is not set
# CONFIG_HUSH_MEMLEAK is not set
-# CONFIG_MSH is not set
#
# Options common to all shells
@@ -1113,6 +1129,7 @@ CONFIG_FEATURE_SH_MATH_64=y
CONFIG_FEATURE_SH_EXTRA_QUIET=y
# CONFIG_FEATURE_SH_STANDALONE is not set
# CONFIG_FEATURE_SH_NOFORK is not set
+CONFIG_FEATURE_SH_READ_FRAC=y
CONFIG_FEATURE_SH_HISTFILESIZE=y
#
diff --git a/system/busybox/busyboxconfig-extras b/system/busybox/busyboxconfig-extras
index c460d0144..ed9c572a9 100644
--- a/system/busybox/busyboxconfig-extras
+++ b/system/busybox/busyboxconfig-extras
@@ -1,40 +1,39 @@
#
# Automatically generated make config: don't edit
-# Busybox version: 1.27.2
-# Fri Oct 27 21:23:19 2017
+# Busybox version: 1.28.2
+# Wed Mar 28 12:24:25 2018
#
CONFIG_HAVE_DOT_CONFIG=y
#
-# Busybox Settings
+# Settings
#
# CONFIG_DESKTOP is not set
# CONFIG_EXTRA_COMPAT is not set
# CONFIG_FEDORA_COMPAT is not set
# CONFIG_INCLUDE_SUSv2 is not set
-# CONFIG_USE_PORTABLE_CODE is not set
+# CONFIG_LONG_OPTS is not set
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_LFS=y
# CONFIG_PAM is not set
-# CONFIG_LONG_OPTS is not set
CONFIG_FEATURE_DEVPTS=y
-# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_UTMP is not set
# CONFIG_FEATURE_WTMP is not set
# CONFIG_FEATURE_PIDFILE is not set
CONFIG_PID_FILE_PATH=""
+CONFIG_BUSYBOX=y
+CONFIG_FEATURE_INSTALLER=y
+# CONFIG_INSTALL_NO_USR is not set
# CONFIG_FEATURE_SUID is not set
# CONFIG_FEATURE_SUID_CONFIG is not set
# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
-# CONFIG_SELINUX is not set
# CONFIG_FEATURE_PREFER_APPLETS is not set
CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
CONFIG_FEATURE_SYSLOG=y
-# CONFIG_FEATURE_HAVE_RPC is not set
CONFIG_PLATFORM_LINUX=y
#
@@ -44,14 +43,15 @@ CONFIG_PLATFORM_LINUX=y
CONFIG_PIE=y
# CONFIG_NOMMU is not set
# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
# CONFIG_FEATURE_INDIVIDUAL is not set
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
-CONFIG_LFS=y
CONFIG_CROSS_COMPILER_PREFIX=""
CONFIG_SYSROOT=""
CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
+# CONFIG_USE_PORTABLE_CODE is not set
#
# Installation Options ("make install" behavior)
@@ -78,7 +78,7 @@ CONFIG_NO_DEBUG_LIB=y
# CONFIG_EFENCE is not set
#
-# Busybox Library Tuning
+# Library Tuning
#
# CONFIG_FEATURE_USE_BSS_TAIL is not set
# CONFIG_FEATURE_RTMINMAX is not set
@@ -145,7 +145,6 @@ CONFIG_FEATURE_SEAMLESS_GZ=y
# CONFIG_UNLZMA is not set
# CONFIG_LZCAT is not set
# CONFIG_LZMA is not set
-# CONFIG_FEATURE_LZMA_FAST is not set
# CONFIG_UNXZ is not set
# CONFIG_XZCAT is not set
# CONFIG_XZ is not set
@@ -184,12 +183,14 @@ CONFIG_GZIP_FAST=0
# CONFIG_FEATURE_UNZIP_BZIP2 is not set
# CONFIG_FEATURE_UNZIP_LZMA is not set
# CONFIG_FEATURE_UNZIP_XZ is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
#
# Coreutils
#
# CONFIG_BASENAME is not set
# CONFIG_CAT is not set
+# CONFIG_FEATURE_CATN is not set
# CONFIG_FEATURE_CATV is not set
# CONFIG_CHGRP is not set
# CONFIG_CHMOD is not set
@@ -220,11 +221,8 @@ CONFIG_GZIP_FAST=0
# CONFIG_ECHO is not set
# CONFIG_FEATURE_FANCY_ECHO is not set
# CONFIG_ENV is not set
-# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
# CONFIG_EXPAND is not set
-# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
# CONFIG_UNEXPAND is not set
-# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
# CONFIG_EXPR is not set
# CONFIG_EXPR_MATH_SUPPORT_64 is not set
# CONFIG_FACTOR is not set
@@ -258,12 +256,10 @@ CONFIG_GZIP_FAST=0
# CONFIG_SHA3SUM is not set
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
# CONFIG_MKDIR is not set
-# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
# CONFIG_MKFIFO is not set
# CONFIG_MKNOD is not set
# CONFIG_MKTEMP is not set
# CONFIG_MV is not set
-# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
# CONFIG_NICE is not set
# CONFIG_NL is not set
# CONFIG_NOHUP is not set
@@ -278,7 +274,6 @@ CONFIG_GZIP_FAST=0
# CONFIG_REALPATH is not set
# CONFIG_RM is not set
# CONFIG_RMDIR is not set
-# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
# CONFIG_SEQ is not set
# CONFIG_SHRED is not set
# CONFIG_SHUF is not set
@@ -317,6 +312,7 @@ CONFIG_GZIP_FAST=0
# CONFIG_TTY is not set
# CONFIG_UNAME is not set
CONFIG_UNAME_OSNAME=""
+CONFIG_BB_ARCH=y
# CONFIG_UNIQ is not set
# CONFIG_UNLINK is not set
# CONFIG_USLEEP is not set
@@ -377,6 +373,14 @@ CONFIG_DEFAULT_SETFONT_DIR=""
# CONFIG_WHICH is not set
#
+# klibc-utils
+#
+# CONFIG_MINIPS is not set
+# CONFIG_NUKE is not set
+# CONFIG_RESUME is not set
+# CONFIG_RUN_INIT is not set
+
+#
# Editors
#
# CONFIG_AWK is not set
@@ -445,6 +449,8 @@ CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=0
# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
# CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE is not set
#
# Init Utilities
@@ -480,10 +486,8 @@ CONFIG_INIT_TERMINAL_TYPE=""
# CONFIG_ADD_SHELL is not set
# CONFIG_REMOVE_SHELL is not set
# CONFIG_ADDGROUP is not set
-# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
# CONFIG_ADDUSER is not set
-# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
# CONFIG_FEATURE_CHECK_NAMES is not set
CONFIG_LAST_ID=0
CONFIG_FIRST_SYSTEM_ID=0
@@ -595,7 +599,6 @@ CONFIG_DEFAULT_DEPMOD_FILE=""
# CONFIG_HD is not set
# CONFIG_XXD is not set
# CONFIG_HWCLOCK is not set
-# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set
# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
# CONFIG_IONICE is not set
# CONFIG_IPCRM is not set
@@ -635,7 +638,6 @@ CONFIG_DEFAULT_DEPMOD_FILE=""
# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
# CONFIG_MOUNTPOINT is not set
# CONFIG_NSENTER is not set
-# CONFIG_FEATURE_NSENTER_LONG_OPTS is not set
# CONFIG_PIVOT_ROOT is not set
# CONFIG_RDATE is not set
# CONFIG_RDEV is not set
@@ -649,11 +651,15 @@ CONFIG_DEFAULT_DEPMOD_FILE=""
# CONFIG_LINUX32 is not set
# CONFIG_LINUX64 is not set
# CONFIG_SETPRIV is not set
+# CONFIG_FEATURE_SETPRIV_DUMP is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
# CONFIG_SETSID is not set
# CONFIG_SWAPON is not set
# CONFIG_FEATURE_SWAPON_DISCARD is not set
# CONFIG_FEATURE_SWAPON_PRI is not set
# CONFIG_SWAPOFF is not set
+# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
# CONFIG_SWITCH_ROOT is not set
# CONFIG_TASKSET is not set
# CONFIG_FEATURE_TASKSET_FANCY is not set
@@ -679,6 +685,7 @@ CONFIG_DEFAULT_DEPMOD_FILE=""
# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
# CONFIG_FEATURE_VOLUMEID_LUKS is not set
+# CONFIG_FEATURE_VOLUMEID_MINIX is not set
# CONFIG_FEATURE_VOLUMEID_NILFS is not set
# CONFIG_FEATURE_VOLUMEID_NTFS is not set
# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
@@ -711,6 +718,7 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0
# CONFIG_CROND is not set
# CONFIG_FEATURE_CROND_D is not set
# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set
CONFIG_FEATURE_CROND_DIR=""
# CONFIG_CRONTAB is not set
# CONFIG_DC is not set
@@ -733,6 +741,7 @@ CONFIG_FEATURE_CROND_DIR=""
# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_HEXEDIT is not set
# CONFIG_I2CGET is not set
# CONFIG_I2CSET is not set
# CONFIG_I2CDUMP is not set
@@ -764,6 +773,7 @@ CONFIG_READAHEAD=y
# CONFIG_RFKILL is not set
# CONFIG_RUNLEVEL is not set
# CONFIG_RX is not set
+# CONFIG_SETFATTR is not set
# CONFIG_SETSERIAL is not set
# CONFIG_STRINGS is not set
# CONFIG_TIME is not set
@@ -859,6 +869,7 @@ CONFIG_FAKEIDENTD=y
# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
# CONFIG_NBDCLIENT is not set
# CONFIG_NC is not set
+# CONFIG_NETCAT is not set
# CONFIG_NC_SERVER is not set
# CONFIG_NC_EXTRA is not set
# CONFIG_NC_110_COMPAT is not set
@@ -886,6 +897,7 @@ CONFIG_TELNETD=y
CONFIG_FEATURE_TELNETD_STANDALONE=y
CONFIG_FEATURE_TELNETD_INETD_WAIT=y
CONFIG_TFTP=y
+CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
CONFIG_TFTPD=y
#
@@ -894,7 +906,6 @@ CONFIG_TFTPD=y
CONFIG_FEATURE_TFTP_GET=y
CONFIG_FEATURE_TFTP_PUT=y
CONFIG_FEATURE_TFTP_BLOCKSIZE=y
-CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
# CONFIG_TFTP_DEBUG is not set
# CONFIG_TLS is not set
# CONFIG_TRACEROUTE is not set
@@ -913,13 +924,9 @@ CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
# CONFIG_FEATURE_WGET_OPENSSL is not set
# CONFIG_WHOIS is not set
# CONFIG_ZCIP is not set
-# CONFIG_UDHCPC6 is not set
-# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
-# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
-# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
CONFIG_UDHCPD=y
-CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC=y
+CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
CONFIG_DHCPD_LEASES_FILE="/var/lib/udhcpd/udhcpd.leases"
# CONFIG_DUMPLEASES is not set
# CONFIG_DHCPRELAY is not set
@@ -927,11 +934,19 @@ CONFIG_DHCPD_LEASES_FILE="/var/lib/udhcpd/udhcpd.leases"
# CONFIG_FEATURE_UDHCPC_ARPING is not set
# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set
CONFIG_UDHCPC_DEFAULT_SCRIPT=""
+# CONFIG_UDHCPC6 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
+
+#
+# Common options for DHCP applets
+#
# CONFIG_FEATURE_UDHCP_PORT is not set
CONFIG_UDHCP_DEBUG=0
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_FEATURE_UDHCP_RFC3397=y
CONFIG_FEATURE_UDHCP_8021Q=y
-CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
#
@@ -1011,13 +1026,11 @@ CONFIG_SV_DEFAULT_SERVICE_DIR=""
# CONFIG_SVC is not set
# CONFIG_SVLOGD is not set
# CONFIG_CHCON is not set
-# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
# CONFIG_GETENFORCE is not set
# CONFIG_GETSEBOOL is not set
# CONFIG_LOAD_POLICY is not set
# CONFIG_MATCHPATHCON is not set
# CONFIG_RUNCON is not set
-# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
# CONFIG_SELINUXENABLED is not set
# CONFIG_SESTATUS is not set
# CONFIG_SETENFORCE is not set
@@ -1051,6 +1064,7 @@ CONFIG_BASH_IS_NONE=y
# CONFIG_ASH_HELP is not set
# CONFIG_ASH_GETOPTS is not set
# CONFIG_ASH_CMDCMD is not set
+# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
# CONFIG_ASH_COMMAND_NOT_FOUND_HOOK is not set
# CONFIG_CTTYHACK is not set
# CONFIG_HUSH is not set
@@ -1073,17 +1087,19 @@ CONFIG_BASH_IS_NONE=y
# CONFIG_HUSH_HELP is not set
# CONFIG_HUSH_EXPORT is not set
# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_READONLY is not set
# CONFIG_HUSH_KILL is not set
# CONFIG_HUSH_WAIT is not set
# CONFIG_HUSH_TRAP is not set
# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_TIMES is not set
# CONFIG_HUSH_READ is not set
# CONFIG_HUSH_SET is not set
# CONFIG_HUSH_UNSET is not set
# CONFIG_HUSH_ULIMIT is not set
# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_GETOPTS is not set
# CONFIG_HUSH_MEMLEAK is not set
-# CONFIG_MSH is not set
#
# Options common to all shells
@@ -1093,6 +1109,7 @@ CONFIG_BASH_IS_NONE=y
# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
# CONFIG_FEATURE_SH_STANDALONE is not set
# CONFIG_FEATURE_SH_NOFORK is not set
+# CONFIG_FEATURE_SH_READ_FRAC is not set
# CONFIG_FEATURE_SH_HISTFILESIZE is not set
#
diff --git a/system/busybox/external_ssl_client.patch b/system/busybox/external_ssl_client.patch
new file mode 100644
index 000000000..8adb7b41b
--- /dev/null
+++ b/system/busybox/external_ssl_client.patch
@@ -0,0 +1,52 @@
+diff --git a/networking/wget.c b/networking/wget.c
+index cd92b3a28..a12c921cd 100644
+--- a/networking/wget.c
++++ b/networking/wget.c
+@@ -50,7 +50,6 @@
+ //config: bool "Support HTTPS using internal TLS code"
+ //config: default y
+ //config: depends on WGET
+-//config: select TLS
+ //config: help
+ //config: wget will use internal TLS code to connect to https:// URLs.
+ //config: Note:
+@@ -767,8 +766,8 @@ static void spawn_ssl_client(const char *host, int network_fd)
+ int pid;
+ char *servername, *p;
+
+- if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT))
+- bb_error_msg("note: TLS certificate validation not implemented");
++ if (ENABLE_SSL_CLIENT && !(option_mask32 & WGET_OPT_NO_CHECK_CERT))
++ bb_error_msg_and_die("note: TLS certificate validation not implemented");
+
+ servername = xstrdup(host);
+ p = strrchr(servername, ':');
+@@ -785,21 +784,25 @@ static void spawn_ssl_client(const char *host, int network_fd)
+ close(sp[0]);
+ xmove_fd(sp[1], 0);
+ xdup2(0, 1);
+- if (BB_MMU) {
++ if (BB_MMU && ENABLE_TLS && (option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
+ tls_state_t *tls = new_tls_state();
+ tls->ifd = tls->ofd = network_fd;
+ tls_handshake(tls, servername);
+ tls_run_copy_loop(tls);
+ exit(0);
+ } else {
+- char *argv[5];
++ char *argv[6];
+ xmove_fd(network_fd, 3);
+ argv[0] = (char*)"ssl_client";
+ argv[1] = (char*)"-s3";
+ //TODO: if (!is_ip_address(servername))...
+ argv[2] = (char*)"-n";
+ argv[3] = servername;
+- argv[4] = NULL;
++ if (!ENABLE_SSL_CLIENT &&(option_mask32 & WGET_OPT_NO_CHECK_CERT)) {
++ argv[4] = (char*)"-I";
++ argv[5] = NULL;
++ } else
++ argv[4] = NULL;
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
+ }
diff --git a/system/busybox/nologin.c b/system/busybox/nologin.c
index e0a4c56c7..75ad89eda 100644
--- a/system/busybox/nologin.c
+++ b/system/busybox/nologin.c
@@ -26,7 +26,7 @@
#define _NOLOGIN_TXT "/etc/nologin.txt"
int nologin_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int nologin_main(int argc UNUSED_PARAM, char **argv)
+int nologin_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
int fd;
fd = open(_NOLOGIN_TXT, O_RDONLY);
diff --git a/system/busybox/ssl_client.c b/system/busybox/ssl_client.c
new file mode 100644
index 000000000..8aa558e70
--- /dev/null
+++ b/system/busybox/ssl_client.c
@@ -0,0 +1,158 @@
+#include <err.h>
+#include <errno.h>
+#include <poll.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <tls.h>
+
+#define BUFSIZE 16384
+
+#define TLS_DEBUG 0
+
+#if TLS_DEBUG
+# define dbg(...) fprintf(stderr, __VA_ARGS__)
+#else
+# define dbg(...) ((void)0)
+#endif
+
+static void copy_from_stdin_to_tls(struct tls *ctx, int *fd)
+{
+ static size_t buf[BUFSIZE];
+ ssize_t n;
+ int i = 0;
+ dbg("DEBUG: data from STDIN\n");
+ do {
+ n = read(STDIN_FILENO, buf, sizeof(buf));
+ dbg("read %zu\n", n);
+ } while (n < 0 && errno == EINTR);
+
+ if (n < 1) {
+ *fd = -1;
+ return;
+ }
+
+ while (n > 0) {
+ ssize_t r = tls_write(ctx, &buf[i], n);
+ if (r == TLS_WANT_POLLIN || r == TLS_WANT_POLLOUT)
+ continue;
+ if (r < 0)
+ err(1, "tls_write: %s", tls_error(ctx));
+ i += r;
+ n -= r;
+ }
+}
+
+static int copy_from_tls_to_stdout(struct tls *ctx)
+{
+ static size_t buf[BUFSIZE];
+ ssize_t n,r;
+ int i = 0;
+
+ dbg("DEBUG: data from TLS\n");
+ do {
+ n = tls_read(ctx, buf, sizeof(buf));
+ } while (n == TLS_WANT_POLLIN || r == TLS_WANT_POLLOUT);
+ if (n < 0)
+ err(1, "tls read: %s", tls_error(ctx));
+
+ if (n == 0)
+ return 1;
+
+ while (n) {
+ r = write(STDOUT_FILENO, &buf[i], n);
+ if (r < 0)
+ err(1, "write");
+ i += r;
+ n -= r;
+ }
+ return 0;
+}
+
+int do_poll(struct pollfd *fds, int nfds)
+{
+ int r;
+ while ((r = poll(fds, nfds, -1)) < 0) {
+ if (errno != EINTR && errno != ENOMEM)
+ err(1, "poll");
+ }
+ return r;
+}
+
+static void copy_loop(struct tls *ctx, int sfd)
+{
+ struct pollfd fds[2] = {
+ { .fd = STDIN_FILENO, .events = POLLIN },
+ { .fd = sfd, .events = POLLIN },
+ };
+
+ while (1) {
+ int r = do_poll(fds, 2);
+ if (fds[0].revents)
+ copy_from_stdin_to_tls(ctx, &fds[0].fd);
+
+ if (fds[1].revents && copy_from_tls_to_stdout(ctx))
+ break;
+ }
+}
+
+void usage(const char *prog, int ret) {
+ printf("usage: %s [-s FD] [-I] -n SNI\n", prog);
+ exit(ret);
+}
+
+int main(int argc, char *argv[])
+{
+ int c, sfd = 1;;
+ const char *sni = NULL;
+ struct tls_config *tc;
+ struct tls *ctx;
+ int insecure = 0;
+
+ while ((c = getopt(argc, argv, "hs:n:I")) != -1) {
+ switch (c) {
+ case 'h':
+ usage(argv[0], 0);
+ break;
+ case 's':
+ sfd = atoi(optarg);
+ break;
+ case 'n':
+ sni = optarg;
+ break;
+ case 'I':
+ insecure = 1;
+ break;
+ case '?':
+ usage(argv[0], 1);
+ }
+ }
+
+ if (tls_init() == -1)
+ errx(1, "tls_init() failed");
+
+ if ((ctx = tls_client()) == NULL)
+ errx(1, "tls_client() failed");
+
+ if (insecure) {
+ if ((tc = tls_config_new()) == NULL)
+ errx(1, "tls_config_new() failed");
+ tls_config_insecure_noverifycert(tc);
+ tls_config_insecure_noverifyname(tc);
+ tls_config_insecure_noverifytime(tc);
+ if (tls_configure(ctx, tc) == -1)
+ err(1, "tls_configure: %s", tls_error(ctx));
+ tls_config_free(tc);
+ }
+
+ if (tls_connect_fds(ctx, sfd, sfd, sni) == -1)
+ errx(1, "%s: TLS connect failed", sni);
+
+ if (tls_handshake(ctx) == -1)
+ errx(1, "%s: %s", sni, tls_error(ctx));
+
+ copy_loop(ctx, sfd);
+ tls_close(ctx);
+ return 0;
+}