Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
From e1690453cd84c798ca88cc4370710f65da86d986 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Sat, 5 Oct 2013 15:55:06 +0200
|
||||
Subject: [PATCH] networking/libiproute: use <linux/if_packet.h> instead of
|
||||
<net/if_packet.h>
|
||||
|
||||
The musl C library doesn't provide the <net/if_packet.h> since the
|
||||
corresponding kernel headers <linux/if_packet.h> already provides the
|
||||
necessary definitions. Replacing <net/if_packet.h> by
|
||||
<linux/if_packet.h> also removes the need to include
|
||||
<netpacket/packet.h>
|
||||
|
||||
This commit fixes the build of iplink with the musl C library.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[Gustavo: update for busybox 1.22.0]
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
networking/libiproute/iplink.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
|
||||
index 37ed114bc..bc526d89c 100644
|
||||
--- a/networking/libiproute/iplink.c
|
||||
+++ b/networking/libiproute/iplink.c
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include <net/if.h>
|
||||
/*#include <net/if_packet.h> - not needed? */
|
||||
-#include <netpacket/packet.h>
|
||||
+#include <linux/if_packet.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From df20ae1280a2601a4c233ec12372d1e17db21e96 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
Date: Mon, 25 Nov 2013 22:51:53 +0100
|
||||
Subject: [PATCH] Makefile.flags: strip non -l arguments returned by pkg-config
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||||
[yann.morin.1998@free.fr: refresh for 1.29.0]
|
||||
[petr.vorel@gmail.com: refresh for 1.32.0]
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
Makefile.flags | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 97cb4dca2..92a9063d9 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -181,7 +181,9 @@ ifeq ($(CONFIG_SELINUX),y)
|
||||
SELINUX_PC_MODULES = libselinux libsepol
|
||||
$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
|
||||
CPPFLAGS += $(SELINUX_CFLAGS)
|
||||
-LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
|
||||
+LDLIBS += $(if $(SELINUX_LIBS),\
|
||||
+ $(patsubst -l%,%,$(filter -l%,$(SELINUX_LIBS))),\
|
||||
+ $(SELINUX_PC_MODULES:lib%=%))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FEATURE_NSLOOKUP_BIG),y)
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 68eaf20d86d4fe0f16a914817217f386155157cc Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] libbb: sockaddr2str: ensure only printable characters are
|
||||
returned for the hostname part
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089796.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
libbb/xconnect.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
|
||||
index 0e0b247b8..02c061e67 100644
|
||||
--- a/libbb/xconnect.c
|
||||
+++ b/libbb/xconnect.c
|
||||
@@ -497,8 +497,9 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
);
|
||||
if (rc)
|
||||
return NULL;
|
||||
+ /* ensure host contains only printable characters */
|
||||
if (flags & IGNORE_PORT)
|
||||
- return xstrdup(host);
|
||||
+ return xstrdup(printable_string(host));
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (strchr(host, ':')) /* heh, it's not a resolved hostname */
|
||||
@@ -509,7 +510,7 @@ static char* FAST_FUNC sockaddr2str(const struct sockaddr *sa, int flags)
|
||||
#endif
|
||||
/* For now we don't support anything else, so it has to be INET */
|
||||
/*if (sa->sa_family == AF_INET)*/
|
||||
- return xasprintf("%s:%s", host, serv);
|
||||
+ return xasprintf("%s:%s", printable_string(host), serv);
|
||||
/*return xstrdup(host);*/
|
||||
}
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
From 56b84c6efb9a06ae294eb92cf9634f70af443b0a Mon Sep 17 00:00:00 2001
|
||||
From: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Date: Mon, 19 Sep 2022 14:15:12 +0200
|
||||
Subject: [PATCH] nslookup: sanitize all printed strings with printable_string
|
||||
|
||||
Otherwise, terminal sequences can be injected, which enables various terminal injection
|
||||
attacks from DNS results.
|
||||
|
||||
CVE: CVE-2022-28391
|
||||
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
|
||||
Tested-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Backport from ML: http://lists.busybox.net/pipermail/busybox/2022-July/089795.html
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
---
|
||||
networking/nslookup.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/networking/nslookup.c b/networking/nslookup.c
|
||||
index b67d354f7..79412477c 100644
|
||||
--- a/networking/nslookup.c
|
||||
+++ b/networking/nslookup.c
|
||||
@@ -784,7 +784,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Unable to uncompress domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf(format, ns_rr_name(rr), dname);
|
||||
+ printf(format, ns_rr_name(rr), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_mx:
|
||||
@@ -799,7 +799,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
//printf("Cannot uncompress MX domain: %s\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
- printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, dname);
|
||||
+ printf("%s\tmail exchanger = %d %s\n", ns_rr_name(rr), n, printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_txt:
|
||||
@@ -811,7 +811,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
if (n > 0) {
|
||||
memset(dname, 0, sizeof(dname));
|
||||
memcpy(dname, ns_rr_rdata(rr) + 1, n);
|
||||
- printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), dname);
|
||||
+ printf("%s\ttext = \"%s\"\n", ns_rr_name(rr), printable_string(dname));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -831,7 +831,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
}
|
||||
|
||||
printf("%s\tservice = %u %u %u %s\n", ns_rr_name(rr),
|
||||
- ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), dname);
|
||||
+ ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), printable_string(dname));
|
||||
break;
|
||||
|
||||
case ns_t_soa:
|
||||
@@ -860,7 +860,7 @@ static NOINLINE int parse_reply(const unsigned char *msg, size_t len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- printf("\tmail addr = %s\n", dname);
|
||||
+ printf("\tmail addr = %s\n", printable_string(dname));
|
||||
cp += n;
|
||||
|
||||
printf("\tserial = %lu\n", ns_get32(cp));
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
From 9fed109be1f811069cb2f727e04c6996cd44b017 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
|
||||
Date: Tue, 18 Apr 2023 15:54:43 +0200
|
||||
Subject: [PATCH] seedrng: fix getrandom() detection for non-glibc libc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc <= 2.24 does not provide getrandom(). A check for it has been
|
||||
added in 200a9669fbf6f06894e4243cccc9fc11a1a6073a and fixed in
|
||||
cb57abb46f06f4ede8d9ccbdaac67377fdf416cf.
|
||||
|
||||
However, building with a libc other than glibc can lead to the same
|
||||
problem as not every other libc has getrandom() either:
|
||||
|
||||
- uClibc provides it from v1.0.2 onwards, but requires to define
|
||||
_GNU_SOURCE (all versions - we already define it by default), and
|
||||
stddef to be included first (when using uClibc < 1.0.35 - we already
|
||||
include it through libbb.h).
|
||||
|
||||
- musl libc has getrandom(), but only from version 1.1.20 onwards. As
|
||||
musl does not provide __MUSL__ or version information, it's not
|
||||
possible to check for it like we did for glibc.
|
||||
|
||||
All of this makes it difficult (or impossible in case of musl) to
|
||||
check what we need to do to have getrandom() based on each libc
|
||||
versions.
|
||||
|
||||
On top of that, getrandom() is also not available on older kernels. As
|
||||
an example, when using a 3.10 kernel with uClibc 1.0.26, getrandom()
|
||||
is declared so compiling works, but it fails at link time because
|
||||
getrandom() is not defined.
|
||||
|
||||
To make it easier, take a similar approach to what was done for the
|
||||
crypt library: try to build a sample program to see if we have
|
||||
getrandom(). To keep it compatible with different versions of
|
||||
make (for reference see [1]), a variable for '#' is also introduced.
|
||||
|
||||
Based on the new Makefile variable, we now either use the
|
||||
libc-provided getrandom() when it's available, or use our own
|
||||
implementation when it's not (like it was the case already for glibc <
|
||||
2.25).
|
||||
|
||||
This should fix compiling with many libc/kernel combinations.
|
||||
|
||||
[1]: https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b576b907b06aea5f4
|
||||
|
||||
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2023-May/090317.html
|
||||
---
|
||||
Makefile.flags | 12 ++++++++++++
|
||||
miscutils/seedrng.c | 8 ++++----
|
||||
2 files changed, 16 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.flags b/Makefile.flags
|
||||
index 92a9063d9..c8f601308 100644
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -162,6 +162,18 @@ ifeq ($(RT_AVAILABLE),y)
|
||||
LDLIBS += rt
|
||||
endif
|
||||
|
||||
+# GNU Make version 4.2.1 and earlier require number signs ('#')
|
||||
+# inside function invocations to be escaped, while versions 4.3+
|
||||
+# require them to be unescaped. Use a variable for it so that it works
|
||||
+# for both versions:
|
||||
+C := \#
|
||||
+# Not all libc versions have getrandom, so check for it:
|
||||
+HAVE_GETRANDOM := $(shell printf '$Cdefine _GNU_SOURCE\n$Cinclude <stddef.h>\n$Cinclude <sys/random.h>\nint main(void){char buf[256];\ngetrandom(buf,sizeof(buf),0);}' >bb_libtest.c; $(CC) $(CFLAGS) $(CFLAGS_busybox) -o /dev/null bb_libtest.c >/dev/null 2>&1 && echo "y"; rm bb_libtest.c)
|
||||
+
|
||||
+ifeq ($(HAVE_GETRANDOM),y)
|
||||
+CFLAGS += -DHAVE_GETRANDOM
|
||||
+endif
|
||||
+
|
||||
# libpam may use libpthread, libdl and/or libaudit.
|
||||
# On some platforms that requires an explicit -lpthread, -ldl, -laudit.
|
||||
# However, on *other platforms* it fails when some of those flags
|
||||
diff --git a/miscutils/seedrng.c b/miscutils/seedrng.c
|
||||
index 7a2331cb1..ba98f4d19 100644
|
||||
--- a/miscutils/seedrng.c
|
||||
+++ b/miscutils/seedrng.c
|
||||
@@ -44,8 +44,10 @@
|
||||
#include <linux/random.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
-/* Fix up glibc <= 2.24 not having getrandom() */
|
||||
-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 24
|
||||
+/* Fix up some libc (e.g. glibc <= 2.24) not having getrandom() */
|
||||
+#if defined HAVE_GETRANDOM
|
||||
+#include <sys/random.h>
|
||||
+#else /* No getrandom */
|
||||
#include <sys/syscall.h>
|
||||
static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
{
|
||||
@@ -56,8 +58,6 @@ static ssize_t getrandom(void *buffer, size_t length, unsigned flags)
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
-#else
|
||||
-#include <sys/random.h>
|
||||
#endif
|
||||
|
||||
/* Apparently some headers don't ship with this yet. */
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
From 1dbb3073a3a8856b9446b882f797be1bb2e21a26 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
|
||||
Date: Mon, 23 Sep 2024 18:56:00 +0200
|
||||
Subject: [PATCH] tc: Fix compilation with Linux v6.8-rc1
|
||||
|
||||
Linux v6.8-rc1 removed the definitions related to CBQ:
|
||||
https://github.com/torvalds/linux/commit/33241dca486264193ed68167c8eeae1fb197f3df
|
||||
making tc fail to build.
|
||||
Add some #ifdefs to handle this missing support.
|
||||
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-March/090678.html
|
||||
Bug report: https://bugs.busybox.net/show_bug.cgi?id=15931
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
networking/tc.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/networking/tc.c b/networking/tc.c
|
||||
index 3a79fd2d9..d08fd1359 100644
|
||||
--- a/networking/tc.c
|
||||
+++ b/networking/tc.c
|
||||
@@ -231,6 +231,13 @@ static int cbq_parse_opt(int argc, char **argv, struct nlmsghdr *n)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+#ifndef TCA_CBQ_MAX
|
||||
+/*
|
||||
+ * Linux v6.8-rc1~131^2~60^2^2 removed the uapi definitions for CBQ.
|
||||
+ * See https://git.kernel.org/linus/33241dca48626
|
||||
+ */
|
||||
+#else
|
||||
static int cbq_print_opt(struct rtattr *opt)
|
||||
{
|
||||
struct rtattr *tb[TCA_CBQ_MAX+1];
|
||||
@@ -322,6 +329,7 @@ static int cbq_print_opt(struct rtattr *opt)
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static FAST_FUNC int print_qdisc(
|
||||
const struct sockaddr_nl *who UNUSED_PARAM,
|
||||
@@ -372,8 +380,10 @@ static FAST_FUNC int print_qdisc(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
prio_print_opt(tb[TCA_OPTIONS]);
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this qdisc */
|
||||
printf("(options for %s)", name);
|
||||
@@ -442,9 +452,11 @@ static FAST_FUNC int print_class(
|
||||
int qqq = index_in_strings(_q_, name);
|
||||
if (qqq == 0) { /* pfifo_fast aka prio */
|
||||
/* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/
|
||||
+#ifdef TCA_CBQ_MAX
|
||||
} else if (qqq == 1) { /* class based queuing */
|
||||
/* cbq_print_copt() is identical to cbq_print_opt(). */
|
||||
cbq_print_opt(tb[TCA_OPTIONS]);
|
||||
+#endif
|
||||
} else {
|
||||
/* don't know how to print options for this class */
|
||||
printf("(options for %s)", name);
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From 88f8a046f27cb81ccc30d038465e963b8300cf1b Mon Sep 17 00:00:00 2001
|
||||
From: Valery Ushakov <uwe@stderr.spb.ru>
|
||||
Date: Wed, 24 Jan 2024 22:24:41 +0300
|
||||
Subject: [PATCH] awk.c: fix CVE-2023-42366 (bug #15874)
|
||||
|
||||
Make sure we don't read past the end of the string in next_token()
|
||||
when backslash is the last character in an (invalid) regexp.
|
||||
a fix and issue reported in bugzilla
|
||||
|
||||
https://bugs.busybox.net/show_bug.cgi?id=15874
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html]
|
||||
|
||||
CVE: CVE-2023-42366
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Thomas: https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch?id=e0ff4813b1cf4df0d851c857d57fb88d7db51bdd]
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2024-May/090766.html
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
editors/awk.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/editors/awk.c b/editors/awk.c
|
||||
index 64e752f4b..222e6298d 100644
|
||||
--- a/editors/awk.c
|
||||
+++ b/editors/awk.c
|
||||
@@ -1234,9 +1234,11 @@ static uint32_t next_token(uint32_t expected)
|
||||
s[-1] = bb_process_escape_sequence((const char **)&pp);
|
||||
if (*p == '\\')
|
||||
*s++ = '\\';
|
||||
- if (pp == p)
|
||||
+ if (pp == p) {
|
||||
+ if (*p == '\0')
|
||||
+ syntax_error(EMSG_UNEXP_EOS);
|
||||
*s++ = *p++;
|
||||
- else
|
||||
+ } else
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0583f8eda94f97e15e371e12458877b738439e8c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 7 Mar 2021 17:30:24 -0800
|
||||
Subject: [PATCH] hwclock: Check for SYS_settimeofday before calling syscall
|
||||
|
||||
Some newer architectures e.g. RISCV32 have 64bit time_t from get go and
|
||||
thusly do not have gettimeofday_time64/settimeofday_time64 implemented
|
||||
therefore check for SYS_settimeofday definition before making the
|
||||
syscall. Fixes build for riscv32 and it will bail out at runtime.
|
||||
|
||||
Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-March/088583.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Upstream: http://lists.busybox.net/pipermail/busybox/2021-March/088583.html
|
||||
[Thomas: this issue has been discussed on the musl mailing list, and
|
||||
the musl developers' opinion is that Busybox is wrong:
|
||||
https://www.openwall.com/lists/musl/2024/03/03/2
|
||||
https://www.openwall.com/lists/musl/2024/04/07/2. The correct fix
|
||||
isn't clear, and in the mean time, the patch from Khem turns the build
|
||||
issue into a runtime error only on the problematic architecture, which
|
||||
seems like a reasonable trade-off]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
util-linux/hwclock.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
|
||||
index c3fd0eb57..dea9c9a55 100644
|
||||
--- a/util-linux/hwclock.c
|
||||
+++ b/util-linux/hwclock.c
|
||||
@@ -132,6 +132,7 @@ static void show_clock(const char **pp_rtcname, int utc)
|
||||
|
||||
static void set_kernel_tz(const struct timezone *tz)
|
||||
{
|
||||
+ int ret = 1;
|
||||
#if LIBC_IS_MUSL
|
||||
/* musl libc does not pass tz argument to syscall
|
||||
* because "it's deprecated by POSIX, therefore it's fine
|
||||
@@ -140,9 +141,11 @@ static void set_kernel_tz(const struct timezone *tz)
|
||||
#if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32)
|
||||
# define SYS_settimeofday SYS_settimeofday_time32
|
||||
#endif
|
||||
- int ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#if defined(SYS_settimeofday)
|
||||
+ ret = syscall(SYS_settimeofday, NULL, tz);
|
||||
+#endif
|
||||
#else
|
||||
- int ret = settimeofday(NULL, tz);
|
||||
+ ret = settimeofday(NULL, tz);
|
||||
#endif
|
||||
if (ret)
|
||||
bb_simple_perror_msg_and_die("settimeofday");
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 34d331d642c3312e1c04e4650f547f1a67abee24 Mon Sep 17 00:00:00 2001
|
||||
From: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Date: Wed, 16 Oct 2024 10:15:08 +0200
|
||||
Subject: [PATCH] syslogd: fix wrong OPT_locallog flag detection
|
||||
|
||||
The OPT_locallog was set on "option_mask32" but checked on local
|
||||
"opts" variable. While this flag it's used on multiple places can't be
|
||||
has to be used with "option_mask32". Without this change syslogd
|
||||
is more-less unusable while no messages are logged locally.
|
||||
|
||||
Signed-off-by: Andrej Valek <andrej.v@skyrain.eu>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2024-October/090969.html
|
||||
[Thomas: this was reported as beeing needed by Bernd Kuhls at
|
||||
https://lore.kernel.org/buildroot/pan$de0bb$35c5a64$ca9b6f21$2408ff40@ID-313208.user.individual.net/,
|
||||
but also on the Busybox mailing list at
|
||||
https://lists.busybox.net/pipermail/busybox/2023-September/090499.html]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
sysklogd/syslogd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
|
||||
index 7558051f0..fa03aa280 100644
|
||||
--- a/sysklogd/syslogd.c
|
||||
+++ b/sysklogd/syslogd.c
|
||||
@@ -1179,7 +1179,7 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
- if (!ENABLE_FEATURE_REMOTE_LOG || (opts & OPT_locallog)) {
|
||||
+ if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) {
|
||||
recvbuf[sz] = '\0'; /* ensure it *is* NUL terminated */
|
||||
split_escape_and_log(recvbuf, sz);
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 7378db981d87b4a2264e14d60340a7fb5c67ae59 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Marko <peter.marko@siemens.com>
|
||||
Date: Fri, 3 Oct 2025 16:12:56 +0200
|
||||
Subject: [PATCH] testsuite/tar.tests: fix test after CVE-2025-46394
|
||||
|
||||
tar now sanitizes output and this test needs to expect that.
|
||||
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
|
||||
CVE: CVE-2025-46394
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2025-October/091743.html
|
||||
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
|
||||
---
|
||||
testsuite/tar.tests | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/testsuite/tar.tests b/testsuite/tar.tests
|
||||
index 0f2e89112..48fc38114 100755
|
||||
--- a/testsuite/tar.tests
|
||||
+++ b/testsuite/tar.tests
|
||||
@@ -325,9 +325,9 @@ unset LANG
|
||||
rm -rf etc usr
|
||||
' "\
|
||||
etc/ssl/certs/3b2716e5.0
|
||||
-etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
|
||||
+etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??.pem
|
||||
etc/ssl/certs/f80cc7f6.0
|
||||
-usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
|
||||
+usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sa??lay??c??s??.crt
|
||||
0
|
||||
etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
|
||||
etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem -> /usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
|
||||
@@ -0,0 +1,42 @@
|
||||
From: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Date: Fri, 21 Nov 2025 11:21:18 +0200
|
||||
Subject: wget: don't allow control characters or spaces in the URL
|
||||
Forwarded: yes, https://lists.busybox.net/pipermail/busybox/2025-November/091840.html
|
||||
Bug-Debian: https://bugs.debian.org/1120795
|
||||
|
||||
Fixes CVE-2025-60876 malicious URL can be used to inject
|
||||
HTTP headers in the request.
|
||||
|
||||
Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
|
||||
Reviewed-by: Emmanuel Deloget <logout@free.fr>
|
||||
Upstream: https://sources.debian.org/data/main/b/busybox/1%3A1.37.0-10/debian/patches/wget-disallow-control-chars-in-URLs-CVE-2025-60876.patch
|
||||
Upstream: https://lists.busybox.net/pipermail/busybox/2025-November/091840.html
|
||||
CVE: CVE-2025-60876
|
||||
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
|
||||
---
|
||||
networking/wget.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/networking/wget.c b/networking/wget.c
|
||||
index ec3767793..fa555427b 100644
|
||||
--- a/networking/wget.c
|
||||
+++ b/networking/wget.c
|
||||
@@ -536,6 +536,15 @@ static void parse_url(const char *src_url, struct host_info *h)
|
||||
{
|
||||
char *url, *p, *sp;
|
||||
|
||||
+ /* Fix for CVE-2025-60876 - don't allow control characters or spaces in the URL */
|
||||
+ /* otherwise a malicious URL can be used to inject HTTP headers in the request */
|
||||
+ const unsigned char *u = (void *) src_url;
|
||||
+ while (*u) {
|
||||
+ if (*u <= ' ')
|
||||
+ bb_simple_error_msg_and_die("Unencoded control character found in the URL!");
|
||||
+ u++;
|
||||
+ }
|
||||
+
|
||||
free(h->allocated);
|
||||
h->allocated = url = xstrdup(src_url);
|
||||
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From: Valery Ushakov <valery.ushakov@bell-sw.com>
|
||||
Date: Thu, 21 Aug 2025 12:31:53 +0000
|
||||
Subject: netstat: CVE-2024-58251 - sanitize argv0 for -p
|
||||
Bug-Debian: https://bugs.debian.org/1104009
|
||||
|
||||
Signed-off-by: Valery Ushakov <valery.ushakov@bell-sw.com>
|
||||
Upstream: https://salsa.debian.org/installer-team/busybox/-/blob/master/debian/patches/netstat-sanitize-argv0-for-p-CVE-2024-58251.patch
|
||||
CVE: CVE-2024-58251
|
||||
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
|
||||
---
|
||||
networking/netstat.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/networking/netstat.c b/networking/netstat.c
|
||||
index 807800a62..d979f6079 100644
|
||||
--- a/networking/netstat.c
|
||||
+++ b/networking/netstat.c
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include "libbb.h"
|
||||
#include "inet_common.h"
|
||||
+#include "unicode.h"
|
||||
|
||||
//usage:#define netstat_trivial_usage
|
||||
//usage: "[-"IF_ROUTE("r")"al] [-tuwx] [-en"IF_FEATURE_NETSTAT_WIDE("W")IF_FEATURE_NETSTAT_PRG("p")"]"
|
||||
@@ -314,9 +315,12 @@ static int FAST_FUNC dir_act(struct recursive_state *state,
|
||||
return FALSE;
|
||||
cmdline_buf[n] = '\0';
|
||||
|
||||
+ /* don't write process-controlled argv[0] to the user's terminal as-is */
|
||||
+ const char *argv0base = printable_string(bb_basename(cmdline_buf));
|
||||
+
|
||||
/* go through all files in /proc/PID/fd and check whether they are sockets */
|
||||
strcpy(proc_pid_fname + len - (sizeof("cmdline")-1), "fd");
|
||||
- pid_slash_progname = concat_path_file(pid, bb_basename(cmdline_buf)); /* "PID/argv0" */
|
||||
+ pid_slash_progname = concat_path_file(pid, argv0base); /* "PID/argv0" */
|
||||
n = recursive_action(proc_pid_fname,
|
||||
ACTION_RECURSE | ACTION_QUIET,
|
||||
add_to_prg_cache_if_socket,
|
||||
@@ -686,6 +690,7 @@ int netstat_main(int argc UNUSED_PARAM, char **argv)
|
||||
unsigned opt;
|
||||
|
||||
INIT_G();
|
||||
+ init_unicode();
|
||||
|
||||
/* Option string must match NETSTAT_xxx constants */
|
||||
opt = getopt32(argv, NETSTAT_OPTS);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
110
package/busybox/Config.in
Normal file
110
package/busybox/Config.in
Normal file
@@ -0,0 +1,110 @@
|
||||
config BR2_PACKAGE_BUSYBOX
|
||||
bool "BusyBox"
|
||||
default y
|
||||
help
|
||||
The Swiss Army Knife of embedded Linux. It slices, it dices,
|
||||
it makes Julian Fries.
|
||||
|
||||
http://busybox.net/
|
||||
|
||||
Most people will answer Y.
|
||||
|
||||
if BR2_PACKAGE_BUSYBOX
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_CONFIG
|
||||
string "BusyBox configuration file to use?"
|
||||
default "package/busybox/busybox-minimal.config" if !BR2_USE_MMU
|
||||
default "package/busybox/busybox.config"
|
||||
help
|
||||
Some people may wish to use their own modified BusyBox
|
||||
configuration file, and will specify their config file
|
||||
location with this option.
|
||||
|
||||
Most people will just use the default BusyBox configuration
|
||||
file.
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES
|
||||
string "Additional BusyBox configuration fragment files"
|
||||
help
|
||||
A space-separated list of configuration fragment files,
|
||||
that will be merged to the main BusyBox configuration file.
|
||||
|
||||
# This option is not an option of Busybox, it can be selected even
|
||||
# if Busybox is not enabled.
|
||||
config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
|
||||
bool "Show packages that are also provided by busybox"
|
||||
help
|
||||
Show packages in menuconfig that are potentially also provided
|
||||
by busybox.
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_SELINUX
|
||||
bool "Enable SELinux support"
|
||||
default y
|
||||
depends on BR2_PACKAGE_LIBSELINUX
|
||||
select BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
|
||||
help
|
||||
Enable SELinux support in BusyBox. Please note that
|
||||
depending on your BusyBox configuration and the SELinux
|
||||
policy implementation, you may want to also enable
|
||||
BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES.
|
||||
|
||||
For instance, if your BusyBox configuration only uses a
|
||||
couple of minor BusyBox features, such as simple command
|
||||
line utilities, the symlinked version of BusyBox can be used
|
||||
to save space. If BusyBox provides more features, such as
|
||||
crond, then individual binaries have to be enabled for the
|
||||
SELinux type transitions to occur properly.
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES
|
||||
bool "Individual binaries"
|
||||
depends on !BR2_STATIC_LIBS
|
||||
help
|
||||
By default (i.e with this option disabled), Busybox is
|
||||
installed as a single binary in /bin/busybox and all applets
|
||||
are a symbolic link to /bin/busybox.
|
||||
|
||||
With this option enabled, each applet is a separate binary,
|
||||
which is needed for proper operation with SELinux.
|
||||
|
||||
comment "Busybox individual binaries need a toolchain w/ dynamic library"
|
||||
depends on BR2_STATIC_LIBS
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_HTTPD
|
||||
bool "Install the httpd server startup script"
|
||||
help
|
||||
Install the httpd server startup script,
|
||||
that just start at the boot the busybox httpd server
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_WATCHDOG
|
||||
bool "Install the watchdog daemon startup script"
|
||||
help
|
||||
Install the watchdog daemon startup script,
|
||||
that just start at the boot the busybox watchdog daemon.
|
||||
|
||||
if BR2_PACKAGE_BUSYBOX_WATCHDOG
|
||||
|
||||
config BR2_PACKAGE_BUSYBOX_WATCHDOG_PERIOD
|
||||
string "Delay between reset"
|
||||
default "5"
|
||||
help
|
||||
Select the number of seconds between each
|
||||
reset of the watchdog (default 5)
|
||||
|
||||
Use ms suffix to specify milliseconds (e.g. 500ms)
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if !BR2_PACKAGE_BUSYBOX # kconfig doesn't support else
|
||||
|
||||
comment "You may need to enable other packages to get a working system"
|
||||
comment "You better know what you're doing!"
|
||||
|
||||
# This option is not an option of Busybox, it can be selected even if
|
||||
# Busybox is not enabled. This dummy option ensures that packages that
|
||||
# depend on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS are visible when Busybox
|
||||
# is disabled.
|
||||
config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
|
||||
default y
|
||||
endif
|
||||
60
package/busybox/S01syslogd
Normal file
60
package/busybox/S01syslogd
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="syslogd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
SYSLOGD_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' syslogd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "--make-pidfile" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/sbin/$DAEMON" \
|
||||
-- -n $SYSLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
60
package/busybox/S02klogd
Normal file
60
package/busybox/S02klogd
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="klogd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
KLOGD_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' klogd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "-m" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/sbin/$DAEMON" \
|
||||
-- -n $KLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
1
package/busybox/S02sysctl
Symbolic link
1
package/busybox/S02sysctl
Symbolic link
@@ -0,0 +1 @@
|
||||
../procps-ng/S02sysctl
|
||||
42
package/busybox/S10mdev
Normal file
42
package/busybox/S10mdev
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Run the mdev daemon
|
||||
#
|
||||
|
||||
DAEMON="mdev"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
|
||||
start() {
|
||||
echo -n "Starting $DAEMON... "
|
||||
start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
|
||||
[ $? -eq 0 ] && echo "OK" || echo "ERROR"
|
||||
|
||||
# coldplug modules
|
||||
find /sys/ -name modalias -print0 | \
|
||||
xargs -0 sort -u | \
|
||||
tr '\n' '\0' | \
|
||||
xargs -0 modprobe -abq
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping $DAEMON... "
|
||||
start-stop-daemon -K -p $PIDFILE
|
||||
[ $? -eq 0 ] && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
20
package/busybox/S15watchdog
Normal file
20
package/busybox/S15watchdog
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start watchdog
|
||||
#
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting watchdog..."
|
||||
watchdog -t PERIOD /dev/watchdog
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
restart|reload)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
85
package/busybox/S41ifplugd
Normal file
85
package/busybox/S41ifplugd
Normal file
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="ifplugd"
|
||||
|
||||
# Each ifplugd instance handles only one interface, so this script is
|
||||
# designed to be symlinked per interface. For each interface create a
|
||||
# symlink with .IFACE appended to the name. E.g. to launch ifplugd for
|
||||
# eth1 create a symlink from /etc/init.d/S41ifplugd.eth1 to this
|
||||
# script. DEFAULT_IFACE sets the interface the non-symlink script will
|
||||
# use, set it to empty in /etc/default/ifplugd to disable the default
|
||||
# instance and use symlinked instances only.
|
||||
DEFAULT_IFACE="eth0"
|
||||
# If your action script is not in the default location
|
||||
# /etc/ifplugd/ifplugd.action, use the "-r" option to set the
|
||||
# location.
|
||||
IFPLUGD_ARGS="-M"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
NAME_IFACE="$(basename "$0" | cut -s -d. -f2)"
|
||||
if [ -n "$NAME_IFACE" ]; then
|
||||
IFACE="${NAME_IFACE}"
|
||||
elif [ -n "$DEFAULT_IFACE" ]; then
|
||||
IFACE="${DEFAULT_IFACE}"
|
||||
else
|
||||
# no interface configured
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# check-package disable Variables
|
||||
PIDFILE="/var/run/${DAEMON}.${IFACE}.pid"
|
||||
IFPLUGD_ARGS="${IFPLUGD_ARGS} -i ${IFACE}"
|
||||
|
||||
# BusyBox' ifplugd does not create a pidfile, so pass "-n" in the
|
||||
# command line and use "--make-pidfile" to instruct start-stop-daemon
|
||||
# to create one.
|
||||
start() {
|
||||
printf 'Starting %s for %s: ' "$DAEMON" "$IFACE"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -n $IFPLUGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s for %s: ' "$DAEMON" "$IFACE"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
60
package/busybox/S50crond
Normal file
60
package/busybox/S50crond
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="crond"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
CROND_ARGS=""
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' crond does not create a pidfile, so pass "-f" on the crond
|
||||
# command line and use "--make-pidfile" to instruct start-stop-daemon
|
||||
# to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -f $CROND_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
39
package/busybox/S50telnet
Normal file
39
package/busybox/S50telnet
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start telnet....
|
||||
#
|
||||
|
||||
TELNETD_ARGS=-F
|
||||
[ -r /etc/default/telnet ] && . /etc/default/telnet
|
||||
|
||||
start() {
|
||||
printf "Starting telnetd: "
|
||||
start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd -- $TELNETD_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping telnetd: "
|
||||
start-stop-daemon -K -q -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
59
package/busybox/S90httpd
Normal file
59
package/busybox/S90httpd
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="httpd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
HTTPD_ARGS="-h /var/www/data"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
# BusyBox' httpd does not create a pidfile, so pass "-f" in the command line
|
||||
# and use "--make-pidfile" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --quiet --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- -f $HTTPD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --quiet --pidfile "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
1212
package/busybox/busybox-minimal.config
Normal file
1212
package/busybox/busybox-minimal.config
Normal file
File diff suppressed because it is too large
Load Diff
1228
package/busybox/busybox.config
Normal file
1228
package/busybox/busybox.config
Normal file
File diff suppressed because it is too large
Load Diff
5
package/busybox/busybox.hash
Normal file
5
package/busybox/busybox.hash
Normal file
@@ -0,0 +1,5 @@
|
||||
# From https://www.busybox.net/downloads/busybox-1.38.0.tar.bz2.sha256
|
||||
sha256 34f9ea6ff8636f2c9241153b9114eefa9e65674a45318ae1ef95bb5f31c53bb2 busybox-1.38.0.tar.bz2
|
||||
# Locally computed
|
||||
sha256 bbfc9843646d483c334664f651c208b9839626891d8f17604db2146962f43548 LICENSE
|
||||
sha256 b5a136ed67798e51fe2e0ca0b2a21cb01b904ff0c9f7d563a6292e276607e58f archival/libarchive/bz/LICENSE
|
||||
517
package/busybox/busybox.mk
Normal file
517
package/busybox/busybox.mk
Normal file
@@ -0,0 +1,517 @@
|
||||
################################################################################
|
||||
#
|
||||
# busybox
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BUSYBOX_VERSION = 1.38.0
|
||||
BUSYBOX_SITE = https://www.busybox.net/downloads
|
||||
BUSYBOX_SOURCE = busybox-$(BUSYBOX_VERSION).tar.bz2
|
||||
BUSYBOX_LICENSE = GPL-2.0, bzip2-1.0.6
|
||||
BUSYBOX_LICENSE_FILES = LICENSE archival/libarchive/bz/LICENSE
|
||||
BUSYBOX_CPE_ID_VENDOR = busybox
|
||||
|
||||
# 0003-libbb-sockaddr2str-ensure-only-printable-characters-.patch
|
||||
# 0004-nslookup-sanitize-all-printed-strings-with-printable.patch
|
||||
BUSYBOX_IGNORE_CVES += CVE-2022-28391
|
||||
|
||||
# This is not stale, NVD entry mentions up to version 1.36.1.
|
||||
# 0007-awk.c-fix-CVE-2023-42366-bug-15874.patch
|
||||
BUSYBOX_IGNORE_CVES += CVE-2023-42366
|
||||
|
||||
# 0012-netstat-sanitize-argv0-for-p-CVE-2024-58251.patch
|
||||
BUSYBOX_IGNORE_CVES += CVE-2024-58251
|
||||
|
||||
# 0010-testsuite-tar-tests-fix-test-after-cve-2025-46394.patch
|
||||
BUSYBOX_IGNORE_CVES += CVE-2025-46394
|
||||
|
||||
# 0011-wget-dont-allow-control-characters-or-spaces-in-the-URL.patch
|
||||
BUSYBOX_IGNORE_CVES += CVE-2025-60876
|
||||
|
||||
BUSYBOX_CFLAGS = \
|
||||
$(TARGET_CFLAGS)
|
||||
|
||||
BUSYBOX_LDFLAGS = \
|
||||
$(TARGET_LDFLAGS)
|
||||
|
||||
# Packages that provide commands that may also be busybox applets:
|
||||
BUSYBOX_DEPENDENCIES = \
|
||||
$(if $(BR2_PACKAGE_ATTR),attr) \
|
||||
$(if $(BR2_PACKAGE_BASH),bash) \
|
||||
$(if $(BR2_PACKAGE_BC),bc) \
|
||||
$(if $(BR2_PACKAGE_BINUTILS),binutils) \
|
||||
$(if $(BR2_PACKAGE_COREUTILS),coreutils) \
|
||||
$(if $(BR2_PACKAGE_CPIO),cpio) \
|
||||
$(if $(BR2_PACKAGE_DCRON),dcron) \
|
||||
$(if $(BR2_PACKAGE_DEBIANUTILS),debianutils) \
|
||||
$(if $(BR2_PACKAGE_DIFFUTILS),diffutils) \
|
||||
$(if $(BR2_PACKAGE_DOS2UNIX),dos2unix) \
|
||||
$(if $(BR2_PACKAGE_DOSFSTOOLS),dosfstools) \
|
||||
$(if $(BR2_PACKAGE_E2FSPROGS),e2fsprogs) \
|
||||
$(if $(BR2_PACKAGE_FBSET),fbset) \
|
||||
$(if $(BR2_PACKAGE_GAWK),gawk) \
|
||||
$(if $(BR2_PACKAGE_GREP),grep) \
|
||||
$(if $(BR2_PACKAGE_GZIP),gzip) \
|
||||
$(if $(BR2_PACKAGE_I2C_TOOLS),i2c-tools) \
|
||||
$(if $(BR2_PACKAGE_IFENSLAVE),ifenslave) \
|
||||
$(if $(BR2_PACKAGE_IFPLUGD),ifplugd) \
|
||||
$(if $(BR2_PACKAGE_IFUPDOWN),ifupdown) \
|
||||
$(if $(BR2_PACKAGE_IPCALC),ipcalc) \
|
||||
$(if $(BR2_PACKAGE_IPROUTE2),iproute2) \
|
||||
$(if $(BR2_PACKAGE_IPUTILS),iputils) \
|
||||
$(if $(BR2_PACKAGE_KMOD),kmod) \
|
||||
$(if $(BR2_PACKAGE_LESS),less) \
|
||||
$(if $(BR2_PACKAGE_LSOF),lsof) \
|
||||
$(if $(BR2_PACKAGE_MTD),mtd) \
|
||||
$(if $(BR2_PACKAGE_NET_TOOLS),net-tools) \
|
||||
$(if $(BR2_PACKAGE_NETCAT),netcat) \
|
||||
$(if $(BR2_PACKAGE_NETCAT_OPENBSD),netcat-openbsd) \
|
||||
$(if $(BR2_PACKAGE_NMAP),nmap) \
|
||||
$(if $(BR2_PACKAGE_NTP),ntp) \
|
||||
$(if $(BR2_PACKAGE_PCIUTILS),pciutils) \
|
||||
$(if $(BR2_PACKAGE_PROCPS_NG),procps-ng) \
|
||||
$(if $(BR2_PACKAGE_PSMISC),psmisc) \
|
||||
$(if $(BR2_PACKAGE_START_STOP_DAEMON),start-stop-daemon) \
|
||||
$(if $(BR2_PACKAGE_SYSKLOGD),sysklogd) \
|
||||
$(if $(BR2_PACKAGE_SYSTEMD),systemd) \
|
||||
$(if $(BR2_PACKAGE_SYSVINIT),sysvinit) \
|
||||
$(if $(BR2_PACKAGE_TAR),tar) \
|
||||
$(if $(BR2_PACKAGE_TFTPD),tftpd) \
|
||||
$(if $(BR2_PACKAGE_TRACEROUTE),traceroute) \
|
||||
$(if $(BR2_PACKAGE_UGETTY),ugetty) \
|
||||
$(if $(BR2_PACKAGE_UNZIP),unzip) \
|
||||
$(if $(BR2_PACKAGE_USBUTILS),usbutils) \
|
||||
$(if $(BR2_PACKAGE_UTIL_LINUX),util-linux) \
|
||||
$(if $(BR2_PACKAGE_TINYINIT),tinyinit) \
|
||||
$(if $(BR2_PACKAGE_VIM),vim) \
|
||||
$(if $(BR2_PACKAGE_WATCHDOG),watchdog) \
|
||||
$(if $(BR2_PACKAGE_WGET),wget) \
|
||||
$(if $(BR2_PACKAGE_WHOIS),whois)
|
||||
|
||||
# Link against libtirpc if available so that we can leverage its RPC
|
||||
# support for NFS mounting with BusyBox
|
||||
ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
|
||||
BUSYBOX_DEPENDENCIES += libtirpc host-pkgconf
|
||||
BUSYBOX_CFLAGS += "`$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`"
|
||||
# Don't use LDFLAGS for -ltirpc, because LDFLAGS is used for
|
||||
# the non-final link of modules as well.
|
||||
BUSYBOX_CFLAGS_busybox += "`$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`"
|
||||
endif
|
||||
|
||||
# Allows the build system to tweak CFLAGS
|
||||
BUSYBOX_MAKE_ENV = \
|
||||
$(TARGET_MAKE_ENV) \
|
||||
CFLAGS="$(BUSYBOX_CFLAGS)" \
|
||||
CFLAGS_busybox="$(BUSYBOX_CFLAGS_busybox)"
|
||||
|
||||
ifeq ($(BR2_REPRODUCIBLE),y)
|
||||
BUSYBOX_MAKE_ENV += \
|
||||
KCONFIG_NOTIMESTAMP=1
|
||||
endif
|
||||
|
||||
BUSYBOX_MAKE_OPTS = \
|
||||
AR="$(TARGET_AR)" \
|
||||
NM="$(TARGET_NM)" \
|
||||
RANLIB="$(TARGET_RANLIB)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
ARCH=$(NORMALIZED_ARCH) \
|
||||
PREFIX="$(TARGET_DIR)" \
|
||||
EXTRA_LDFLAGS="$(BUSYBOX_LDFLAGS)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
CONFIG_PREFIX="$(TARGET_DIR)" \
|
||||
SKIP_STRIP=y
|
||||
|
||||
# specifying BUSYBOX_CONFIG_FILE on the command-line overrides the .config
|
||||
# setting.
|
||||
# check-package disable Ifdef
|
||||
ifndef BUSYBOX_CONFIG_FILE
|
||||
BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
|
||||
endif
|
||||
|
||||
BUSYBOX_KCONFIG_SUPPORTS_DEFCONFIG = NO
|
||||
BUSYBOX_KCONFIG_FILE = $(BUSYBOX_CONFIG_FILE)
|
||||
BUSYBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES))
|
||||
BUSYBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig
|
||||
BUSYBOX_KCONFIG_OPTS = $(BUSYBOX_MAKE_OPTS)
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
|
||||
define BUSYBOX_PERMISSIONS
|
||||
# Set permissions on all applets with BB_SUID_REQUIRE and BB_SUID_MAYBE.
|
||||
# 12 Applets are pulled from applets.h using grep command :
|
||||
# grep -r -e "APPLET.*BB_SUID_REQUIRE\|APPLET.*BB_SUID_MAYBE" \
|
||||
# $(@D)/include/applets.h
|
||||
# These applets are added to the device table and the makedev file
|
||||
# ignores the files with type 'F' ( optional files).
|
||||
/usr/bin/wall F 4755 0 0 - - - - -
|
||||
/bin/ping F 4755 0 0 - - - - -
|
||||
/bin/ping6 F 4755 0 0 - - - - -
|
||||
/usr/bin/crontab F 4755 0 0 - - - - -
|
||||
/sbin/findfs F 4755 0 0 - - - - -
|
||||
/bin/login F 4755 0 0 - - - - -
|
||||
/bin/mount F 4755 0 0 - - - - -
|
||||
/usr/bin/passwd F 4755 0 0 - - - - -
|
||||
/bin/su F 4755 0 0 - - - - -
|
||||
/usr/bin/traceroute F 4755 0 0 - - - - -
|
||||
/usr/bin/traceroute6 F 4755 0 0 - - - - -
|
||||
/usr/bin/vlock F 4755 0 0 - - - - -
|
||||
endef
|
||||
else
|
||||
define BUSYBOX_PERMISSIONS
|
||||
/bin/busybox f 4755 0 0 - - - - -
|
||||
endef
|
||||
endif
|
||||
|
||||
# If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
|
||||
ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
|
||||
define BUSYBOX_INSTALL_MDEV_SCRIPT
|
||||
$(INSTALL) -D -m 0755 package/busybox/S10mdev \
|
||||
$(TARGET_DIR)/etc/init.d/S10mdev
|
||||
endef
|
||||
define BUSYBOX_INSTALL_MDEV_CONF
|
||||
$(INSTALL) -D -m 0644 package/busybox/mdev.conf \
|
||||
$(TARGET_DIR)/etc/mdev.conf
|
||||
endef
|
||||
define BUSYBOX_SET_MDEV
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_MDEV)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_CONF)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_EXEC)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_LOAD_FIRMWARE)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
|
||||
BUSYBOX_DEPENDENCIES += libxcrypt
|
||||
endif
|
||||
|
||||
# sha passwords need USE_BB_CRYPT_SHA
|
||||
ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA256)$(BR2_TARGET_GENERIC_PASSWD_SHA512),y)
|
||||
define BUSYBOX_SET_CRYPT_SHA
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_CRYPT_SHA)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA256),y)
|
||||
define BUSYBOX_SET_DEFAULT_PASSWD_ALGO
|
||||
$(call KCONFIG_SET_OPT,CONFIG_FEATURE_DEFAULT_PASSWD_ALGO,"sha256")
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA512),y)
|
||||
define BUSYBOX_SET_DEFAULT_PASSWD_ALGO
|
||||
$(call KCONFIG_SET_OPT,CONFIG_FEATURE_DEFAULT_PASSWD_ALGO,"sha512")
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_USE_MMU),y)
|
||||
define BUSYBOX_SET_MMU
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_NOMMU)
|
||||
endef
|
||||
else
|
||||
define BUSYBOX_SET_MMU
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_NOMMU)
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_SWAPON)
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_SWAPOFF)
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_ASH)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BASH_COMPAT)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BRACE_EXPANSION)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_HELP)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_INTERACTIVE)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_SAVEHISTORY)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_JOB)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_TICK)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_IF)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOOPS)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_CASE)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_FUNCTIONS)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOCAL)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_RANDOM_SUPPORT)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_EXPORT_N)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_MODE_X)
|
||||
endef
|
||||
endif
|
||||
|
||||
# If we're using static libs do the same for busybox
|
||||
ifeq ($(BR2_STATIC_LIBS),y)
|
||||
define BUSYBOX_PREFER_STATIC
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_STATIC)
|
||||
endef
|
||||
endif
|
||||
|
||||
define BUSYBOX_INSTALL_UDHCPC_SCRIPT
|
||||
if grep -q CONFIG_UDHCPC=y $(@D)/.config; then \
|
||||
$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
|
||||
$(TARGET_DIR)/usr/share/udhcpc/default.script; \
|
||||
$(INSTALL) -m 0755 -d \
|
||||
$(TARGET_DIR)/usr/share/udhcpc/default.script.d; \
|
||||
fi
|
||||
endef
|
||||
|
||||
define BUSYBOX_INSTALL_ZCIP_SCRIPT
|
||||
if grep -q CONFIG_ZCIP=y $(@D)/.config; then \
|
||||
$(INSTALL) -m 0755 -D $(@D)/examples/zcip.script \
|
||||
$(TARGET_DIR)/usr/share/zcip/default.script; \
|
||||
fi
|
||||
endef
|
||||
|
||||
ifeq ($(BR2_INIT_BUSYBOX),y)
|
||||
|
||||
define BUSYBOX_SET_INIT
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_INIT)
|
||||
endef
|
||||
|
||||
ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
|
||||
define BUSYBOX_SET_GETTY
|
||||
$(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(SYSTEM_GETTY_PORT)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \
|
||||
$(TARGET_DIR)/etc/inittab
|
||||
endef
|
||||
else
|
||||
define BUSYBOX_SET_GETTY
|
||||
$(SED) '/# GENERIC_SERIAL$$/s~^.*#~#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 #~' $(TARGET_DIR)/etc/inittab
|
||||
endef
|
||||
endif # BR2_TARGET_GENERIC_GETTY
|
||||
BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_SET_GETTY
|
||||
|
||||
BUSYBOX_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB
|
||||
|
||||
endif # BR2_INIT_BUSYBOX
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX_SELINUX),y)
|
||||
BUSYBOX_DEPENDENCIES += host-pkgconf libselinux libsepol
|
||||
define BUSYBOX_SET_SELINUX
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_SELINUX)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_SELINUXENABLED)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX_HTTPD),y)
|
||||
define BUSYBOX_SET_HTTPD
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_HTTPD)
|
||||
endef
|
||||
define BUSYBOX_INSTALL_HTTPD_SCRIPT
|
||||
if grep -q CONFIG_HTTPD=y $(@D)/.config; then \
|
||||
mkdir -p $(TARGET_DIR)/var/www/data ;\
|
||||
$(INSTALL) -m 0755 -D package/busybox/S90httpd \
|
||||
$(TARGET_DIR)/etc/init.d/S90httpd ; \
|
||||
fi
|
||||
endef
|
||||
endif
|
||||
|
||||
# enable relevant options to allow the Busybox less applet to be used
|
||||
# as a systemd pager
|
||||
ifeq ($(BR2_PACKAGE_SYSTEMD):$(BR2_PACKAGE_LESS),y:)
|
||||
define BUSYBOX_SET_LESS_FLAGS
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_DASHCMD)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_RAW)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_TRUNCATE)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_FLAGS)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_ENV)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
|
||||
define BUSYBOX_SET_INDIVIDUAL_BINARIES
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_BUILD_LIBBUSYBOX)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_INDIVIDUAL)
|
||||
endef
|
||||
|
||||
define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES
|
||||
rm -f $(TARGET_DIR)/bin/busybox
|
||||
endef
|
||||
endif
|
||||
|
||||
# Disable SHA1 and SHA256 HWACCEL to avoid segfault in init
|
||||
# with some x86 toolchains (mostly musl?).
|
||||
ifeq ($(BR2_i386),y)
|
||||
define BUSYBOX_MUSL_DISABLE_SHA_HWACCEL
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_SHA1_HWACCEL)
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_SHA256_HWACCEL)
|
||||
endef
|
||||
endif
|
||||
|
||||
# Only install our logging scripts if no other package does it.
|
||||
ifeq ($(BR2_PACKAGE_SYSKLOGD)$(BR2_PACKAGE_RSYSLOG)$(BR2_PACKAGE_SYSLOG_NG),)
|
||||
define BUSYBOX_INSTALL_LOGGING_SCRIPT
|
||||
if grep -q CONFIG_SYSLOGD=y $(@D)/.config; \
|
||||
then \
|
||||
$(INSTALL) -m 0755 -D package/busybox/S01syslogd \
|
||||
$(TARGET_DIR)/etc/init.d/S01syslogd; \
|
||||
fi; \
|
||||
if grep -q CONFIG_KLOGD=y $(@D)/.config; \
|
||||
then \
|
||||
$(INSTALL) -m 0755 -D package/busybox/S02klogd \
|
||||
$(TARGET_DIR)/etc/init.d/S02klogd; \
|
||||
fi
|
||||
endef
|
||||
endif
|
||||
|
||||
# Only install our sysctl scripts if no other package does it.
|
||||
ifeq ($(BR2_PACKAGE_PROCPS_NG),)
|
||||
define BUSYBOX_INSTALL_SYSCTL_SCRIPT
|
||||
if grep -q CONFIG_BB_SYSCTL=y $(@D)/.config; \
|
||||
then \
|
||||
$(INSTALL) -m 0755 -D package/busybox/S02sysctl \
|
||||
$(TARGET_DIR)/etc/init.d/S02sysctl ; \
|
||||
fi
|
||||
endef
|
||||
endif
|
||||
|
||||
# Only install our crond script if no other package does it.
|
||||
ifeq ($(BR2_PACKAGE_DCRON),)
|
||||
define BUSYBOX_INSTALL_CROND_SCRIPT
|
||||
if grep -q CONFIG_CROND=y $(@D)/.config; \
|
||||
then \
|
||||
mkdir -p $(TARGET_DIR)/etc/cron/crontabs ; \
|
||||
$(INSTALL) -m 0755 -D package/busybox/S50crond \
|
||||
$(TARGET_DIR)/etc/init.d/S50crond; \
|
||||
fi;
|
||||
endef
|
||||
endif
|
||||
|
||||
# Only install our ifplugd script if no other package does it.
|
||||
ifeq ($(BR2_PACKAGE_IFPLUGD),)
|
||||
define BUSYBOX_INSTALL_IFPLUGD_SCRIPT
|
||||
if grep -q CONFIG_IFPLUGD=y $(@D)/.config; \
|
||||
then \
|
||||
$(INSTALL) -m 0755 -D package/busybox/S41ifplugd \
|
||||
$(TARGET_DIR)/etc/init.d/S41ifplugd; \
|
||||
fi;
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_INIT_BUSYBOX),y)
|
||||
define BUSYBOX_INSTALL_INITTAB
|
||||
if test ! -e $(TARGET_DIR)/etc/inittab; then \
|
||||
$(INSTALL) -D -m 0644 package/busybox/inittab $(TARGET_DIR)/etc/inittab; \
|
||||
fi
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX_WATCHDOG),y)
|
||||
define BUSYBOX_SET_WATCHDOG
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG)
|
||||
endef
|
||||
define BUSYBOX_INSTALL_WATCHDOG_SCRIPT
|
||||
$(INSTALL) -D -m 0755 package/busybox/S15watchdog \
|
||||
$(TARGET_DIR)/etc/init.d/S15watchdog
|
||||
$(SED) s/PERIOD/$(call qstrip,$(BR2_PACKAGE_BUSYBOX_WATCHDOG_PERIOD))/ \
|
||||
$(TARGET_DIR)/etc/init.d/S15watchdog
|
||||
endef
|
||||
endif
|
||||
|
||||
# PAM support requires thread support in the toolchain
|
||||
ifeq ($(BR2_PACKAGE_LINUX_PAM)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
|
||||
define BUSYBOX_LINUX_PAM
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_PAM)
|
||||
endef
|
||||
BUSYBOX_DEPENDENCIES += linux-pam
|
||||
else
|
||||
define BUSYBOX_LINUX_PAM
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_PAM)
|
||||
endef
|
||||
endif
|
||||
|
||||
# Telnet support
|
||||
define BUSYBOX_INSTALL_TELNET_SCRIPT
|
||||
if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
|
||||
$(INSTALL) -m 0755 -D package/busybox/S50telnet \
|
||||
$(TARGET_DIR)/etc/init.d/S50telnet ; \
|
||||
fi
|
||||
endef
|
||||
define BUSYBOX_INSTALL_TELNET_SERVICE
|
||||
if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
|
||||
$(INSTALL) -D -m 0644 package/busybox/telnetd.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/telnetd.service ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
# Add /bin/{a,hu}sh to /etc/shells otherwise some login tools like dropbear
|
||||
# can reject the user connection. See man shells.
|
||||
define BUSYBOX_INSTALL_ADD_TO_SHELLS
|
||||
if grep -q CONFIG_ASH=y $(BUSYBOX_DIR)/.config; then \
|
||||
grep -qsE '^/bin/ash$$' $(TARGET_DIR)/etc/shells \
|
||||
|| echo "/bin/ash" >> $(TARGET_DIR)/etc/shells; \
|
||||
fi
|
||||
if grep -q CONFIG_HUSH=y $(BUSYBOX_DIR)/.config; then \
|
||||
grep -qsE '^/bin/hush$$' $(TARGET_DIR)/etc/shells \
|
||||
|| echo "/bin/hush" >> $(TARGET_DIR)/etc/shells; \
|
||||
fi
|
||||
endef
|
||||
BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_INSTALL_ADD_TO_SHELLS
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_11),)
|
||||
# IFLA_CAN_TERMINATION was introduced in Linux 4.11
|
||||
define BUSYBOX_DISABLE_IP_LINK_CAN
|
||||
$(call KCONFIG_DISABLE_OPT,CONFIG_FEATURE_IP_LINK_CAN)
|
||||
endef
|
||||
endif
|
||||
|
||||
define BUSYBOX_KCONFIG_FIXUP_CMDS
|
||||
$(BUSYBOX_MUSL_DISABLE_SHA_HWACCEL)
|
||||
$(BUSYBOX_SET_MMU)
|
||||
$(BUSYBOX_PREFER_STATIC)
|
||||
$(BUSYBOX_SET_MDEV)
|
||||
$(BUSYBOX_SET_CRYPT_SHA)
|
||||
$(BUSYBOX_LINUX_PAM)
|
||||
$(BUSYBOX_SET_DEFAULT_PASSWD_ALGO)
|
||||
$(BUSYBOX_SET_INIT)
|
||||
$(BUSYBOX_SET_WATCHDOG)
|
||||
$(BUSYBOX_SET_SELINUX)
|
||||
$(BUSYBOX_SET_LESS_FLAGS)
|
||||
$(BUSYBOX_SET_HTTPD)
|
||||
$(BUSYBOX_SET_INDIVIDUAL_BINARIES)
|
||||
$(BUSYBOX_DISABLE_IP_LINK_CAN)
|
||||
$(PACKAGES_BUSYBOX_CONFIG_FIXUPS)
|
||||
endef
|
||||
|
||||
define BUSYBOX_BUILD_CMDS
|
||||
$(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(@D)
|
||||
endef
|
||||
|
||||
define BUSYBOX_INSTALL_TARGET_CMDS
|
||||
# Use the 'noclobber' install rule, to prevent BusyBox from overwriting
|
||||
# any full-blown versions of apps installed by other packages.
|
||||
$(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(@D) install-noclobber
|
||||
$(BUSYBOX_INSTALL_INDIVIDUAL_BINARIES)
|
||||
$(BUSYBOX_INSTALL_INITTAB)
|
||||
$(BUSYBOX_INSTALL_UDHCPC_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_ZCIP_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_MDEV_CONF)
|
||||
endef
|
||||
|
||||
# Install the sysvinit scripts, for the moment, but not those that already
|
||||
# have a corresponding one in openrc.
|
||||
define BUSYBOX_INSTALL_INIT_OPENRC
|
||||
$(BUSYBOX_INSTALL_MDEV_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_IFPLUGD_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_CROND_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_TELNET_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_HTTPD_SCRIPT)
|
||||
endef
|
||||
|
||||
define BUSYBOX_INSTALL_INIT_SYSTEMD
|
||||
$(BUSYBOX_INSTALL_TELNET_SERVICE)
|
||||
endef
|
||||
|
||||
define BUSYBOX_INSTALL_INIT_SYSV
|
||||
$(BUSYBOX_INSTALL_MDEV_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_SYSCTL_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_IFPLUGD_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_CROND_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_TELNET_SCRIPT)
|
||||
$(BUSYBOX_INSTALL_HTTPD_SCRIPT)
|
||||
endef
|
||||
|
||||
# Checks to give errors that the user can understand
|
||||
# Must be before we call to kconfig-package
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX)$(BR_BUILDING),yy)
|
||||
ifeq ($(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG)),)
|
||||
$(error No BusyBox configuration file specified, check your BR2_PACKAGE_BUSYBOX_CONFIG setting)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(kconfig-package))
|
||||
40
package/busybox/inittab
Normal file
40
package/busybox/inittab
Normal file
@@ -0,0 +1,40 @@
|
||||
# /etc/inittab
|
||||
#
|
||||
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
|
||||
#
|
||||
# Note: BusyBox init doesn't support runlevels. The runlevels field is
|
||||
# completely ignored by BusyBox init. If you want runlevels, use
|
||||
# sysvinit.
|
||||
#
|
||||
# Format for each entry: <id>:<runlevels>:<action>:<process>
|
||||
#
|
||||
# id == tty to run on, or empty for /dev/console
|
||||
# runlevels == ignored
|
||||
# action == one of sysinit, respawn, askfirst, wait, and once
|
||||
# process == program to run
|
||||
|
||||
# Startup the system
|
||||
::sysinit:/bin/mount -t proc proc /proc
|
||||
::sysinit:/bin/mount -o remount,rw /
|
||||
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
|
||||
::sysinit:/bin/mount -a
|
||||
::sysinit:/bin/mkdir -p /run/lock/subsys
|
||||
::sysinit:/sbin/swapon -a
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
# now run any rc scripts
|
||||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# Put a getty on the serial port
|
||||
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
#::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/sbin/swapoff -a
|
||||
::shutdown:/bin/umount -a -r
|
||||
39
package/busybox/mdev.conf
Normal file
39
package/busybox/mdev.conf
Normal file
@@ -0,0 +1,39 @@
|
||||
# null may already exist; therefore ownership has to be changed with command
|
||||
null root:root 666 @chmod 666 $MDEV
|
||||
zero root:root 666
|
||||
full root:root 666
|
||||
random root:root 444
|
||||
urandom root:root 444
|
||||
hwrandom root:root 444
|
||||
grsec root:root 660
|
||||
|
||||
kmem root:root 640
|
||||
mem root:root 640
|
||||
port root:root 640
|
||||
# console may already exist; therefore ownership has to be changed with command
|
||||
console root:tty 600 @chmod 600 $MDEV
|
||||
ptmx root:tty 666
|
||||
pty.* root:tty 660
|
||||
|
||||
# Typical devices
|
||||
tty root:tty 666
|
||||
tty[0-9]* root:tty 660
|
||||
vcsa*[0-9]* root:tty 660
|
||||
ttyS[0-9]* root:root 660
|
||||
ttyUSB[0-9]* root:root 660
|
||||
|
||||
# alsa sound devices
|
||||
snd/pcm.* root:audio 660
|
||||
snd/control.* root:audio 660
|
||||
snd/midi.* root:audio 660
|
||||
snd/seq root:audio 660
|
||||
snd/timer root:audio 660
|
||||
|
||||
# input stuff
|
||||
input/event[0-9]+ root:root 640
|
||||
input/mice root:root 640
|
||||
input/mouse[0-9] root:root 640
|
||||
input/ts[0-9] root:root 600
|
||||
|
||||
# load modules
|
||||
$MODALIAS=.* root:root 660 @modprobe "$MODALIAS"
|
||||
10
package/busybox/telnetd.service
Normal file
10
package/busybox/telnetd.service
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Telnetd Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/sbin/telnetd -F
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
122
package/busybox/udhcpc.script
Executable file
122
package/busybox/udhcpc.script
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
|
||||
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
||||
|
||||
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
|
||||
|
||||
ACTION="$1"
|
||||
RESOLV_CONF="/etc/resolv.conf"
|
||||
[ -e $RESOLV_CONF ] || touch $RESOLV_CONF
|
||||
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
|
||||
[ -n "$subnet" ] && NETMASK="netmask $subnet"
|
||||
# Handle stateful DHCPv6 like DHCPv4
|
||||
[ -n "$ipv6" ] && ip="$ipv6/128"
|
||||
|
||||
if [ -z "${IF_WAIT_DELAY}" ]; then
|
||||
IF_WAIT_DELAY=10
|
||||
fi
|
||||
|
||||
wait_for_ipv6_default_route() {
|
||||
printf "Waiting for IPv6 default route to appear"
|
||||
while [ $IF_WAIT_DELAY -gt 0 ]; do
|
||||
if ip -6 route list | grep -q default; then
|
||||
printf "\n"
|
||||
return
|
||||
fi
|
||||
sleep 1
|
||||
printf "."
|
||||
: $((IF_WAIT_DELAY -= 1))
|
||||
done
|
||||
printf " timeout!\n"
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
deconfig)
|
||||
/sbin/ifconfig $interface up
|
||||
/sbin/ifconfig $interface 0.0.0.0
|
||||
|
||||
# drop info from this interface
|
||||
# resolv.conf may be a symlink to /tmp/, so take care
|
||||
TMPFILE=$(mktemp)
|
||||
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
|
||||
cat $TMPFILE > $RESOLV_CONF
|
||||
rm -f $TMPFILE
|
||||
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
;;
|
||||
|
||||
leasefail|nak)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot
|
||||
fi
|
||||
;;
|
||||
|
||||
renew|bound)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
|
||||
if [ -n "$ipv6" ] ; then
|
||||
wait_for_ipv6_default_route
|
||||
fi
|
||||
|
||||
# RFC3442: If the DHCP server returns both a Classless
|
||||
# Static Routes option and a Router option, the DHCP
|
||||
# client MUST ignore the Router option.
|
||||
if [ -n "$staticroutes" ]; then
|
||||
echo "deleting routers"
|
||||
route -n | while read dest gw mask flags metric ref use iface; do
|
||||
[ "$iface" != "$interface" -o "$gw" = "0.0.0.0" ] || \
|
||||
route del -net "$dest" netmask "$mask" gw "$gw" dev "$interface"
|
||||
done
|
||||
|
||||
# format: dest1/mask gw1 ... destn/mask gwn
|
||||
set -- $staticroutes
|
||||
while [ -n "$1" -a -n "$2" ]; do
|
||||
route add -net "$1" gw "$2" dev "$interface"
|
||||
shift 2
|
||||
done
|
||||
elif [ -n "$router" ] ; then
|
||||
echo "deleting routers"
|
||||
while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do
|
||||
:
|
||||
done
|
||||
|
||||
for i in $router ; do
|
||||
route add default gw $i dev $interface
|
||||
done
|
||||
fi
|
||||
|
||||
# drop info from this interface
|
||||
# resolv.conf may be a symlink to /tmp/, so take care
|
||||
TMPFILE=$(mktemp)
|
||||
grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE
|
||||
cat $TMPFILE > $RESOLV_CONF
|
||||
rm -f $TMPFILE
|
||||
|
||||
# prefer rfc3397 domain search list (option 119) if available
|
||||
if [ -n "$search" ]; then
|
||||
search_list=$search
|
||||
elif [ -n "$domain" ]; then
|
||||
search_list=$domain
|
||||
fi
|
||||
|
||||
[ -n "$search_list" ] &&
|
||||
echo "search $search_list # $interface" >> $RESOLV_CONF
|
||||
|
||||
for i in $dns ; do
|
||||
echo adding dns $i
|
||||
echo "nameserver $i # $interface" >> $RESOLV_CONF
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
HOOK_DIR="$0.d"
|
||||
for hook in "${HOOK_DIR}/"*; do
|
||||
[ -f "${hook}" -a -x "${hook}" ] || continue
|
||||
"${hook}" "$ACTION"
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user