busybox: update to 1.22.1
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40852v19.07.3_mercusys_ac12_duma
parent
a54791f2ba
commit
f4f553efa7
@ -0,0 +1,304 @@
|
||||
# DO NOT EDIT. This file is generated from Config.src
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see scripts/kbuild/config-language.txt.
|
||||
#
|
||||
|
||||
config BUSYBOX_CONFIG_VOLUMEID
|
||||
bool #No description makes it a hidden option
|
||||
default BUSYBOX_DEFAULT_VOLUMEID
|
||||
|
||||
menu "Filesystem/Volume identification"
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_BTRFS
|
||||
bool "btrfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_BTRFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_CRAMFS
|
||||
bool "cramfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_CRAMFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_EXFAT
|
||||
bool "exFAT filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_EXFAT
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
exFAT (extended FAT) is a proprietary file system designed especially
|
||||
for flash drives. It has many features from NTFS, but with less
|
||||
overhead. exFAT is used on most SDXC cards for consumer electronics.
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_EXT
|
||||
bool "Ext filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_EXT
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_F2FS
|
||||
bool "f2fs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_F2FS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
F2FS (aka Flash-Friendly File System) is a log-structured file system,
|
||||
which is adapted to newer forms of storage. F2FS also remedies some
|
||||
known issues of the older log structured file systems, such as high
|
||||
cleaning overhead.
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_FAT
|
||||
bool "fat filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_FAT
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_HFS
|
||||
bool "hfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_HFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_ISO9660
|
||||
bool "iso9660 filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_ISO9660
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_JFS
|
||||
bool "jfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_JFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXRAID
|
||||
bool "linuxraid"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_LINUXRAID
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_LINUXSWAP
|
||||
bool "linux swap filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_LINUXSWAP
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_LUKS
|
||||
bool "luks filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_LUKS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_NILFS
|
||||
bool "nilfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_NILFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
NILFS is a New Implementation of a Log-Structured File System (LFS)
|
||||
that supports continuous snapshots. This provides features like
|
||||
versioning of the entire filesystem, restoration of files that
|
||||
were deleted a few minutes ago. NILFS keeps consistency like
|
||||
conventional LFS, so it provides quick recovery after system crashes.
|
||||
|
||||
The possible use of NILFS includes versioning, tamper detection,
|
||||
SOX compliance logging, and so forth. It can serve as an alternative
|
||||
filesystem for Linux desktop environment, or as a basis of advanced
|
||||
storage appliances.
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_NTFS
|
||||
bool "ntfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_NTFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_OCFS2
|
||||
bool "ocfs2 filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_OCFS2
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_REISERFS
|
||||
bool "Reiser filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_REISERFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_ROMFS
|
||||
bool "romfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_ROMFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_SQUASHFS
|
||||
bool "SquashFS filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_SQUASHFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID && BUSYBOX_CONFIG_FEATURE_BLKID_TYPE
|
||||
help
|
||||
Squashfs is a compressed read-only filesystem for Linux. Squashfs is
|
||||
intended for general read-only filesystem use and in constrained block
|
||||
device/memory systems (e.g. embedded systems) where low overhead is
|
||||
needed.
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_SYSV
|
||||
bool "sysv filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_SYSV
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_UDF
|
||||
bool "udf filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_UDF
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_HIGHPOINTRAID
|
||||
### bool "highpoint raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_HPFS
|
||||
### bool "hpfs filesystem"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_ISWRAID
|
||||
### bool "intel raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_LSIRAID
|
||||
### bool "lsi raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_LVM
|
||||
### bool "lvm"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_MAC
|
||||
### bool "mac filesystem"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_MINIX
|
||||
### bool "minix filesystem"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_MSDOS
|
||||
### bool "msdos filesystem"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_NVIDIARAID
|
||||
### bool "nvidia raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_PROMISERAID
|
||||
### bool "promise raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_SILICONRAID
|
||||
### bool "silicon raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_UFS
|
||||
### bool "ufs filesystem"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
### config FEATURE_VOLUMEID_VIARAID
|
||||
### bool "via raid"
|
||||
### default y
|
||||
### depends on VOLUMEID
|
||||
### help
|
||||
### TODO
|
||||
|
||||
|
||||
config BUSYBOX_CONFIG_FEATURE_VOLUMEID_XFS
|
||||
bool "xfs filesystem"
|
||||
default BUSYBOX_DEFAULT_FEATURE_VOLUMEID_XFS
|
||||
depends on BUSYBOX_CONFIG_VOLUMEID
|
||||
help
|
||||
TODO
|
||||
|
||||
|
||||
endmenu
|
@ -1,20 +0,0 @@
|
||||
From eb80c2a5315ed08bd329448217695375d89732c9 Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Thill <nico@openwrt.org>
|
||||
Date: Wed, 9 Nov 2011 18:17:20 +0100
|
||||
Subject: [PATCH] passwd: use MD5 hash by default (like it used to be)
|
||||
|
||||
---
|
||||
loginutils/passwd.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
--- a/loginutils/passwd.c
|
||||
+++ b/loginutils/passwd.c
|
||||
@@ -94,7 +94,7 @@ int passwd_main(int argc UNUSED_PARAM, c
|
||||
};
|
||||
unsigned opt;
|
||||
int rc;
|
||||
- const char *opt_a = "d"; /* des */
|
||||
+ const char *opt_a = "m"; /* md5 */
|
||||
const char *filename;
|
||||
char *myname;
|
||||
char *name;
|
@ -0,0 +1,11 @@
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -13014,7 +13014,7 @@ init(void)
|
||||
setvar2("PPID", utoa(getppid()));
|
||||
#if ENABLE_ASH_BASH_COMPAT
|
||||
p = lookupvar("SHLVL");
|
||||
- setvar2("SHLVL", utoa(p ? atoi(p) + 1 : 1));
|
||||
+ setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT);
|
||||
#endif
|
||||
p = lookupvar("PWD");
|
||||
if (p) {
|
@ -1,37 +0,0 @@
|
||||
--- a/networking/brctl.c
|
||||
+++ b/networking/brctl.c
|
||||
@@ -129,7 +129,7 @@ int brctl_main(int argc UNUSED_PARAM, ch
|
||||
"setageing\0" "setfd\0" "sethello\0" "setmaxage\0"
|
||||
"setpathcost\0" "setportprio\0" "setbridgeprio\0"
|
||||
)
|
||||
- IF_FEATURE_BRCTL_SHOW("showmacs\0" "show\0");
|
||||
+ IF_FEATURE_BRCTL_SHOW("show\0");
|
||||
|
||||
enum { ARG_addbr = 0, ARG_delbr, ARG_addif, ARG_delif
|
||||
IF_FEATURE_BRCTL_FANCY(,
|
||||
@@ -137,7 +137,7 @@ int brctl_main(int argc UNUSED_PARAM, ch
|
||||
ARG_setageing, ARG_setfd, ARG_sethello, ARG_setmaxage,
|
||||
ARG_setpathcost, ARG_setportprio, ARG_setbridgeprio
|
||||
)
|
||||
- IF_FEATURE_BRCTL_SHOW(, ARG_showmacs, ARG_show)
|
||||
+ IF_FEATURE_BRCTL_SHOW(, ARG_show)
|
||||
};
|
||||
|
||||
int fd;
|
||||
--- a/networking/Config.src
|
||||
+++ b/networking/Config.src
|
||||
@@ -82,12 +82,12 @@ config FEATURE_BRCTL_FANCY
|
||||
This adds about 600 bytes.
|
||||
|
||||
config FEATURE_BRCTL_SHOW
|
||||
- bool "Support show, showmac and showstp"
|
||||
+ bool "Support show"
|
||||
default y
|
||||
depends on BRCTL && FEATURE_BRCTL_FANCY
|
||||
help
|
||||
Add support for option which prints the current config:
|
||||
- showmacs, showstp, show
|
||||
+ show
|
||||
|
||||
config DNSD
|
||||
bool "dnsd"
|
@ -0,0 +1,30 @@
|
||||
--- a/libbb/time.c
|
||||
+++ b/libbb/time.c
|
||||
@@ -68,15 +68,23 @@ void FAST_FUNC parse_datestr(const char
|
||||
/* else end != NUL and we error out */
|
||||
}
|
||||
} else
|
||||
- /* yyyy-mm-dd HH */
|
||||
- if (sscanf(date_str, "%u-%u-%u %u%c", &ptm->tm_year,
|
||||
+ if (strchr(date_str, '-')
|
||||
+ /* Why strchr('-') check?
|
||||
+ * sscanf below will trash ptm->tm_year, this breaks
|
||||
+ * if parse_str is "10101010" (iow, "MMddhhmm" form)
|
||||
+ * because we destroy year. Do these sscanf
|
||||
+ * only if we saw a dash in parse_str.
|
||||
+ */
|
||||
+ /* yyyy-mm-dd HH */
|
||||
+ && (sscanf(date_str, "%u-%u-%u %u%c", &ptm->tm_year,
|
||||
&ptm->tm_mon, &ptm->tm_mday,
|
||||
&ptm->tm_hour,
|
||||
&end) >= 4
|
||||
- /* yyyy-mm-dd */
|
||||
- || sscanf(date_str, "%u-%u-%u%c", &ptm->tm_year,
|
||||
+ /* yyyy-mm-dd */
|
||||
+ || sscanf(date_str, "%u-%u-%u%c", &ptm->tm_year,
|
||||
&ptm->tm_mon, &ptm->tm_mday,
|
||||
&end) >= 3
|
||||
+ )
|
||||
) {
|
||||
ptm->tm_year -= 1900; /* Adjust years */
|
||||
ptm->tm_mon -= 1; /* Adjust month from 1-12 to 0-11 */
|
@ -1,237 +0,0 @@
|
||||
http://git.busybox.net/busybox/commit/?id=dd1061b6a79b0161597799e825bfefc27993ace5
|
||||
|
||||
From dd1061b6a79b0161597799e825bfefc27993ace5 Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Sun, 11 Sep 2011 21:04:02 +0200
|
||||
Subject: [PATCH] wget: URL-decode user:password before base64-encoding it into auth hdr. Closes 3625.
|
||||
|
||||
function old new delta
|
||||
percent_decode_in_place - 152 +152
|
||||
parse_url 304 317 +13
|
||||
handle_incoming_and_exit 2795 2798 +3
|
||||
httpd_main 763 760 -3
|
||||
decodeString 152 - -152
|
||||
------------------------------------------------------------------------------
|
||||
(add/remove: 2/1 grow/shrink: 2/1 up/down: 168/-155) Total: 13 bytes
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
|
||||
--- a/include/libbb.h
|
||||
+++ b/include/libbb.h
|
||||
@@ -1570,6 +1570,15 @@ int starts_with_cpu(const char *str) FAS
|
||||
unsigned get_cpu_count(void) FAST_FUNC;
|
||||
|
||||
|
||||
+/* Use strict=1 if you process input from untrusted source:
|
||||
+ * it will return NULL on invalid %xx (bad hex chars)
|
||||
+ * and str + 1 if decoded char is / or NUL.
|
||||
+ * In non-strict mode, it always succeeds (returns str),
|
||||
+ * and also it additionally decoded '+' to space.
|
||||
+ */
|
||||
+char *percent_decode_in_place(char *str, int strict) FAST_FUNC;
|
||||
+
|
||||
+
|
||||
extern const char bb_uuenc_tbl_base64[];
|
||||
extern const char bb_uuenc_tbl_std[];
|
||||
void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
|
||||
--- /dev/null
|
||||
+++ b/libbb/percent_decode.c
|
||||
@@ -0,0 +1,69 @@
|
||||
+/* vi: set sw=4 ts=4: */
|
||||
+/*
|
||||
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
||||
+ */
|
||||
+
|
||||
+//kbuild:lib-y += percent_decode.o
|
||||
+
|
||||
+#include "libbb.h"
|
||||
+
|
||||
+static unsigned hex_to_bin(unsigned char c)
|
||||
+{
|
||||
+ unsigned v;
|
||||
+
|
||||
+ v = c - '0';
|
||||
+ if (v <= 9)
|
||||
+ return v;
|
||||
+ /* c | 0x20: letters to lower case, non-letters
|
||||
+ * to (potentially different) non-letters */
|
||||
+ v = (unsigned)(c | 0x20) - 'a';
|
||||
+ if (v <= 5)
|
||||
+ return v + 10;
|
||||
+ return ~0;
|
||||
+/* For testing:
|
||||
+void t(char c) { printf("'%c'(%u) %u\n", c, c, hex_to_bin(c)); }
|
||||
+int main() { t(0x10); t(0x20); t('0'); t('9'); t('A'); t('F'); t('a'); t('f');
|
||||
+t('0'-1); t('9'+1); t('A'-1); t('F'+1); t('a'-1); t('f'+1); return 0; }
|
||||
+*/
|
||||
+}
|
||||
+
|
||||
+char* FAST_FUNC percent_decode_in_place(char *str, int strict)
|
||||
+{
|
||||
+ /* note that decoded string is always shorter than original */
|
||||
+ char *src = str;
|
||||
+ char *dst = str;
|
||||
+ char c;
|
||||
+
|
||||
+ while ((c = *src++) != '\0') {
|
||||
+ unsigned v;
|
||||
+
|
||||
+ if (!strict && c == '+') {
|
||||
+ *dst++ = ' ';
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (c != '%') {
|
||||
+ *dst++ = c;
|
||||
+ continue;
|
||||
+ }
|
||||
+ v = hex_to_bin(src[0]);
|
||||
+ if (v > 15) {
|
||||
+ bad_hex:
|
||||
+ if (strict)
|
||||
+ return NULL;
|
||||
+ *dst++ = '%';
|
||||
+ continue;
|
||||
+ }
|
||||
+ v = (v * 16) | hex_to_bin(src[1]);
|
||||
+ if (v > 255)
|
||||
+ goto bad_hex;
|
||||
+ if (strict && (v == '/' || v == '\0')) {
|
||||
+ /* caller takes it as indication of invalid
|
||||
+ * (dangerous wrt exploits) chars */
|
||||
+ return str + 1;
|
||||
+ }
|
||||
+ *dst++ = v;
|
||||
+ src += 2;
|
||||
+ }
|
||||
+ *dst = '\0';
|
||||
+ return str;
|
||||
+}
|
||||
--- a/networking/httpd.c
|
||||
+++ b/networking/httpd.c
|
||||
@@ -820,78 +820,6 @@ static char *encodeString(const char *st
|
||||
}
|
||||
#endif
|
||||
|
||||
-/*
|
||||
- * Given a URL encoded string, convert it to plain ascii.
|
||||
- * Since decoding always makes strings smaller, the decode is done in-place.
|
||||
- * Thus, callers should xstrdup() the argument if they do not want the
|
||||
- * argument modified. The return is the original pointer, allowing this
|
||||
- * function to be easily used as arguments to other functions.
|
||||
- *
|
||||
- * string The first string to decode.
|
||||
- * option_d 1 if called for httpd -d
|
||||
- *
|
||||
- * Returns a pointer to the decoded string (same as input).
|
||||
- */
|
||||
-static unsigned hex_to_bin(unsigned char c)
|
||||
-{
|
||||
- unsigned v;
|
||||
-
|
||||
- v = c - '0';
|
||||
- if (v <= 9)
|
||||
- return v;
|
||||
- /* c | 0x20: letters to lower case, non-letters
|
||||
- * to (potentially different) non-letters */
|
||||
- v = (unsigned)(c | 0x20) - 'a';
|
||||
- if (v <= 5)
|
||||
- return v + 10;
|
||||
- return ~0;
|
||||
-/* For testing:
|
||||
-void t(char c) { printf("'%c'(%u) %u\n", c, c, hex_to_bin(c)); }
|
||||
-int main() { t(0x10); t(0x20); t('0'); t('9'); t('A'); t('F'); t('a'); t('f');
|
||||
-t('0'-1); t('9'+1); t('A'-1); t('F'+1); t('a'-1); t('f'+1); return 0; }
|
||||
-*/
|
||||
-}
|
||||
-static char *decodeString(char *orig, int option_d)
|
||||
-{
|
||||
- /* note that decoded string is always shorter than original */
|
||||
- char *string = orig;
|
||||
- char *ptr = string;
|
||||
- char c;
|
||||
-
|
||||
- while ((c = *ptr++) != '\0') {
|
||||
- unsigned v;
|
||||
-
|
||||
- if (option_d && c == '+') {
|
||||
- *string++ = ' ';
|
||||
- continue;
|
||||
- }
|
||||
- if (c != '%') {
|
||||
- *string++ = c;
|
||||
- continue;
|
||||
- }
|
||||
- v = hex_to_bin(ptr[0]);
|
||||
- if (v > 15) {
|
||||
- bad_hex:
|
||||
- if (!option_d)
|
||||
- return NULL;
|
||||
- *string++ = '%';
|
||||
- continue;
|
||||
- }
|
||||
- v = (v * 16) | hex_to_bin(ptr[1]);
|
||||
- if (v > 255)
|
||||
- goto bad_hex;
|
||||
- if (!option_d && (v == '/' || v == '\0')) {
|
||||
- /* caller takes it as indication of invalid
|
||||
- * (dangerous wrt exploits) chars */
|
||||
- return orig + 1;
|
||||
- }
|
||||
- *string++ = v;
|
||||
- ptr += 2;
|
||||
- }
|
||||
- *string = '\0';
|
||||
- return orig;
|
||||
-}
|
||||
-
|
||||
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||
/*
|
||||
* Decode a base64 data stream as per rfc1521.
|
||||
@@ -1949,7 +1877,7 @@ static void handle_incoming_and_exit(con
|
||||
}
|
||||
|
||||
/* Decode URL escape sequences */
|
||||
- tptr = decodeString(urlcopy, 0);
|
||||
+ tptr = percent_decode_in_place(urlcopy, /*strict:*/ 1);
|
||||
if (tptr == NULL)
|
||||
send_headers_and_exit(HTTP_BAD_REQUEST);
|
||||
if (tptr == urlcopy + 1) {
|
||||
@@ -2408,7 +2336,7 @@ int httpd_main(int argc UNUSED_PARAM, ch
|
||||
, &verbose
|
||||
);
|
||||
if (opt & OPT_DECODE_URL) {
|
||||
- fputs(decodeString(url_for_decode, 1), stdout);
|
||||
+ fputs(percent_decode_in_place(url_for_decode, /*strict:*/ 0), stdout);
|
||||
return 0;
|
||||
}
|
||||
#if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
|
||||
--- a/networking/wget.c
|
||||
+++ b/networking/wget.c
|
||||
@@ -298,8 +298,13 @@ static void parse_url(const char *src_ur
|
||||
|
||||
sp = strrchr(h->host, '@');
|
||||
if (sp != NULL) {
|
||||
- h->user = h->host;
|
||||
+ // URL-decode "user:password" string before base64-encoding:
|
||||
+ // wget http://test:my%20pass@example.com should send
|
||||
+ // Authorization: Basic dGVzdDpteSBwYXNz
|
||||
+ // which decodes to "test:my pass".
|
||||
+ // Standard wget and curl do this too.
|
||||
*sp = '\0';
|
||||
+ h->user = percent_decode_in_place(h->host, /*strict:*/ 0);
|
||||
h->host = sp + 1;
|
||||
}
|
||||
|
||||
@@ -661,12 +666,6 @@ static void download_one_url(const char
|
||||
|
||||
#if ENABLE_FEATURE_WGET_AUTHENTICATION
|
||||
if (target.user) {
|
||||
-//TODO: URL-decode "user:password" string before base64-encoding:
|
||||
-//wget http://test:my%20pass@example.com should send
|
||||
-// Authorization: Basic dGVzdDpteSBwYXNz
|
||||
-//which decodes to "test:my pass", instead of what we send now:
|
||||
-// Authorization: Basic dGVzdDpteSUyMHBhc3M=
|
||||
-//Can reuse decodeString() from httpd.c
|
||||
fprintf(sfp, "Proxy-Authorization: Basic %s\r\n"+6,
|
||||
base64enc(target.user));
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
--- a/networking/libiproute/iplink.c
|
||||
+++ b/networking/libiproute/iplink.c
|
||||
@@ -31,6 +31,16 @@
|
||||
#ifndef IFLA_LINKINFO
|
||||
# define IFLA_LINKINFO 18
|
||||
# define IFLA_INFO_KIND 1
|
||||
+# define IFLA_INFO_DATA 2
|
||||
+#endif
|
||||
+
|
||||
+#ifndef IFLA_VLAN_MAX
|
||||
+# define IFLA_VLAN_ID 1
|
||||
+# define IFLA_VLAN_FLAGS 2
|
||||
+struct ifla_vlan_flags {
|
||||
+ uint32_t flags;
|
||||
+ uint32_t mask;
|
||||
+};
|
||||
#endif
|
||||
|
||||
/* taken from linux/sockios.h */
|
@ -0,0 +1,15 @@
|
||||
--- a/networking/nc_bloaty.c
|
||||
+++ b/networking/nc_bloaty.c
|
||||
@@ -175,9 +175,9 @@ enum {
|
||||
OPT_w = (1 << 5),
|
||||
OPT_l = (1 << 6) * ENABLE_NC_SERVER,
|
||||
OPT_k = (1 << 7) * ENABLE_NC_SERVER,
|
||||
- OPT_i = (1 << (7+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
|
||||
- OPT_o = (1 << (8+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
|
||||
- OPT_z = (1 << (9+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
|
||||
+ OPT_i = (1 << (6+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
|
||||
+ OPT_o = (1 << (7+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
|
||||
+ OPT_z = (1 << (8+2*ENABLE_NC_SERVER)) * ENABLE_NC_EXTRA,
|
||||
};
|
||||
|
||||
#define o_nflag (option_mask32 & OPT_n)
|
@ -1,164 +0,0 @@
|
||||
--- a/networking/udhcp/common.c
|
||||
+++ b/networking/udhcp/common.c
|
||||
@@ -29,16 +29,16 @@ const struct dhcp_optflag dhcp_optflags[
|
||||
// { OPTION_IP | OPTION_LIST , 0x07 }, /* DHCP_LOG_SERVER */
|
||||
// { OPTION_IP | OPTION_LIST , 0x08 }, /* DHCP_COOKIE_SERVER */
|
||||
{ OPTION_IP | OPTION_LIST , 0x09 }, /* DHCP_LPR_SERVER */
|
||||
- { OPTION_STRING | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */
|
||||
+ { OPTION_STRING_HOST | OPTION_REQ, 0x0c }, /* DHCP_HOST_NAME */
|
||||
{ OPTION_U16 , 0x0d }, /* DHCP_BOOT_SIZE */
|
||||
- { OPTION_STRING | OPTION_REQ, 0x0f }, /* DHCP_DOMAIN_NAME */
|
||||
+ { OPTION_STRING_HOST | OPTION_REQ, 0x0f }, /* DHCP_DOMAIN_NAME */
|
||||
{ OPTION_IP , 0x10 }, /* DHCP_SWAP_SERVER */
|
||||
{ OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */
|
||||
{ OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */
|
||||
{ OPTION_U16 , 0x1a }, /* DHCP_MTU */
|
||||
{ OPTION_IP | OPTION_REQ, 0x1c }, /* DHCP_BROADCAST */
|
||||
{ OPTION_IP_PAIR | OPTION_LIST , 0x21 }, /* DHCP_ROUTES */
|
||||
- { OPTION_STRING , 0x28 }, /* DHCP_NIS_DOMAIN */
|
||||
+ { OPTION_STRING_HOST , 0x28 }, /* DHCP_NIS_DOMAIN */
|
||||
{ OPTION_IP | OPTION_LIST , 0x29 }, /* DHCP_NIS_SERVER */
|
||||
{ OPTION_IP | OPTION_LIST | OPTION_REQ, 0x2a }, /* DHCP_NTP_SERVER */
|
||||
{ OPTION_IP | OPTION_LIST , 0x2c }, /* DHCP_WINS_SERVER */
|
||||
@@ -46,7 +46,7 @@ const struct dhcp_optflag dhcp_optflags[
|
||||
{ OPTION_IP , 0x36 }, /* DHCP_SERVER_ID */
|
||||
{ OPTION_STRING , 0x38 }, /* DHCP_ERR_MESSAGE */
|
||||
//TODO: must be combined with 'sname' and 'file' handling:
|
||||
- { OPTION_STRING , 0x42 }, /* DHCP_TFTP_SERVER_NAME */
|
||||
+ { OPTION_STRING_HOST , 0x42 }, /* DHCP_TFTP_SERVER_NAME */
|
||||
{ OPTION_STRING , 0x43 }, /* DHCP_BOOT_FILE */
|
||||
//TODO: not a string, but a set of LASCII strings:
|
||||
// { OPTION_STRING , 0x4D }, /* DHCP_USER_CLASS */
|
||||
@@ -143,6 +143,7 @@ const uint8_t dhcp_option_lengths[] ALIG
|
||||
[OPTION_IP_PAIR] = 8,
|
||||
// [OPTION_BOOLEAN] = 1,
|
||||
[OPTION_STRING] = 1, /* ignored by udhcp_str2optset */
|
||||
+ [OPTION_STRING_HOST] = 1, /* ignored by udhcp_str2optset */
|
||||
#if ENABLE_FEATURE_UDHCP_RFC3397
|
||||
[OPTION_DNS_STRING] = 1, /* ignored by both udhcp_str2optset and xmalloc_optname_optval */
|
||||
[OPTION_SIP_SERVERS] = 1,
|
||||
@@ -411,7 +412,9 @@ static NOINLINE void attach_option(
|
||||
/* actually 255 is ok too, but adding a space can overlow it */
|
||||
|
||||
existing->data = xrealloc(existing->data, OPT_DATA + 1 + old_len + length);
|
||||
- if ((optflag->flags & OPTION_TYPE_MASK) == OPTION_STRING) {
|
||||
+ if ((optflag->flags & OPTION_TYPE_MASK) == OPTION_STRING
|
||||
+ || (optflag->flags & OPTION_TYPE_MASK) == OPTION_STRING_HOST
|
||||
+ ) {
|
||||
/* add space separator between STRING options in a list */
|
||||
existing->data[OPT_DATA + old_len] = ' ';
|
||||
old_len++;
|
||||
@@ -475,6 +478,7 @@ int FAST_FUNC udhcp_str2optset(const cha
|
||||
retval = udhcp_str2nip(val, buffer + 4);
|
||||
break;
|
||||
case OPTION_STRING:
|
||||
+ case OPTION_STRING_HOST:
|
||||
#if ENABLE_FEATURE_UDHCP_RFC3397
|
||||
case OPTION_DNS_STRING:
|
||||
#endif
|
||||
--- a/networking/udhcp/common.h
|
||||
+++ b/networking/udhcp/common.h
|
||||
@@ -80,6 +80,9 @@ enum {
|
||||
OPTION_IP = 1,
|
||||
OPTION_IP_PAIR,
|
||||
OPTION_STRING,
|
||||
+ /* Opts of STRING_HOST type will be sanitized before they are passed
|
||||
+ * to udhcpc script's environment: */
|
||||
+ OPTION_STRING_HOST,
|
||||
// OPTION_BOOLEAN,
|
||||
OPTION_U8,
|
||||
OPTION_U16,
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -101,6 +101,7 @@ static const uint8_t len_of_option_as_st
|
||||
[OPTION_IP_PAIR ] = sizeof("255.255.255.255 ") * 2,
|
||||
[OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "),
|
||||
[OPTION_STRING ] = 1,
|
||||
+ [OPTION_STRING_HOST ] = 1,
|
||||
#if ENABLE_FEATURE_UDHCP_RFC3397
|
||||
[OPTION_DNS_STRING ] = 1, /* unused */
|
||||
/* Hmmm, this severely overestimates size if SIP_SERVERS option
|
||||
@@ -135,6 +136,63 @@ static int mton(uint32_t mask)
|
||||
return i;
|
||||
}
|
||||
|
||||
+/* Check if a given label represents a valid DNS label
|
||||
+ * Return pointer to the first character after the label upon success,
|
||||
+ * NULL otherwise.
|
||||
+ * See RFC1035, 2.3.1
|
||||
+ */
|
||||
+/* We don't need to be particularly anal. For example, allowing _, hyphen
|
||||
+ * at the end, or leading and trailing dots would be ok, since it
|
||||
+ * can't be used for attacks. (Leading hyphen can be, if someone uses
|
||||
+ * cmd "$hostname"
|
||||
+ * in the script: then hostname may be treated as an option)
|
||||
+ */
|
||||
+static const char *valid_domain_label(const char *label)
|
||||
+{
|
||||
+ unsigned char ch;
|
||||
+ unsigned pos = 0;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ ch = *label;
|
||||
+ if ((ch|0x20) < 'a' || (ch|0x20) > 'z') {
|
||||
+ if (pos == 0) {
|
||||
+ /* label must begin with letter */
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (ch < '0' || ch > '9') {
|
||||
+ if (ch == '\0' || ch == '.')
|
||||
+ return label;
|
||||
+ /* DNS allows only '-', but we are more permissive */
|
||||
+ if (ch != '-' && ch != '_')
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ label++;
|
||||
+ pos++;
|
||||
+ //Do we want this?
|
||||
+ //if (pos > 63) /* NS_MAXLABEL; labels must be 63 chars or less */
|
||||
+ // return NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Check if a given name represents a valid DNS name */
|
||||
+/* See RFC1035, 2.3.1 */
|
||||
+static int good_hostname(const char *name)
|
||||
+{
|
||||
+ //const char *start = name;
|
||||
+
|
||||
+ for (;;) {
|
||||
+ name = valid_domain_label(name);
|
||||
+ if (!name)
|
||||
+ return 0;
|
||||
+ if (!name[0])
|
||||
+ return 1;
|
||||
+ //Do we want this?
|
||||
+ //return ((name - start) < 1025); /* NS_MAXDNAME */
|
||||
+ name++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Create "opt_name=opt_value" string */
|
||||
static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_optflag *optflag, const char *opt_name)
|
||||
{
|
||||
@@ -185,8 +243,11 @@ static NOINLINE char *xmalloc_optname_op
|
||||
break;
|
||||
}
|
||||
case OPTION_STRING:
|
||||
+ case OPTION_STRING_HOST:
|
||||
memcpy(dest, option, len);
|
||||
dest[len] = '\0';
|
||||
+ if (type == OPTION_STRING_HOST && !good_hostname(dest))
|
||||
+ safe_strncpy(dest, "bad", len);
|
||||
return ret; /* Short circuit this case */
|
||||
case OPTION_STATIC_ROUTES: {
|
||||
/* Option binary format:
|
||||
@@ -314,6 +375,7 @@ static char **fill_envp(struct dhcp_pack
|
||||
/* +1 element for each option, +2 for subnet option: */
|
||||
if (packet) {
|
||||
/* note: do not search for "pad" (0) and "end" (255) options */
|
||||
+//TODO: change logic to scan packet _once_
|
||||
for (i = 1; i < 255; i++) {
|
||||
temp = udhcp_get_option(packet, i);
|
||||
if (temp) {
|
File diff suppressed because it is too large
Load Diff
@ -1,97 +0,0 @@
|
||||
--- a/coreutils/dd.c
|
||||
+++ b/coreutils/dd.c
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
//usage:#define dd_trivial_usage
|
||||
//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n"
|
||||
-//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync]")
|
||||
+//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync|swab]")
|
||||
//usage:#define dd_full_usage "\n\n"
|
||||
//usage: "Copy a file with converting and formatting\n"
|
||||
//usage: "\n if=FILE Read from FILE instead of stdin"
|
||||
@@ -30,6 +30,7 @@
|
||||
//usage: "\n conv=noerror Continue after read errors"
|
||||
//usage: "\n conv=sync Pad blocks with zeros"
|
||||
//usage: "\n conv=fsync Physically write data out before finishing"
|
||||
+//usage: "\n conv=swab Swap every pair of bytes"
|
||||
//usage: )
|
||||
//usage: "\n"
|
||||
//usage: "\nNumbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),"
|
||||
@@ -155,9 +156,10 @@ int dd_main(int argc UNUSED_PARAM, char
|
||||
FLAG_SYNC = 1 << 1,
|
||||
FLAG_NOERROR = 1 << 2,
|
||||
FLAG_FSYNC = 1 << 3,
|
||||
+ FLAG_SWAB = 1 << 4,
|
||||
/* end of conv flags */
|
||||
- FLAG_TWOBUFS = 1 << 4,
|
||||
- FLAG_COUNT = 1 << 5,
|
||||
+ FLAG_TWOBUFS = 1 << 5,
|
||||
+ FLAG_COUNT = 1 << 6,
|
||||
};
|
||||
static const char keywords[] ALIGN1 =
|
||||
"bs\0""count\0""seek\0""skip\0""if\0""of\0"
|
||||
@@ -167,7 +169,7 @@ int dd_main(int argc UNUSED_PARAM, char
|
||||
;
|
||||
#if ENABLE_FEATURE_DD_IBS_OBS
|
||||
static const char conv_words[] ALIGN1 =
|
||||
- "notrunc\0""sync\0""noerror\0""fsync\0";
|
||||
+ "notrunc\0""sync\0""noerror\0""fsync\0""swab\0";
|
||||
#endif
|
||||
enum {
|
||||
OP_bs = 0,
|
||||
@@ -185,11 +187,11 @@ int dd_main(int argc UNUSED_PARAM, char
|
||||
OP_conv_sync,
|
||||
OP_conv_noerror,
|
||||
OP_conv_fsync,
|
||||
+ OP_conv_swab,
|
||||
/* Unimplemented conv=XXX: */
|
||||
//nocreat do not create the output file
|
||||
//excl fail if the output file already exists
|
||||
//fdatasync physically write output file data before finishing
|
||||
- //swab swap every pair of input bytes
|
||||
//lcase change upper case to lower case
|
||||
//ucase change lower case to upper case
|
||||
//block pad newline-terminated records with spaces to cbs-size
|
||||
@@ -207,12 +209,14 @@ int dd_main(int argc UNUSED_PARAM, char
|
||||
struct {
|
||||
int flags;
|
||||
size_t oc;
|
||||
+ ssize_t prev_read_size; /* for detecting swab failure */
|
||||
off_t count;
|
||||
off_t seek, skip;
|
||||
const char *infile, *outfile;
|
||||
} Z;
|
||||
#define flags (Z.flags )
|
||||
#define oc (Z.oc )
|
||||
+#define prev_read_size (Z.prev_read_size)
|
||||
#define count (Z.count )
|
||||
#define seek (Z.seek )
|
||||
#define skip (Z.skip )
|
||||
@@ -375,6 +379,27 @@ int dd_main(int argc UNUSED_PARAM, char
|
||||
* conv=noerror just ignores input bad blocks */
|
||||
n = 0;
|
||||
}
|
||||
+ if (flags & FLAG_SWAB) {
|
||||
+ uint16_t *p16;
|
||||
+ ssize_t n2;
|
||||
+
|
||||
+ /* Our code allows only last read to be odd-sized */
|
||||
+ if (prev_read_size & 1)
|
||||
+ bb_error_msg_and_die("can't swab %lu byte buffer",
|
||||
+ (unsigned long)prev_read_size);
|
||||
+ prev_read_size = n;
|
||||
+
|
||||
+ /* If n is odd, last byte is not swapped:
|
||||
+ * echo -n "qwe" | dd conv=swab
|
||||
+ * prints "wqe".
|
||||
+ */
|
||||
+ p16 = (void*) ibuf;
|
||||
+ n2 = (n >> 1);
|
||||
+ while (--n2 >= 0) {
|
||||
+ *p16 = bswap_16(*p16);
|
||||
+ p16++;
|
||||
+ }
|
||||
+ }
|
||||
if ((size_t)n == ibs)
|
||||
G.in_full++;
|
||||
else {
|
@ -1,11 +1,11 @@
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
@@ -50,7 +50,7 @@ CFLAGS += $(call cc-option,-fno-builtin-
|
||||
@@ -51,7 +51,7 @@ CFLAGS += $(call cc-option,-fno-builtin-
|
||||
# -fno-guess-branch-probability: prohibit pseudo-random guessing
|
||||
# of branch probabilities (hopefully makes bloatcheck more stable):
|
||||
CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
|
||||
-CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
|
||||
+CFLAGS += $(call cc-option,-funsigned-char,)
|
||||
CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
|
||||
|
||||
# FIXME: These warnings are at least partially to be concerned about and should
|
||||
# Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary):
|
||||
CFLAGS += $(call cc-option,-fno-unwind-tables,)
|
@ -1,11 +0,0 @@
|
||||
--- a/networking/wget.c
|
||||
+++ b/networking/wget.c
|
||||
@@ -873,7 +873,7 @@ int wget_main(int argc UNUSED_PARAM, cha
|
||||
/* Ignored: */
|
||||
// "tries\0" Required_argument "t"
|
||||
/* Ignored (we always use PASV): */
|
||||
- "passive-ftp\0" No_argument "\xff"
|
||||
+ "passive-ftp\0" No_argument "\xfd"
|
||||
"header\0" Required_argument "\xfe"
|
||||
"post-data\0" Required_argument "\xfd"
|
||||
/* Ignored (we don't do ssl) */
|
@ -1,6 +1,6 @@
|
||||
--- a/util-linux/mount.c
|
||||
+++ b/util-linux/mount.c
|
||||
@@ -128,9 +128,6 @@
|
||||
@@ -138,9 +138,6 @@
|
||||
#if ENABLE_FEATURE_MOUNT_NFS
|
||||
/* This is just a warning of a common mistake. Possibly this should be a
|
||||
* uclibc faq entry rather than in busybox... */
|
@ -1,6 +1,6 @@
|
||||
--- a/scripts/kconfig/mconf.c
|
||||
+++ b/scripts/kconfig/mconf.c
|
||||
@@ -25,6 +25,10 @@
|
||||
@@ -27,6 +27,10 @@
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -1267,6 +1267,12 @@ int udhcpc_main(int argc UNUSED_PARAM, c
|
||||
@@ -1400,6 +1400,12 @@ int udhcpc_main(int argc UNUSED_PARAM, c
|
||||
/* silence "uninitialized!" warning */
|
||||
unsigned timestamp_before_wait = timestamp_before_wait;
|
||||
|
@ -0,0 +1,18 @@
|
||||
--- a/networking/udhcp/common.c
|
||||
+++ b/networking/udhcp/common.c
|
||||
@@ -64,6 +64,7 @@ const struct dhcp_optflag dhcp_optflags[
|
||||
#endif
|
||||
{ OPTION_STRING , 0xd1 }, /* DHCP_PXE_CONF_FILE */
|
||||
{ OPTION_6RD , 0xd4 }, /* DHCP_6RD */
|
||||
+ { OPTION_6RD , 0x96 }, /* DHCP_6RD (Comcast) */
|
||||
{ OPTION_STATIC_ROUTES | OPTION_LIST , 0xf9 }, /* DHCP_MS_STATIC_ROUTES */
|
||||
{ OPTION_STRING , 0xfc }, /* DHCP_WPAD */
|
||||
|
||||
@@ -131,6 +132,7 @@ const char dhcp_option_strings[] ALIGN1
|
||||
#endif
|
||||
"pxeconffile" "\0" /* DHCP_PXE_CONF_FILE */
|
||||
"ip6rd" "\0" /* DHCP_6RD */
|
||||
+ "ip6rd" "\0" /* DHCP_6RD (Comcast) */
|
||||
"msstaticroutes""\0"/* DHCP_MS_STATIC_ROUTES */
|
||||
"wpad" "\0" /* DHCP_WPAD */
|
||||
;
|
@ -1,6 +1,6 @@
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -1045,7 +1045,6 @@ static void perform_renew(void)
|
||||
@@ -1087,7 +1087,6 @@ static void perform_renew(void)
|
||||
state = RENEW_REQUESTED;
|
||||
break;
|
||||
case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
|
@ -1,6 +1,6 @@
|
||||
--- a/include/applets.src.h
|
||||
+++ b/include/applets.src.h
|
||||
@@ -218,6 +218,7 @@ IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN,
|
||||
@@ -212,6 +212,7 @@ IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN,
|
||||
IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
|
||||
IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP))
|
@ -1,6 +1,6 @@
|
||||
--- a/networking/telnetd.c
|
||||
+++ b/networking/telnetd.c
|
||||
@@ -330,6 +330,7 @@ make_new_session(
|
||||
@@ -331,6 +331,7 @@ make_new_session(
|
||||
|
||||
/* Restore default signal handling ASAP */
|
||||
bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
|
@ -1,20 +0,0 @@
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -1319,7 +1319,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
|
||||
|
||||
switch (state) {
|
||||
case INIT_SELECTING:
|
||||
- if (packet_num < discover_retries) {
|
||||
+ if (!discover_retries || packet_num < discover_retries) {
|
||||
if (packet_num == 0)
|
||||
xid = random_xid();
|
||||
/* broadcast */
|
||||
@@ -1348,7 +1348,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
|
||||
packet_num = 0;
|
||||
continue;
|
||||
case REQUESTING:
|
||||
- if (packet_num < discover_retries) {
|
||||
+ if (!discover_retries || packet_num < discover_retries) {
|
||||
/* send broadcast select packet */
|
||||
send_select(xid, server_addr, requested_ip);
|
||||
timeout = discover_timeout;
|
@ -1,143 +0,0 @@
|
||||
--- a/networking/udhcp/common.c
|
||||
+++ b/networking/udhcp/common.c
|
||||
@@ -60,6 +60,8 @@ const struct dhcp_optflag dhcp_optflags[
|
||||
{ OPTION_U8 , 0x85 }, /* DHCP_VLAN_PRIORITY */
|
||||
#endif
|
||||
{ OPTION_STATIC_ROUTES , 0xf9 }, /* DHCP_MS_STATIC_ROUTES */
|
||||
+ { OPTION_6RD , 0xd4 }, /* DHCP_6RD (RFC) */
|
||||
+ { OPTION_6RD , 0x96 }, /* DHCP_6RD (Comcast) */
|
||||
{ OPTION_STRING , 0xfc }, /* DHCP_WPAD */
|
||||
|
||||
/* Options below have no match in dhcp_option_strings[],
|
||||
@@ -127,6 +129,8 @@ const char dhcp_option_strings[] ALIGN1
|
||||
"vlanpriority" "\0"/* DHCP_VLAN_PRIORITY */
|
||||
#endif
|
||||
"msstaticroutes""\0"/* DHCP_MS_STATIC_ROUTES */
|
||||
+ "ip6rd" "\0" /* DHCP_6RD (RFC) */
|
||||
+ "ip6rd" "\0" /* DHCP_6RD (Comcast) */
|
||||
"wpad" "\0" /* DHCP_WPAD */
|
||||
;
|
||||
|
||||
@@ -155,6 +159,7 @@ const uint8_t dhcp_option_lengths[] ALIG
|
||||
[OPTION_S32] = 4,
|
||||
/* Just like OPTION_STRING, we use minimum length here */
|
||||
[OPTION_STATIC_ROUTES] = 5,
|
||||
+ [OPTION_6RD] = 22,
|
||||
};
|
||||
|
||||
|
||||
--- a/networking/udhcp/common.h
|
||||
+++ b/networking/udhcp/common.h
|
||||
@@ -91,6 +91,7 @@ enum {
|
||||
OPTION_S32,
|
||||
OPTION_BIN,
|
||||
OPTION_STATIC_ROUTES,
|
||||
+ OPTION_6RD,
|
||||
#if ENABLE_FEATURE_UDHCP_RFC3397
|
||||
OPTION_DNS_STRING, /* RFC1035 compressed domain name list */
|
||||
OPTION_SIP_SERVERS,
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -100,6 +100,7 @@ static const uint8_t len_of_option_as_st
|
||||
[OPTION_IP ] = sizeof("255.255.255.255 "),
|
||||
[OPTION_IP_PAIR ] = sizeof("255.255.255.255 ") * 2,
|
||||
[OPTION_STATIC_ROUTES ] = sizeof("255.255.255.255/32 255.255.255.255 "),
|
||||
+ [OPTION_6RD ] = sizeof("32 128 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 255.255.255.255 "),
|
||||
[OPTION_STRING ] = 1,
|
||||
[OPTION_STRING_HOST ] = 1,
|
||||
#if ENABLE_FEATURE_UDHCP_RFC3397
|
||||
@@ -124,6 +125,23 @@ static int sprint_nip(char *dest, const
|
||||
return sprintf(dest, "%s%u.%u.%u.%u", pre, ip[0], ip[1], ip[2], ip[3]);
|
||||
}
|
||||
|
||||
+static int sprint_nip6(char *dest, const char *pre, const uint8_t *ip)
|
||||
+{
|
||||
+ int len = 0;
|
||||
+ int off;
|
||||
+ uint16_t word;
|
||||
+
|
||||
+ len += sprintf(dest, "%s", pre);
|
||||
+
|
||||
+ for (off = 0; off < 16; off += 2)
|
||||
+ {
|
||||
+ move_from_unaligned16(word, &ip[off]);
|
||||
+ len += sprintf(dest+len, "%s%04X", off ? ":" : "", htons(word));
|
||||
+ }
|
||||
+
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
/* really simple implementation, just count the bits */
|
||||
static int mton(uint32_t mask)
|
||||
{
|
||||
@@ -292,6 +310,70 @@ static NOINLINE char *xmalloc_optname_op
|
||||
}
|
||||
|
||||
return ret;
|
||||
+ }
|
||||
+ case OPTION_6RD: {
|
||||
+ /* Option binary format:
|
||||
+ * 0 1 2 3
|
||||
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
+ * | OPTION_6RD | option-length | IPv4MaskLen | 6rdPrefixLen |
|
||||
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
+ * | |
|
||||
+ * | 6rdPrefix |
|
||||
+ * | (16 octets) |
|
||||
+ * | |
|
||||
+ * | |
|
||||
+ * | |
|
||||
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
+ * | 6rdBRIPv4Address(es) |
|
||||
+ * . .
|
||||
+ * . .
|
||||
+ * . .
|
||||
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
+ *
|
||||
+ * We convert it to a string "IPv4MaskLen 6rdPrefixLen 6rdPrefix 6rdBRIPv4Address"
|
||||
+ */
|
||||
+
|
||||
+ /* Sanity check: ensure that our length is at least 22 bytes, that
|
||||
+ * IPv4MaskLen is <= 32, 6rdPrefixLen <= 128 and that the sum of
|
||||
+ * (32 - IPv4MaskLen) + 6rdPrefixLen is less than or equal to 128.
|
||||
+ * If any of these requirements is not fulfilled, return with empty
|
||||
+ * value.
|
||||
+ */
|
||||
+ if ((len >= 22) && (*option <= 32) && (*(option+1) <= 128) &&
|
||||
+ (((32 - *option) + *(option+1)) <= 128))
|
||||
+ {
|
||||
+ /* IPv4MaskLen */
|
||||
+ dest += sprintf(dest, "%u ", *option++);
|
||||
+ len--;
|
||||
+
|
||||
+ /* 6rdPrefixLen */
|
||||
+ dest += sprintf(dest, "%u ", *option++);
|
||||
+ len--;
|
||||
+
|
||||
+ /* 6rdPrefix */
|
||||
+ dest += sprint_nip6(dest, "", option);
|
||||
+ option += 16;
|
||||
+ len -= 16;
|
||||
+
|
||||
+ /* 6rdBRIPv4Addresses */
|
||||
+ while (len >= 4)
|
||||
+ {
|
||||
+ dest += sprint_nip(dest, " ", option);
|
||||
+ option += 4;
|
||||
+ len -= 4;
|
||||
+
|
||||
+ /* the code to determine the option size fails to work with
|
||||
+ * lengths that are not a multiple of the minimum length,
|
||||
+ * adding all advertised 6rdBRIPv4Addresses here would
|
||||
+ * overflow the destination buffer, therefore skip the rest
|
||||
+ * for now
|
||||
+ */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
#if ENABLE_FEATURE_UDHCP_RFC3397
|
||||
case OPTION_DNS_STRING:
|
@ -1,34 +0,0 @@
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -12611,8 +12611,17 @@ exportcmd(int argc UNUSED_PARAM, char **
|
||||
const char *p;
|
||||
char **aptr;
|
||||
int flag = argv[0][0] == 'r' ? VREADONLY : VEXPORT;
|
||||
+ int mask = ~0;
|
||||
+ int nopt;
|
||||
+ while ((nopt = nextopt("np"))) {
|
||||
+ if (nopt == 'n') {
|
||||
+ mask = ~flag;
|
||||
+ } else { /* p */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (nextopt("p") != 'p') {
|
||||
+ if (nopt != 'p') {
|
||||
aptr = argptr;
|
||||
name = *aptr;
|
||||
if (name) {
|
||||
@@ -12624,10 +12633,11 @@ exportcmd(int argc UNUSED_PARAM, char **
|
||||
vp = *findvar(hashvar(name), name);
|
||||
if (vp) {
|
||||
vp->flags |= flag;
|
||||
+ vp->flags &= mask;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- setvar(name, p, flag);
|
||||
+ setvar(name, p, flag & mask);
|
||||
} while ((name = *++aptr) != NULL);
|
||||
return 0;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -6846,8 +6846,7 @@ evalvar(char *p, int flags, struct strli
|
||||
patloc = expdest - (char *)stackblock();
|
||||
if (NULL == subevalvar(p, /* varname: */ NULL, patloc, subtype,
|
||||
startloc, varflags,
|
||||
-//TODO: | EXP_REDIR too? All other such places do it too
|
||||
- /* quotes: */ flags & (EXP_FULL | EXP_CASE),
|
||||
+ /* quotes: */ flags & (EXP_FULL | EXP_CASE | EXP_REDIR),
|
||||
var_str_list)
|
||||
) {
|
||||
int amount = expdest - (
|
@ -1,22 +0,0 @@
|
||||
--- a/networking/vconfig.c
|
||||
+++ b/networking/vconfig.c
|
||||
@@ -116,8 +116,6 @@ static const char name_types[] ALIGN1 =
|
||||
'_', 'N', 'O', '_', 'P', 'A', 'D', 0,
|
||||
};
|
||||
|
||||
-static const char conf_file_name[] ALIGN1 = "/proc/net/vlan/config";
|
||||
-
|
||||
int vconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int vconfig_main(int argc, char **argv)
|
||||
{
|
||||
@@ -129,10 +127,6 @@ int vconfig_main(int argc, char **argv)
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
- /* Don't bother closing the filedes. It will be closed on cleanup. */
|
||||
- /* Will die if 802.1q is not present */
|
||||
- xopen(conf_file_name, O_RDONLY);
|
||||
-
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
|
||||
++argv;
|
@ -1,29 +0,0 @@
|
||||
From b7841cf7b919b16d1bd4619154bf7cb4c22b4ccd Mon Sep 17 00:00:00 2001
|
||||
From: Paul Marks <paul@pmarks.net>
|
||||
Date: Mon, 14 Jan 2013 01:39:10 +0000
|
||||
Subject: ntpd: fix incorrect m_status field in outgoing packets. Closes 5120
|
||||
|
||||
When using busybox ntpd with an NTPv3 client and NTPv4 server (or vice
|
||||
versa), the version numbers can be incorrectly ORed together, yielding
|
||||
the bogus value of "NTPv7". This makes ntpd unusable with clients
|
||||
such as Chrony and Windows "Internet Time".
|
||||
|
||||
This patch avoids the version mangling, by copying only the Leap
|
||||
Indicator bits from the server's status field.
|
||||
|
||||
Signed-off-by: Paul Marks <paul@pmarks.net>
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
---
|
||||
(limited to 'networking/ntpd.c')
|
||||
|
||||
--- a/networking/ntpd.c
|
||||
+++ b/networking/ntpd.c
|
||||
@@ -1794,7 +1794,7 @@ recv_and_process_client_pkt(void /*int f
|
||||
|
||||
/* Build a reply packet */
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
- msg.m_status = G.stratum < MAXSTRAT ? G.ntp_status : LI_ALARM;
|
||||
+ msg.m_status = G.stratum < MAXSTRAT ? (G.ntp_status & LI_MASK) : LI_ALARM;
|
||||
msg.m_status |= (query_status & VERSION_MASK);
|
||||
msg.m_status |= ((query_status & MODE_MASK) == MODE_CLIENT) ?
|
||||
MODE_SERVER : MODE_SYM_PAS;
|
@ -1,11 +0,0 @@
|
||||
--- a/libbb/dump.c
|
||||
+++ b/libbb/dump.c
|
||||
@@ -301,7 +301,7 @@ static NOINLINE void rewrite(priv_dumper
|
||||
) {
|
||||
fu->reps += (dumper->blocksize - fs->bcnt) / fu->bcnt;
|
||||
}
|
||||
- if (fu->reps > 1) {
|
||||
+ if (fu->reps > 1 && fu->nextpr) {
|
||||
for (pr = fu->nextpr;; pr = pr->nextpr)
|
||||
if (!pr->nextpr)
|
||||
break;
|
@ -1,86 +0,0 @@
|
||||
--- a/networking/udhcp/dhcpc.c
|
||||
+++ b/networking/udhcp/dhcpc.c
|
||||
@@ -26,8 +26,8 @@
|
||||
#include "dhcpc.h"
|
||||
|
||||
#include <netinet/if_ether.h>
|
||||
-#include <netpacket/packet.h>
|
||||
#include <linux/filter.h>
|
||||
+#include <linux/if_packet.h>
|
||||
|
||||
/* struct client_config_t client_config is in bb_common_bufsiz1 */
|
||||
|
||||
@@ -846,17 +846,41 @@ static int send_release(uint32_t server,
|
||||
static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
|
||||
{
|
||||
int bytes;
|
||||
+ int nocsum = 0;
|
||||
struct ip_udp_dhcp_packet packet;
|
||||
uint16_t check;
|
||||
+ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
|
||||
+ struct iovec iov = {
|
||||
+ .iov_base = &packet,
|
||||
+ .iov_len = sizeof(packet),
|
||||
+ };
|
||||
+ struct msghdr msg = {
|
||||
+ .msg_iov = &iov,
|
||||
+ .msg_iovlen = 1,
|
||||
+ .msg_control = cmsgbuf,
|
||||
+ .msg_controllen = sizeof(cmsgbuf),
|
||||
+ };
|
||||
+ struct cmsghdr *cmsg;
|
||||
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
- bytes = safe_read(fd, &packet, sizeof(packet));
|
||||
+ do {
|
||||
+ bytes = recvmsg(fd, &msg, 0);
|
||||
+ } while (bytes < 0 && errno == EINTR);
|
||||
+
|
||||
if (bytes < 0) {
|
||||
log1("Packet read error, ignoring");
|
||||
/* NB: possible down interface, etc. Caller should pause. */
|
||||
return bytes; /* returns -1 */
|
||||
}
|
||||
|
||||
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
||||
+ if (cmsg->cmsg_level == SOL_PACKET &&
|
||||
+ cmsg->cmsg_type == PACKET_AUXDATA) {
|
||||
+ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
|
||||
+ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) {
|
||||
log1("Packet is too short, ignoring");
|
||||
return -2;
|
||||
@@ -896,7 +920,7 @@ static NOINLINE int udhcp_recv_raw_packe
|
||||
packet.ip.tot_len = packet.udp.len; /* yes, this is needed */
|
||||
check = packet.udp.check;
|
||||
packet.udp.check = 0;
|
||||
- if (check && check != udhcp_checksum(&packet, bytes)) {
|
||||
+ if (!nocsum && check && check != udhcp_checksum(&packet, bytes)) {
|
||||
log1("Packet with bad UDP checksum received, ignoring");
|
||||
return -2;
|
||||
}
|
||||
@@ -942,6 +966,7 @@ static int udhcp_raw_socket(int ifindex)
|
||||
{
|
||||
int fd;
|
||||
struct sockaddr_ll sock;
|
||||
+ int val;
|
||||
|
||||
/*
|
||||
* Comment:
|
||||
@@ -1008,6 +1033,13 @@ static int udhcp_raw_socket(int ifindex)
|
||||
log1("Attached filter to raw socket fd %d", fd); // log?
|
||||
}
|
||||
|
||||
+ val = 1;
|
||||
+ if (setsockopt(fd, SOL_PACKET, PACKET_AUXDATA, &val,
|
||||
+ sizeof(val)) < 0) {
|
||||
+ if (errno != ENOPROTOOPT)
|
||||
+ log1("Failed to set auxiliary packet data for socket fd %d", fd);
|
||||
+ }
|
||||
+
|
||||
log1("Created raw socket");
|
||||
|
||||
return fd;
|
@ -1,16 +0,0 @@
|
||||
--- a/include/platform.h
|
||||
+++ b/include/platform.h
|
||||
@@ -443,6 +443,13 @@ typedef unsigned smalluint;
|
||||
# undef HAVE_NET_ETHERNET_H
|
||||
#endif
|
||||
|
||||
+#if defined(__musl__)
|
||||
+# undef HAVE_SETBIT
|
||||
+# include <stddef.h>
|
||||
+# include <termios.h>
|
||||
+# include <sys/ioctl.h>
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Now, define prototypes for all the functions defined in platform.c
|
||||
* These must come after all the HAVE_* macros are defined (or not)
|
Loading…
Reference in New Issue