Commit bb3bc00f authored by Sören Tempel's avatar Sören Tempel Committed by Natanael Copa

main/busybox: upgrade to 1.29.3

* Remove all patches already applied upstream
	* 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
	* 0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch
	* 0001-wget-emit-a-message-that-certificate-verification-is.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
* Rename config option for command_not_found hook
	* upstream patch adding this hook slightly differs from our
	  downstream patch in this regard
* Rebase some patches manually:
	* external_ssl_client.patch
	* 0006-ping-make-ping-work-without-root-privileges.patch
	* 0007-fbsplash-support-image-and-bar-alignment-and-positio.patch
* Add support for `-e` to our ssl_client
	* See https://git.busybox.net/busybox/commit/?id=403f2999f94937ba3f37db6d093832f636815bb9
* Update the configuration file
* Regenerate all patches using `git format-patch --no-numbered --no-signature`
  to reduce the diff for future upgrades.
parent 4ecb921f
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 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
command.
Unlike bash, however, we ignore exit codes from the hook function and always return
the correct POSIX error code (EX_NOTFOUND).
Signed-off-by: William Pitcock <nenolod@dereferenced.org>
---
shell/ash.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index b73a79975..7ceb91920 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -132,6 +132,15 @@
//config: you to run the specified command or builtin,
//config: even when there is a function with the same name.
//config:
+//config:config ASH_COMMAND_NOT_FOUND_HOOK
+//config: bool "command_not_found_handle hook support"
+//config: default y
+//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
+//config: help
+//config: Enable support for the 'command_not_found_handle' hook function,
+//config: from GNU bash, which allows for alternative command not found
+//config: handling.
+//config:
//config:endif # ash options
//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
@@ -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();
- if (act & DO_ERR)
- ash_msg("%s: %s", name, errmsg(e, "not found"));
+ if (act & DO_ERR) {
+#ifdef CONFIG_ASH_COMMAND_NOT_FOUND_HOOK
+#define HOOKFN_NAME "command_not_found_handle"
+ char hookfn_name[] = HOOKFN_NAME;
+ struct tblentry *hookp = cmdlookup(hookfn_name, 0);
+ if (hookp != NULL && hookp->cmdtype == CMDFUNCTION) {
+ evalfun(hookp->param.func, 2, (char *[]){ hookfn_name, name }, 0);
+ entry->cmdtype = CMDUNKNOWN;
+ return;
+ } else
+#endif
+ ash_msg("%s: %s", name, errmsg(e, "not found"));
+ }
entry->cmdtype = CMDUNKNOWN;
return;
--
2.16.2
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
From a89f8ef7ddb7506636b535daaf4fb4cfc2f7f6af Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 30 May 2018 09:52:20 +0000
Subject: [PATCH] properly fix wget https support
See: https://git.alpinelinux.org/cgit/aports/commit/?id=1d0560a9b6b5597b191e5aff69a31c2fe0aba273
---
networking/wget.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/networking/wget.c b/networking/wget.c diff --git a/networking/wget.c b/networking/wget.c
index cd92b3a28..a12c921cd 100644 index 33c93bad3..e296d241a 100644
--- a/networking/wget.c --- a/networking/wget.c
+++ b/networking/wget.c +++ b/networking/wget.c
@@ -50,7 +50,6 @@ @@ -51,7 +51,6 @@
//config: bool "Support HTTPS using internal TLS code" //it also enables FTPS support, but it's not well tested yet
//config: default y //config: default y
//config: depends on WGET //config: depends on WGET
-//config: select TLS -//config: select TLS
//config: help //config: help
//config: wget will use internal TLS code to connect to https:// URLs. //config: wget will use internal TLS code to connect to https:// URLs.
//config: Note: //config: Note:
@@ -767,8 +766,8 @@ static void spawn_ssl_client(const char *host, int network_fd) @@ -716,8 +715,8 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
int pid; int pid;
char *servername, *p; char *servername, *p;
...@@ -21,7 +31,7 @@ index cd92b3a28..a12c921cd 100644 ...@@ -21,7 +31,7 @@ index cd92b3a28..a12c921cd 100644
servername = xstrdup(host); servername = xstrdup(host);
p = strrchr(servername, ':'); p = strrchr(servername, ':');
@@ -785,21 +784,25 @@ static void spawn_ssl_client(const char *host, int network_fd) @@ -734,14 +733,14 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
close(sp[0]); close(sp[0]);
xmove_fd(sp[1], 0); xmove_fd(sp[1], 0);
xdup2(0, 1); xdup2(0, 1);
...@@ -30,23 +40,28 @@ index cd92b3a28..a12c921cd 100644 ...@@ -30,23 +40,28 @@ index cd92b3a28..a12c921cd 100644
tls_state_t *tls = new_tls_state(); tls_state_t *tls = new_tls_state();
tls->ifd = tls->ofd = network_fd; tls->ifd = tls->ofd = network_fd;
tls_handshake(tls, servername); tls_handshake(tls, servername);
tls_run_copy_loop(tls); tls_run_copy_loop(tls, flags);
exit(0); exit(0);
} else { } else {
- char *argv[5]; - char *argv[6];
+ char *argv[6]; + char *argv[7], **a;
xmove_fd(network_fd, 3); xmove_fd(network_fd, 3);
argv[0] = (char*)"ssl_client"; argv[0] = (char*)"ssl_client";
argv[1] = (char*)"-s3"; @@ -749,8 +748,14 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
//TODO: if (!is_ip_address(servername))... //TODO: if (!is_ip_address(servername))...
argv[2] = (char*)"-n"; argv[2] = (char*)"-n";
argv[3] = servername; argv[3] = servername;
- argv[4] = NULL; - argv[4] = (flags & TLSLOOP_EXIT_ON_LOCAL_EOF ? (char*)"-e" : NULL);
+ if (!ENABLE_SSL_CLIENT &&(option_mask32 & WGET_OPT_NO_CHECK_CERT)) { - argv[5] = NULL;
+ argv[4] = (char*)"-I"; +
+ argv[5] = NULL; + a = &argv[4];
+ } else + if (flags & TLSLOOP_EXIT_ON_LOCAL_EOF)
+ argv[4] = NULL; + *a++ = (char*)"-e";
+ if (!ENABLE_SSL_CLIENT && (option_mask32 & WGET_OPT_NO_CHECK_CERT))
+ *a++= (char*)"-I";
+ *a = NULL;
+
BB_EXECVP(argv[0], argv); BB_EXECVP(argv[0], argv);
bb_perror_msg_and_die("can't execute '%s'", argv[0]); bb_perror_msg_and_die("can't execute '%s'", argv[0]);
} }
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
From bce882404ab41d32d5d9def274e49264717135b2 Mon Sep 17 00:00:00 2001 From 2e673aac06d661038001286fd389d1b45c511c66 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org> From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 28 Nov 2017 13:23:17 +0100 Date: Tue, 28 Nov 2017 13:23:17 +0100
Subject: [PATCH 02/16] fsck: resolve LABEL=.../UUID=... spec to device Subject: [PATCH] fsck: resolve LABEL=.../UUID=... spec to device
--- ---
e2fsprogs/fsck.c | 10 +++++----- e2fsprogs/fsck.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-) 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 1c285bb92..5af38c0aa 100644 index f5aa3dbe4..e2edc9747 100644
--- a/e2fsprogs/fsck.c --- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c
@@ -60,6 +60,7 @@ @@ -60,6 +60,7 @@
...@@ -19,7 +19,7 @@ index 1c285bb92..5af38c0aa 100644 ...@@ -19,7 +19,7 @@ index 1c285bb92..5af38c0aa 100644
#include "common_bufsiz.h" #include "common_bufsiz.h"
/* "progress indicator" code is somewhat buggy and ext[23] specific. /* "progress indicator" code is somewhat buggy and ext[23] specific.
@@ -523,12 +524,13 @@ static int wait_many(int flags) @@ -524,12 +525,13 @@ static int wait_many(int flags)
* Execute a particular fsck program, and link it into the list of * Execute a particular fsck program, and link it into the list of
* child processes we are waiting for. * child processes we are waiting for.
*/ */
...@@ -34,7 +34,7 @@ index 1c285bb92..5af38c0aa 100644 ...@@ -34,7 +34,7 @@ index 1c285bb92..5af38c0aa 100644
G.args[0] = xasprintf("fsck.%s", type); G.args[0] = xasprintf("fsck.%s", type);
@@ -543,7 +545,8 @@ static void execute(const char *type, const char *device, @@ -544,7 +546,8 @@ static void execute(const char *type, const char *device,
} }
#endif #endif
...@@ -44,7 +44,7 @@ index 1c285bb92..5af38c0aa 100644 ...@@ -44,7 +44,7 @@ index 1c285bb92..5af38c0aa 100644
/* G.args[G.num_args - 1] = NULL; - already is */ /* G.args[G.num_args - 1] = NULL; - already is */
if (G.verbose || G.noexecute) { if (G.verbose || G.noexecute) {
@@ -972,9 +975,6 @@ int fsck_main(int argc UNUSED_PARAM, char **argv) @@ -973,9 +976,6 @@ int fsck_main(int argc UNUSED_PARAM, char **argv)
/* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */ /* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */
if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) { if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
...@@ -54,6 +54,3 @@ index 1c285bb92..5af38c0aa 100644 ...@@ -54,6 +54,3 @@ index 1c285bb92..5af38c0aa 100644
devices = xrealloc_vector(devices, 2, num_devices); devices = xrealloc_vector(devices, 2, num_devices);
devices[num_devices++] = arg; devices[num_devices++] = arg;
continue; continue;
--
2.16.2
From 36b6cc36d1f259e4ac76a1c2de743113845ff4cd Mon Sep 17 00:00:00 2001 From d06a13f4cd81aeda9b02d4da90ef2b941899d6c5 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org> From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 4 Aug 2016 11:03:07 +0200 Date: Thu, 4 Aug 2016 11:03:07 +0200
Subject: [PATCH 03/16] ash: exec busybox.static Subject: [PATCH] ash: exec busybox.static
--- ---
shell/ash.c | 2 ++ shell/ash.c | 2 ++
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/shell/ash.c b/shell/ash.c diff --git a/shell/ash.c b/shell/ash.c
index 7ceb91920..d04096a9b 100644 index 051cc671f..73470eab2 100644
--- a/shell/ash.c --- a/shell/ash.c
+++ b/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 @@ -7991,6 +7991,8 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c
} }
/* re-exec ourselves with the new arguments */ /* re-exec ourselves with the new arguments */
execve(bb_busybox_exec_path, argv, envp); execve(bb_busybox_exec_path, argv, envp);
...@@ -20,6 +20,3 @@ index 7ceb91920..d04096a9b 100644 ...@@ -20,6 +20,3 @@ index 7ceb91920..d04096a9b 100644
/* If they called chroot or otherwise made the binary no longer /* If they called chroot or otherwise made the binary no longer
* executable, fall through */ * executable, fall through */
} }
--
2.16.2
From 9bbc93f12f7cff8fb51a0bf89907d9875f5c14e6 Mon Sep 17 00:00:00 2001 From d4bc80ad7bf9b846b38c903a087c5ed318e848fb Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org> From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 27 Dec 2016 20:46:59 +0100 Date: Tue, 27 Dec 2016 20:46:59 +0100
Subject: [PATCH 04/16] app location for cpio, vi and lspci Subject: [PATCH] app location for cpio, vi and lspci
Adjust location to where alpine linux installs them Adjust location to where alpine linux installs them
--- ---
...@@ -11,7 +11,7 @@ Adjust location to where alpine linux installs them ...@@ -11,7 +11,7 @@ Adjust location to where alpine linux installs them
3 files changed, 3 insertions(+), 3 deletions(-) 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/archival/cpio.c b/archival/cpio.c diff --git a/archival/cpio.c b/archival/cpio.c
index 1d6cbd1e2..0c14f79e7 100644 index 221667112..a6d7630a4 100644
--- a/archival/cpio.c --- a/archival/cpio.c
+++ b/archival/cpio.c +++ b/archival/cpio.c
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
...@@ -24,7 +24,7 @@ index 1d6cbd1e2..0c14f79e7 100644 ...@@ -24,7 +24,7 @@ index 1d6cbd1e2..0c14f79e7 100644
//kbuild:lib-$(CONFIG_CPIO) += cpio.o //kbuild:lib-$(CONFIG_CPIO) += cpio.o
diff --git a/editors/vi.c b/editors/vi.c diff --git a/editors/vi.c b/editors/vi.c
index cdfb27cc5..20077727e 100644 index f103e0dc0..89397710c 100644
--- a/editors/vi.c --- a/editors/vi.c
+++ b/editors/vi.c +++ b/editors/vi.c
@@ -161,7 +161,7 @@ @@ -161,7 +161,7 @@
...@@ -49,6 +49,3 @@ index 0000fbfda..34189d2b5 100644 ...@@ -49,6 +49,3 @@ index 0000fbfda..34189d2b5 100644
//kbuild:lib-$(CONFIG_LSPCI) += lspci.o //kbuild:lib-$(CONFIG_LSPCI) += lspci.o
--
2.16.2
From b67940090709f3bbd868557dd4d5317cb807250d Mon Sep 17 00:00:00 2001 From ed9d54e8920e6f90ddda8519c761217685c07044 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org> From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 4 Aug 2016 11:08:35 +0200 Date: Thu, 4 Aug 2016 11:08:35 +0200
Subject: [PATCH 05/16] udhcpc: set default discover retries to 5 Subject: [PATCH] udhcpc: set default discover retries to 5
Some slower nics needs more attempts to get a lease Some slower nics needs more attempts to get a lease
--- ---
...@@ -9,10 +9,10 @@ Some slower nics needs more attempts to get a lease ...@@ -9,10 +9,10 @@ Some slower nics needs more attempts to get a lease
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 55f21c187..cc1d22c8e 100644 index c2805a009..0b14b0332 100644
--- a/networking/udhcp/dhcpc.c --- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c
@@ -1203,7 +1203,7 @@ static void client_background(void) @@ -1197,7 +1197,7 @@ static void client_background(void)
//usage: "\n -p FILE Create pidfile" //usage: "\n -p FILE Create pidfile"
//usage: "\n -B Request broadcast replies" //usage: "\n -B Request broadcast replies"
//usage: "\n -t N Send up to N discover packets (default 3)" //usage: "\n -t N Send up to N discover packets (default 3)"
...@@ -21,7 +21,7 @@ index 55f21c187..cc1d22c8e 100644 ...@@ -21,7 +21,7 @@ index 55f21c187..cc1d22c8e 100644
//usage: "\n -A SEC Wait if lease is not obtained (default 20)" //usage: "\n -A SEC Wait if lease is not obtained (default 20)"
//usage: "\n -n Exit if lease is not obtained" //usage: "\n -n Exit if lease is not obtained"
//usage: "\n -q Exit after obtaining lease" //usage: "\n -q Exit after obtaining lease"
@@ -1247,7 +1247,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) @@ -1242,7 +1242,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
llist_t *list_x = NULL; llist_t *list_x = NULL;
int tryagain_timeout = 20; int tryagain_timeout = 20;
int discover_timeout = 3; int discover_timeout = 3;
...@@ -30,6 +30,3 @@ index 55f21c187..cc1d22c8e 100644 ...@@ -30,6 +30,3 @@ index 55f21c187..cc1d22c8e 100644
uint32_t server_addr = server_addr; /* for compiler */ uint32_t server_addr = server_addr; /* for compiler */
uint32_t requested_ip = 0; uint32_t requested_ip = 0;
uint32_t xid = xid; /* for compiler */ uint32_t xid = xid; /* for compiler */
--
2.16.2
From 21d74f2989d0046e5b7c586f5a052643d5da8dcc Mon Sep 17 00:00:00 2001 From 9513a2daae84660f2ddd7d60d39bb49cd678adbe Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org> From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 29 Mar 2016 18:59:22 +0200 Date: Tue, 29 Mar 2016 18:59:22 +0200
Subject: [PATCH 06/16] ping: make ping work without root privileges Subject: [PATCH] ping: make ping work without root privileges
--- ---
networking/ping.c | 103 +++++++++++++++++++++++++++++++++++++++++++++--------- networking/ping.c | 103 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 87 insertions(+), 16 deletions(-) 1 file changed, 87 insertions(+), 16 deletions(-)
diff --git a/networking/ping.c b/networking/ping.c diff --git a/networking/ping.c b/networking/ping.c
index d1d59d545..c0ebc0f9a 100644 index 8f85d3ec2..dc3f50968 100644
--- a/networking/ping.c --- a/networking/ping.c
+++ b/networking/ping.c +++ b/networking/ping.c
@@ -163,6 +163,7 @@ enum { @@ -165,6 +165,7 @@ enum {
pingsock = 0, pingsock = 0,
}; };
...@@ -19,7 +19,7 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -19,7 +19,7 @@ index d1d59d545..c0ebc0f9a 100644
static void static void
#if ENABLE_PING6 #if ENABLE_PING6
create_icmp_socket(len_and_sockaddr *lsa) create_icmp_socket(len_and_sockaddr *lsa)
@@ -179,9 +180,23 @@ create_icmp_socket(void) @@ -181,9 +182,23 @@ create_icmp_socket(void)
#endif #endif
sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */ sock = socket(AF_INET, SOCK_RAW, 1); /* 1 == ICMP */
if (sock < 0) { if (sock < 0) {
...@@ -46,7 +46,7 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -46,7 +46,7 @@ index d1d59d545..c0ebc0f9a 100644
} }
xmove_fd(sock, pingsock); xmove_fd(sock, pingsock);
@@ -234,10 +249,12 @@ static void ping4(len_and_sockaddr *lsa) @@ -236,10 +251,12 @@ static void ping4(len_and_sockaddr *lsa)
bb_perror_msg("recvfrom"); bb_perror_msg("recvfrom");
continue; continue;
} }
...@@ -62,9 +62,9 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -62,9 +62,9 @@ index d1d59d545..c0ebc0f9a 100644
if (pkt->icmp_id != G.myid) if (pkt->icmp_id != G.myid)
continue; /* not our ping */ continue; /* not our ping */
if (pkt->icmp_type == ICMP_ECHOREPLY) if (pkt->icmp_type == ICMP_ECHOREPLY)
@@ -634,19 +651,21 @@ static void unpack_tail(int sz, uint32_t *tp, @@ -636,19 +653,21 @@ static void unpack_tail(int sz, uint32_t *tp,
} }
static void unpack4(char *buf, int sz, struct sockaddr_in *from) static int unpack4(char *buf, int sz, struct sockaddr_in *from)
{ {
- struct icmp *icmppkt; - struct icmp *icmppkt;
struct iphdr *iphdr; struct iphdr *iphdr;
...@@ -73,7 +73,7 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -73,7 +73,7 @@ index d1d59d545..c0ebc0f9a 100644
/* discard if too short */ /* discard if too short */
if (sz < (datalen + ICMP_MINLEN)) if (sz < (datalen + ICMP_MINLEN))
return; return 0;
+ if(!using_dgram) { + if(!using_dgram) {
+ /* check IP header */ + /* check IP header */
+ iphdr = (struct iphdr *) buf; + iphdr = (struct iphdr *) buf;
...@@ -88,18 +88,18 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -88,18 +88,18 @@ index d1d59d545..c0ebc0f9a 100644
- sz -= hlen; - sz -= hlen;
- icmppkt = (struct icmp *) (buf + hlen); - icmppkt = (struct icmp *) (buf + hlen);
if (icmppkt->icmp_id != myid) if (icmppkt->icmp_id != myid)
return; /* not our ping */ return 0; /* not our ping */
@@ -658,7 +677,7 @@ static void unpack4(char *buf, int sz, struct sockaddr_in *from) @@ -660,7 +679,7 @@ static int unpack4(char *buf, int sz, struct sockaddr_in *from)
tp = (uint32_t *) icmppkt->icmp_data; tp = (uint32_t *) icmppkt->icmp_data;
unpack_tail(sz, tp, unpack_tail(sz, tp,
inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr), inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr),
- recv_seq, iphdr->ttl); - recv_seq, iphdr->ttl);
+ recv_seq, using_dgram ? 42 : iphdr->ttl); + recv_seq, using_dgram ? 42 : iphdr->ttl);
} else if (icmppkt->icmp_type != ICMP_ECHO) { return 1;
bb_error_msg("warning: got ICMP %d (%s)", }
icmppkt->icmp_type, if (icmppkt->icmp_type != ICMP_ECHO) {
@@ -702,11 +721,31 @@ static void ping4(len_and_sockaddr *lsa) @@ -710,11 +729,31 @@ static void ping4(len_and_sockaddr *lsa)
int sockopt; int sockopt;
pingaddr.sin = lsa->u.sin; pingaddr.sin = lsa->u.sin;
...@@ -132,7 +132,7 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -132,7 +132,7 @@ index d1d59d545..c0ebc0f9a 100644
} }
/* enable broadcast pings */ /* enable broadcast pings */
@@ -723,6 +762,15 @@ static void ping4(len_and_sockaddr *lsa) @@ -731,6 +770,15 @@ static void ping4(len_and_sockaddr *lsa)
setsockopt_int(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, opt_ttl); setsockopt_int(pingsock, IPPROTO_IP, IP_MULTICAST_TTL, opt_ttl);
} }
...@@ -148,7 +148,7 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -148,7 +148,7 @@ index d1d59d545..c0ebc0f9a 100644
signal(SIGINT, print_stats_and_exit); signal(SIGINT, print_stats_and_exit);
/* start the ping's going ... */ /* start the ping's going ... */
@@ -756,10 +804,33 @@ static void ping6(len_and_sockaddr *lsa) @@ -768,10 +816,33 @@ static void ping6(len_and_sockaddr *lsa)
char control_buf[CMSG_SPACE(36)]; char control_buf[CMSG_SPACE(36)];
pingaddr.sin6 = lsa->u.sin6; pingaddr.sin6 = lsa->u.sin6;
...@@ -183,15 +183,12 @@ index d1d59d545..c0ebc0f9a 100644 ...@@ -183,15 +183,12 @@ index d1d59d545..c0ebc0f9a 100644
{ {
struct icmp6_filter filt; struct icmp6_filter filt;
if (!(option_mask32 & OPT_VERBOSE)) { if (!(option_mask32 & OPT_VERBOSE)) {
@@ -890,7 +961,7 @@ static int common_ping_main(int opt, char **argv) @@ -911,7 +982,7 @@ static int common_ping_main(int opt, char **argv)
if (opt & OPT_p) G.deadline_us = 1 | ((d * 1000000) + monotonic_us());
G.pattern = xstrtou_range(str_p, 16, 0, 255); }
- myid = (uint16_t) getpid(); - myid = (uint16_t) getpid();
+ if (!using_dgram) myid = (uint16_t) getpid(); + if (!using_dgram) myid = (uint16_t) getpid();
hostname = argv[optind]; hostname = argv[optind];
#if ENABLE_PING6 #if ENABLE_PING6
{ {
--
2.16.2
From 377e2f20c1034de1195fd900fc637821952cfa49 Mon Sep 17 00:00:00 2001 From 8fb815ec846d9ac64c89ac21cededc17f0b804c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 24 Sep 2012 07:58:29 +0300 Date: Mon, 24 Sep 2012 07:58:29 +0300
Subject: [PATCH 07/16] fbsplash: support console switching Subject: [PATCH] fbsplash: support console switching
--- ---
miscutils/fbsplash.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++----- miscutils/fbsplash.c | 82 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 75 insertions(+), 7 deletions(-) 1 file changed, 75 insertions(+), 7 deletions(-)
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index 5b2e5ac56..bc80f728c 100644 index bc3c61055..1c206ef53 100644
--- a/miscutils/fbsplash.c --- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
...@@ -21,7 +21,7 @@ index 5b2e5ac56..bc80f728c 100644 ...@@ -21,7 +21,7 @@ index 5b2e5ac56..bc80f728c 100644
//usage: " -s Image" //usage: " -s Image"
//usage: "\n -c Hide cursor" //usage: "\n -c Hide cursor"
@@ -57,11 +57,17 @@ @@ -57,11 +57,17 @@
//usage: "\n BAR_R,BAR_G,BAR_B" //usage: "\n BAR_R,BAR_G,BAR_B,IMG_LEFT,IMG_TOP"
//usage: "\n -f Control pipe (else exit after drawing image)" //usage: "\n -f Control pipe (else exit after drawing image)"
//usage: "\n commands: 'NN' (% for progress bar) or 'exit'" //usage: "\n commands: 'NN' (% for progress bar) or 'exit'"
+//usage: "\n -T Switch to TTY to hide all console messages" +//usage: "\n -T Switch to TTY to hide all console messages"
...@@ -40,14 +40,14 @@ index 5b2e5ac56..bc80f728c 100644 ...@@ -40,14 +40,14 @@ index 5b2e5ac56..bc80f728c 100644
@@ -75,6 +81,8 @@ struct globals { @@ -75,6 +81,8 @@ struct globals {
unsigned char *addr; // pointer to framebuffer memory unsigned char *addr; // pointer to framebuffer memory
unsigned ns[7]; // n-parameters unsigned ns[9]; // n-parameters
const char *image_filename; const char *image_filename;