Merge branch 'arm-master' into arm-sdk7

arm-sdk7 2020.6.084
pedro 5 years ago
commit c7f79f2f26

@ -1250,10 +1250,10 @@ r7000z:
@$(MAKE) z ARM=y NVRAM_64K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" DPSTA=y
r6400e:
@$(MAKE) e ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" DPSTA=y
@$(MAKE) e ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" NO_JFFS=y DPSTA=y
r6400z:
@$(MAKE) z ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" DPSTA=y
@$(MAKE) z ARM=y NVRAM_128K=y NAND=y BCMSMP=y ASUS_TRX="NETGEAR" UFSD="ASUS" NO_JFFS=y DPSTA=y
r7000init:
@$(MAKE) bin ARM=y NVRAM_64K=y NAND=y BCMSMP=y B=E IPV6SUPP=y OPENVPN=y OPENSSL11=y DPSTA=y BUILD_DESC="initial" NETGEAR_CHK="R7000" BOARDID_FILE="compatible_r7000.txt" FW_CFG_FILE="tomato_cfg.h"

@ -959,18 +959,20 @@ endif
busybox: dummy
@$(SEP)
$(call patch_files,busybox)
@$(MAKE) -C busybox EXTRA_CFLAGS="-fPIC $(EXTRACFLAGS)" $(PARALLEL_BUILD)
busybox-install:
rm -rf $(INSTALLDIR)/busybox
$(MAKE) -C busybox install EXTRA_CFLAGS="-fPIC $(EXTRACFLAGS)" CONFIG_PREFIX=$(INSTALLDIR)/busybox
busybox-clean:
-@$(MAKE) -C busybox distclean
busybox-config:
$(MAKE) -C busybox menuconfig
busybox-clean:
-@$(MAKE) -C busybox distclean
$(call unpatch_files,busybox)
httpd: shared nvram$(BCMEX) mssl
@$(SEP)
@$(MAKE) -C httpd
@ -1696,7 +1698,8 @@ flac/stamp-h1: libogg
LDFLAGS="-L$(TOP)/libogg/src/.libs -fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \
$(CONFIGURE) --enable-shared --enable-static --prefix='' --disable-rpath \
--disable-doxygen-docs --disable-xmms-plugin --disable-cpplibs --disable-thorough-tests \
--without-libiconv-prefix --disable-altivec --disable-sse --disable-dependency-tracking
--without-libiconv-prefix --disable-altivec --disable-sse --disable-dependency-tracking \
--with-ogg=$(TOP)/libogg/src/.libs
@touch $@
flac: flac/stamp-h1 libogg

@ -6,6 +6,8 @@
*.o.*
*.a
*.s
Kbuild
Config.in
#
# Never ignore these

@ -471,8 +471,6 @@ libs-y := \
coreutils/libcoreutils/ \
debianutils/ \
e2fsprogs/ \
e2fsprogs/e2p/ \
e2fsprogs/ext2fs/ \
editors/ \
findutils/ \
init/ \

@ -51,7 +51,7 @@ CFLAGS += $(call cc-option,-fno-builtin-strlen -finline-limit=0 -fomit-frame-poi
# -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 -shared-libgcc,)
CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
# Defeat .eh_frame bloat (gcc 4.6.3 x86-32 defconfig: 20% smaller busybox binary):
CFLAGS += $(call cc-option,-fno-unwind-tables,)

@ -71,7 +71,7 @@ int main(void)
} else {
printf(", ");
}
printf("%s", usage_array[i].aname);
printf(usage_array[i].aname);
col += len2;
}
printf("\n\n");

@ -899,7 +899,6 @@ CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y
# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
CONFIG_DHCPD_LEASES_FILE=""
CONFIG_UDHCPC=y
# CONFIG_UDHCPC_OLD is not set
# CONFIG_FEATURE_UDHCPC_ARPING is not set
# CONFIG_FEATURE_UDHCP_PORT is not set
# CONFIG_FEATURE_UDHCPC_SANITIZEOPT is not set

@ -178,8 +178,6 @@ int df_main(int argc UNUSED_PARAM, char **argv)
device = mount_entry->mnt_fsname;
mount_point = mount_entry->mnt_dir;
fs_type = mount_entry->mnt_type;
if (strcmp(mount_point, "proc") == 0 || strcmp(mount_point, "ramfs") == 0)
continue;
if (statfs(mount_point, &s) != 0) {
bb_simple_perror_msg(mount_point);

@ -205,7 +205,7 @@ foreach my $module ( keys %$mod ) {
if($kseries eq '2.4') {
print "$module:\t";
my @sorted = sort bydep keys %{$mod->{$module}};
print join(" ",@sorted);
print join(" \\\n\t",@sorted);
print "\n\n";
} else {
my $shortmod = $module;

@ -906,10 +906,6 @@ char* hex2bin(char *dst, const char *src, int count) FAST_FUNC;
/* Generate a UUID */
void generate_uuid(uint8_t *buf) FAST_FUNC;
/* expand UUID to human readable format */
char *unparse_uuid(const uint8_t *uu, char *out) FAST_FUNC;
/* parse UUID */
int parse_uuid(const char *in, uint8_t *uuid) FAST_FUNC;
/* Last element is marked by mult == 0 */
struct suffix_mult {
@ -1834,7 +1830,7 @@ extern const char bb_busybox_exec_path[] ALIGN1;
* but I want to save a few bytes here */
extern const char bb_PATH_root_path[] ALIGN1; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin:/opt/sbin"))
#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
extern const int const_int_0;
//extern const int const_int_1;

@ -20,14 +20,12 @@
char *get_devname_from_label(const char *spec);
char *get_devname_from_uuid(const char *spec);
char *get_devname_from_device(dev_t dev);
void display_uuid_cache(int scan_devices);
/* Returns:
* 0 : no UUID= or LABEL= prefix found
* 1 : UUID= or LABEL= prefix found. In this case,
* *fsname is replaced if device with such UUID or LABEL is found
* -2: UUID= or LABEL= prefixes cannot be resolved
* 0: no UUID= or LABEL= prefix found
* 1: UUID= or LABEL= prefix found. In this case,
* *fsname is replaced if device with such UUID or LABEL is found
*/
int resolve_mount_spec(char **fsname);
int add_to_uuid_cache(const char *device, dev_t devno);
int add_to_uuid_cache(const char *device);

@ -171,7 +171,6 @@ lib-$(CONFIG_PING) += inet_cksum.o
lib-$(CONFIG_TRACEROUTE) += inet_cksum.o
lib-$(CONFIG_TRACEROUTE6) += inet_cksum.o
lib-$(CONFIG_UDHCPC) += inet_cksum.o
lib-$(CONFIG_UDHCPC_OLD) += inet_cksum.o
lib-$(CONFIG_UDHCPC6) += inet_cksum.o
lib-$(CONFIG_UDHCPD) += inet_cksum.o

@ -62,9 +62,7 @@ unsigned long long FAST_FUNC bb_strtoull(const char *arg, char **endp, int base)
/* strtoul(" -4200000000") returns 94967296, errno 0 (!) */
/* I don't think that this is right. Preventing this... */
//if (!isalnum(arg[0])) return ret_ERANGE();
char first = (arg[0] != '-' ? arg[0] : arg[1]);
if (!isalnum(first)) return ret_ERANGE();
if (!isalnum(arg[0])) return ret_ERANGE();
/* not 100% correct for lib func, but convenient for the caller */
errno = 0;
@ -102,7 +100,6 @@ unsigned long FAST_FUNC bb_strtoul(const char *arg, char **endp, int base)
*endp = (char*) arg;
if (!isalnum(arg[0])) return ret_ERANGE();
errno = 0;
v = strtoul(arg, endp, base);
return handle_errors(v, endp);
@ -136,7 +133,6 @@ unsigned FAST_FUNC bb_strtou(const char *arg, char **endp, int base)
*endp = (char*) arg;
if (!isalnum(arg[0])) return ret_ERANGE();
errno = 0;
v = strtoul(arg, endp, base);
if (v > UINT_MAX) return ret_ERANGE();

@ -29,14 +29,15 @@ static char *find_block_device_in_dir(struct arena *ap)
char *retpath = NULL;
int len, rem;
dir = opendir(ap->devpath);
if (!dir)
return NULL;
len = strlen(ap->devpath);
rem = DEVNAME_MAX-2 - len;
if (rem <= 0)
return NULL;
dir = opendir(ap->devpath);
if (!dir)
return NULL;
ap->devpath[len++] = '/';
while ((entry = readdir(dir)) != NULL) {

@ -40,7 +40,7 @@ const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL;
/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
* but I want to save a few bytes here. Check libbb.h before changing! */
const char bb_PATH_root_path[] ALIGN1 =
"PATH=/sbin:/usr/sbin:/opt/sbin:/bin:/usr/bin:/opt/bin" BB_ADDITIONAL_PATH;
"PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH;
//const int const_int_1 = 1;

@ -59,6 +59,13 @@ void FAST_FUNC bb_progress_init(bb_progress_t *p, const char *curfile)
p->last_size = 0;
}
/* File already had beg_size bytes.
* Then we started downloading.
* We downloaded "transferred" bytes so far.
* Download is expected to stop when total size (beg_size + transferred)
* will be "totalsize" bytes.
* If totalsize == 0, then it is unknown.
*/
void FAST_FUNC bb_progress_update(bb_progress_t *p,
uoff_t beg_size,
uoff_t transferred,
@ -168,6 +175,7 @@ void FAST_FUNC bb_progress_update(bb_progress_t *p,
}
since_last_update = 0; /* we are un-stalled now */
}
elapsed -= p->start_sec; /* now it's "elapsed since start" */
if (since_last_update >= STALLTIME) {

@ -327,49 +327,3 @@ int FAST_FUNC wait_for_exitstatus(pid_t pid)
bb_perror_msg_and_die("waitpid");
return exit_status;
}
char * FAST_FUNC unparse_uuid(const uint8_t *uu, char *out)
{
char uuid_string[32];
bin2hex(uuid_string, (char *)uu, 16);
/* f.e. UUID=dfd9c173-be52-4d27-99a5-c34c6c2ff55f */
sprintf(out, "%.8s-%.4s-%.4s-%.4s-%.12s",
uuid_string,
uuid_string+8,
uuid_string+8+4,
uuid_string+8+4+4,
uuid_string+8+4+4+4
);
return out;
}
static unsigned char fromhex(char c)
{
if (isdigit(c))
return (c - '0');
return ((c|0x20) - 'a' + 10);
}
/* Parse & verify UUID string */
int FAST_FUNC parse_uuid(const char *s, uint8_t *uuid)
{
int i;
if (strlen(s) != 36 || s[8] != '-' || s[13] != '-'
|| s[18] != '-' || s[23] != '-'
) {
return -1;
}
for (i = 0; i < 16; i++) {
if (*s == '-')
s++;
if (!isxdigit(s[0]) || !isxdigit(s[1]))
return -2;
uuid[i] = ((fromhex(s[0]) << 4) | fromhex(s[1]));
s += 2;
}
return 0;
}

@ -11,7 +11,6 @@
#include "libbb.h"
#include "modutils.h"
#include <fnmatch.h>
/* 2.6 style insmod has no options and required filename
* (not module name - .ko can't be omitted) */
@ -36,34 +35,10 @@
//usage: )
//usage:#endif
static char *m_filename;
static int FAST_FUNC check_module_name_match(const char *filename,
struct stat *statbuf UNUSED_PARAM,
void *userdata, int depth UNUSED_PARAM)
{
char *fullname = (char *) userdata;
char *tmp;
if (fullname[0] == '\0')
return FALSE;
tmp = bb_get_last_path_component_nostrip(filename);
if (strcmp(tmp, fullname) == 0) {
/* Stop searching if we find a match */
m_filename = xstrdup(filename);
return FALSE;
}
return TRUE;
}
int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int insmod_main(int argc UNUSED_PARAM, char **argv)
{
struct stat st;
char *filename;
FILE *fp = NULL;
int pos;
int rc;
/* Compat note:
@ -83,45 +58,9 @@ int insmod_main(int argc UNUSED_PARAM, char **argv)
if (!filename)
bb_show_usage();
m_filename = NULL;
pos = strlen(filename) - 2;
if (get_linux_version_code() < KERNEL_VERSION(2,6,0)) {
if (pos < 0) pos = 0;
if (strncmp(&filename[pos], ".o", 2) !=0)
filename = xasprintf("%s.o", filename);
} else {
if (--pos < 0) pos = 0;
if (strncmp(&filename[pos], ".ko", 3) !=0)
filename = xasprintf("%s.ko", filename);
}
/* Get a filedesc for the module. Check if we have a complete path */
if (stat(filename, &st) < 0 || !S_ISREG(st.st_mode) ||
(fp = fopen_for_read(filename)) == NULL) {
/* Hmm. Could not open it. Search /lib/modules/ */
int r;
char *module_dir;
module_dir = xmalloc_readlink(CONFIG_DEFAULT_MODULES_DIR);
if (!module_dir)
module_dir = xstrdup(CONFIG_DEFAULT_MODULES_DIR);
r = recursive_action(module_dir, ACTION_RECURSE,
check_module_name_match, NULL, filename, 0);
free(module_dir);
if (r)
bb_error_msg_and_die("'%s': module not found", filename);
if (m_filename == NULL || ((fp = fopen_for_read(m_filename)) == NULL))
bb_error_msg_and_die("'%s': module not found", filename);
filename = m_filename;
}
if (fp != NULL)
fclose(fp);
rc = bb_init_module(filename, parse_cmdline_module_options(argv, /*quote_spaces:*/ 0));
if (rc)
bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
free(m_filename);
return rc;
}

@ -417,7 +417,7 @@ static int do_modprobe(struct module_entry *m)
if (option_mask32 & OPT_REMOVE) {
/* modprobe -r */
if (m2->flags & MODULE_FLAG_LOADED) {
rc = bb_delete_module(m2->modname, O_NONBLOCK | O_EXCL);
rc = bb_delete_module(m2->modname, O_EXCL);
if (rc) {
if (first) {
bb_perror_msg("can't unload module '%s'",

@ -3824,7 +3824,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
/* Load module into memory and unzip if compressed */
image = xmalloc_open_zipped_read_close(m_filename, &image_size);
if (!image)
return (-errno);
return EXIT_FAILURE;
}
m_name = xstrdup(bb_basename(m_filename));
@ -3855,10 +3855,8 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
"\twhile this kernel is version %s",
flag_force_load ? "warning: " : "",
m_name, m_strversion, uts.release);
if (!flag_force_load) {
exit_status = ESRCH;
if (!flag_force_load)
goto out;
}
}
}
#endif

@ -885,7 +885,7 @@ static void ife_print6(struct interface *ptr)
inet_pton(AF_INET6, addr6,
(struct sockaddr *) &sap.sin6_addr);
sap.sin6_family = AF_INET6;
printf(" inet6 addr: %s/%d",
printf(" inet6 addr: %s/%d",
INET6_sprint((struct sockaddr *) &sap, 1),
plen);
printf(" Scope:");
@ -936,7 +936,7 @@ static void ife_print(struct interface *ptr)
if (hw == NULL)
hw = get_hwntype(-1);
printf("%-10s Link encap:%s ", ptr->name, hw->title);
printf("%-9s Link encap:%s ", ptr->name, hw->title);
/* For some hardware types (eg Ash, ATM) we don't print the
hardware address if it's null. */
if (hw->print != NULL
@ -954,7 +954,7 @@ static void ife_print(struct interface *ptr)
bb_putchar('\n');
if (ptr->has_ip) {
printf(" %s addr:%s ", ap->name,
printf(" %s addr:%s ", ap->name,
ap->sprint(&ptr->addr, 1));
if (ptr->flags & IFF_POINTOPOINT) {
printf(" P-t-P:%s ", ap->sprint(&ptr->dstaddr, 1));
@ -967,7 +967,7 @@ static void ife_print(struct interface *ptr)
ife_print6(ptr);
printf(" ");
printf(" ");
/* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
if (ptr->flags == 0) {
@ -1035,26 +1035,26 @@ static void ife_print(struct interface *ptr)
* not for the aliases, although strictly speaking they're shared
* by all addresses.
*/
printf(" ");
printf(" ");
printf("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n",
ptr->stats.rx_packets, ptr->stats.rx_errors,
ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
ptr->stats.rx_frame_errors);
if (can_compress)
printf(" compressed:%lu\n",
printf(" compressed:%lu\n",
ptr->stats.rx_compressed);
printf(" ");
printf(" ");
printf("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n",
ptr->stats.tx_packets, ptr->stats.tx_errors,
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
ptr->stats.tx_carrier_errors);
printf(" collisions:%lu ", ptr->stats.collisions);
printf(" collisions:%lu ", ptr->stats.collisions);
if (can_compress)
printf("compressed:%lu ", ptr->stats.tx_compressed);
if (ptr->tx_queue_len != -1)
printf("txqueuelen:%d ", ptr->tx_queue_len);
printf("\n R");
printf("\n R");
print_bytes_scaled(ptr->stats.rx_bytes, " T");
print_bytes_scaled(ptr->stats.tx_bytes, "\n");
}
@ -1062,7 +1062,7 @@ static void ife_print(struct interface *ptr)
if (ptr->map.irq || ptr->map.mem_start
|| ptr->map.dma || ptr->map.base_addr
) {
printf(" ");
printf(" ");
if (ptr->map.irq)
printf("Interrupt:%d ", ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for I/O maps */

@ -2048,6 +2048,7 @@ recv_and_process_client_pkt(void /*int fd*/)
addr = xmalloc_sockaddr2dotted_noport(from);
bb_error_msg("malformed packet received from %s: size %u", addr, (int)size);
free(addr);
goto bail;
}
/* Respond only to client and symmetric active packets */

@ -333,7 +333,6 @@ make_new_session(
/* Restore default signal handling ASAP */
bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
signal(SIGINT, SIG_DFL);
pid = getpid();

@ -36,6 +36,9 @@ const struct dhcp_optflag dhcp_optflags[] = {
{ OPTION_STRING , 0x11 }, /* DHCP_ROOT_PATH */
{ OPTION_U8 , 0x17 }, /* DHCP_IP_TTL */
{ OPTION_U16 , 0x1a }, /* DHCP_MTU */
//TODO: why do we request DHCP_BROADCAST? Can't we assume that
//in the unlikely case it is different from typical N.N.255.255,
//server would let us know anyway?
{ OPTION_IP | OPTION_REQ, 0x1c }, /* DHCP_BROADCAST */
{ OPTION_IP_PAIR | OPTION_LIST , 0x21 }, /* DHCP_ROUTES */
{ OPTION_STRING_HOST , 0x28 }, /* DHCP_NIS_DOMAIN */

@ -1,4 +1,4 @@
/* vi: set sw=4 ts=4: */
/* vi: set sw=4 ts=4: */
/*
* Russ Dill <Russ.Dill@asu.edu> September 2001
* Rewritten by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
@ -74,8 +74,6 @@ struct BUG_bad_sizeof_struct_ip_udp_dhcp_packet {
char c[IP_UDP_DHCP_SIZE == 576 ? 1 : -1];
};
extern int minpkt; // zzz
/*** Options ***/
@ -305,7 +303,7 @@ void udhcp_sp_setup(void) FAST_FUNC;
int udhcp_sp_fd_set(fd_set *rfds, int extra_fd) FAST_FUNC;
int udhcp_sp_read(const fd_set *rfds) FAST_FUNC;
int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac, uint16_t *mtu) FAST_FUNC;
int udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) FAST_FUNC;
int udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) FAST_FUNC;

@ -25,15 +25,9 @@
#include "dhcpd.h"
#include "dhcpc.h"
#include <asm/types.h>
/*#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION)
# include <linux/if_packet.h>
# include <netinet/if_ether.h>
#else */
# include <linux/if_packet.h>
# include <linux/if_ether.h>
/*#endif*/
#include <netinet/if_ether.h>
#include <linux/filter.h>
#include <linux/if_packet.h>
#ifndef PACKET_AUXDATA
# define PACKET_AUXDATA 8
@ -66,7 +60,6 @@ static const char udhcpc_longopts[] ALIGN1 =
"request\0" Required_argument "r"
"script\0" Required_argument "s"
"timeout\0" Required_argument "T"
"version\0" No_argument "v"
"retries\0" Required_argument "t"
"tryagain\0" Required_argument "A"
"syslog\0" No_argument "S"
@ -102,9 +95,8 @@ enum {
OPT_x = 1 << 18,
OPT_f = 1 << 19,
OPT_B = 1 << 20,
OPT_m = 1 << 21, // zzz
/* The rest has variable bit positions, need to be clever */
OPTBIT_LAST = 21,
OPTBIT_B = 20,
USE_FOR_MMU( OPTBIT_b,)
IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
@ -121,7 +113,7 @@ static const uint8_t len_of_option_as_string[] ALIGN1 = {
[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("132 128 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 255.255.255.255 "),
[OPTION_6RD ] = sizeof("132 128 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 255.255.255.255 "),
[OPTION_STRING ] = 1,
[OPTION_STRING_HOST ] = 1,
#if ENABLE_FEATURE_UDHCP_RFC3397
@ -615,10 +607,7 @@ static void add_client_options(struct dhcp_packet *packet)
{
int i, end, len;
len = sizeof(struct ip_udp_dhcp_packet);
if (client_config.client_mtu == 0 ||
client_config.client_mtu > len)
udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(len));
udhcp_add_simple_option(packet, DHCP_MAX_SIZE, htons(IP_UDP_DHCP_SIZE));
/* Add a "param req" option with the list of options we'd like to have
* from stubborn DHCP servers. Pull the data from the struct in common.c.
@ -648,10 +637,6 @@ static void add_client_options(struct dhcp_packet *packet)
if ((option_mask32 & OPT_B) && packet->ciaddr == 0)
packet->flags |= htons(BROADCAST_FLAG);
/* Request broadcast replies if we have no IP addr */
if ((option_mask32 & OPT_B) && packet->ciaddr == 0)
packet->flags |= htons(BROADCAST_FLAG);
/* Add -x options if any */
{
struct option_set *curr = client_config.options;
@ -712,7 +697,6 @@ static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t
static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
{
struct dhcp_packet packet;
static int msgs = 0;
/* Fill in: op, htype, hlen, cookie, chaddr fields,
* random xid field (we override it below),
@ -730,7 +714,6 @@ static NOINLINE int send_discover(uint32_t xid, uint32_t requested)
*/
add_client_options(&packet);
if (msgs++ < 3)
bb_error_msg("sending %s", "discover");
return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY);
}
@ -1112,12 +1095,13 @@ static void perform_renew(void)
bb_error_msg("performing DHCP renew");
switch (state) {
case BOUND:
change_listen_mode(LISTEN_RAW); // zzz
change_listen_mode(LISTEN_KERNEL);
case RENEWING:
case REBINDING:
// state = RENEW_REQUESTED; // zzz
// break;
state = RENEW_REQUESTED;
break;
case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
udhcp_run_script(NULL, "deconfig");
case REQUESTING:
case RELEASED:
change_listen_mode(LISTEN_RAW);
@ -1248,7 +1232,6 @@ static void client_background(void)
//usage: "\n -x lease:3600 - option 51 (lease time)"
//usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)"
//usage: "\n -F NAME Ask server to update DNS mapping for NAME"
//usage: "\n -H,-h NAME Send NAME as client hostname (default none)"
//usage: "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')"
//usage: "\n -C Don't send MAC as client identifier"
//usage: IF_UDHCP_VERBOSE(
@ -1256,8 +1239,8 @@ static void client_background(void)
//usage: )
//usage: )
//usage: "\nSignals:"
//usage: "\n USR1 Renew current lease"
//usage: "\n USR2 Release current lease"
//usage: "\n USR1 Renew lease"
//usage: "\n USR2 Release lease"
int udhcpc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@ -1272,7 +1255,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
llist_t *list_x = NULL;
int tryagain_timeout = 20;
int discover_timeout = 3;
int discover_retries = 5;
int discover_retries = 3;
uint32_t server_addr = server_addr; /* for compiler */
uint32_t requested_ip = 0;
uint32_t xid = xid; /* for compiler */
@ -1297,10 +1280,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
/* Parse command line */
/* O,x: list; -T,-t,-A take numeric param */
opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ;
IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB"
"m" // zzz
USE_FOR_MMU("b")
IF_FEATURE_UDHCPC_ARPING("a::")
IF_FEATURE_UDHCP_PORT("P:")
@ -1371,14 +1352,10 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
udhcp_str2optset(optstr, &client_config.options);
}
if (opt & OPT_m) // zzz
minpkt = 1;
if (udhcp_read_interface(client_config.interface,
&client_config.ifindex,
NULL,
client_config.client_mac,
&client_config.client_mtu)
client_config.client_mac)
) {
return 1;
}
@ -1485,8 +1462,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
if (udhcp_read_interface(client_config.interface,
&client_config.ifindex,
NULL,
client_config.client_mac,
&client_config.client_mtu)
client_config.client_mac)
) {
goto ret0; /* iface is gone? */
}
@ -1545,7 +1521,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
/* 1/2 lease passed, enter renewing state */
state = RENEWING;
client_config.first_secs = 0; /* make secs field count from 0 */
change_listen_mode(LISTEN_RAW); // was: LISTEN_KERNEL -- zzz
change_listen_mode(LISTEN_KERNEL);
log1("entering renew state");
/* fall right through */
case RENEW_REQUESTED: /* manual (SIGUSR1) renew */
@ -1602,12 +1578,23 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
switch (udhcp_sp_read(&rfds)) {
case SIGUSR1:
client_config.first_secs = 0; /* make secs field count from 0 */
// already_waited_sec = 0; /* shibby - this broke tomato renew button */
already_waited_sec = 0;
perform_renew();
if (state == RENEW_REQUESTED)
// if (timeout > tryagain_timeout) /* shibby - this broke tomato renew button */
// timeout = tryagain_timeout; /* shibby - this broke tomato renew button */
if (state == RENEW_REQUESTED) {
/* We might be either on the same network
* (in which case renew might work),
* or we might be on a completely different one
* (in which case renew won't ever succeed).
* For the second case, must make sure timeout
* is not too big, or else we can send
* futile renew requests for hours.
* (Ab)use -A TIMEOUT value (usually 20 sec)
* as a cap on the timeout.
*/
if (timeout > tryagain_timeout)
timeout = tryagain_timeout;
goto case_RENEW_REQUESTED;
}
/* Start things over */
packet_num = 0;
/* Kill any timeouts, user wants this to hurry along */

@ -9,7 +9,6 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
struct client_config_t {
uint8_t client_mac[6]; /* Our mac address */
uint16_t client_mtu; /* Our mtu */
IF_FEATURE_UDHCP_PORT(uint16_t port;)
int ifindex; /* Index number of the interface to use */
uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */

@ -280,7 +280,7 @@ int dhcprelay_main(int argc, char **argv)
max_socket = init_sockets(iface_list, num_sockets, fds);
/* Get our IP on server_iface */
if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL, NULL))
if (udhcp_read_interface(argv[2], NULL, &our_nip, NULL))
return 1;
/* Main loop */
@ -360,7 +360,7 @@ int dhcprelay_main(int argc, char **argv)
// of the 'giaddr' field does not match one of the relay agent's
// directly-connected logical interfaces, the BOOTREPLY messsage MUST be
// silently discarded.
if (udhcp_read_interface(iface_list[i], NULL, &dhcp_msg.gateway_nip, NULL, NULL)) {
if (udhcp_read_interface(iface_list[i], NULL, &dhcp_msg.gateway_nip, NULL)) {
/* Fall back to our IP on server iface */
// this makes more sense!
dhcp_msg.gateway_nip = our_nip;

@ -12,8 +12,6 @@
#include <netinet/if_ether.h>
#include <netpacket/packet.h>
int minpkt = 0; // zzz
void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
{
memset(packet, 0, sizeof(*packet));
@ -151,9 +149,7 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
* Thus, we retain enough padding to not go below 300 BOOTP bytes.
* Some devices have filters which drop DHCP packets shorter than that.
*/
padding = minpkt ? DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options) : 0;
padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options);
if (padding > DHCP_SIZE - 300)
padding = DHCP_SIZE - 300;
@ -225,7 +221,7 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
}
udhcp_dump_packet(dhcp_pkt);
padding = minpkt ? DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options) : 0;
padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options);
if (padding > DHCP_SIZE - 300)
padding = DHCP_SIZE - 300;
result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding);

@ -22,21 +22,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <net/if.h>
#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
# include <netpacket/packet.h>
# include <net/ethernet.h>
#else
# include <asm/types.h>
# include <linux/if_packet.h>
# include <linux/if_ether.h>
#endif
#include "common.h"
#include <net/if.h>
int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac, uint16_t *mtu)
int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac)
{
/* char buffer instead of bona-fide struct avoids aliasing warning */
char ifr_buf[sizeof(struct ifreq)];
struct ifreq *const ifr = (void *)ifr_buf;
@ -80,15 +70,6 @@ int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
}
if (mtu) {
if (ioctl_or_warn(fd, SIOCGIFMTU, ifr) != 0) {
close(fd);
return -1;
}
log1("Adapter mtu %d", ifr->ifr_mtu);
*mtu = ifr->ifr_mtu;
}
close(fd);
return 0;
}

@ -61,22 +61,16 @@
//config: Busybox itself contains no SSL code. wget will spawn
//config: a helper program to talk over HTTPS.
//config:
//config: If you select "openssl" helper, wget will effectively run:
//config: "openssl s_client -quiet -connect hostname:443
//config: -servername hostname 2>/dev/null" and pipe its data
//config: through it. (-servername should only be used with FQDNs,
//config: not IP addresses.)
//config: OpenSSL has a simple SSL client for debug purposes.
//config: If you select "openssl" helper, wget will effectively call
//config: "openssl s_client -quiet -connect IP:443 2>/dev/null"
//config: and pipe its data through it.
//config: Note inconvenient API: host resolution is done twice,
//config: and there is no guarantee openssl's idea of IPv6 address
//config: format is the same as ours.
//config: Another problem is that s_client prints debug information
//config: to stderr, and it needs to be suppressed. This means
//config: all error messages get suppressed too.
//config: Also, if the s_client subcommand is not compiled in to
//config: the system's openssl binary (i.e. subcommand fails), or
//config: certain subcommand flags aren't available/supported,
//config: openssl returns exit code 0, making it difficult to
//config: detect a true error/failure.
//config: openssl is also a big binary, often dynamically linked
//config: against ~15 libraries.
//config:
@ -355,25 +349,6 @@ static void set_alarm(void)
# define clear_alarm() ((void)0)
#endif
/*
* is_ip_address() attempts to verify whether or not a string
* contains an IPv4 or IPv6 address (vs. an FQDN). The result
* of inet_pton() can be used to determine this.
*
* TODO add proper error checking when inet_pton() returns -1
* (some form of system error has occurred, and errno is set)
*/
static int is_ip_address(const char *string)
{
struct sockaddr_in sa;
int result = inet_pton(AF_INET, string, &(sa.sin_addr));
if (ENABLE_FEATURE_IPV6 && result == 0) {
result = inet_pton(AF_INET6, string, &(sa.sin_addr));
}
return (result != 0);
}
static FILE *open_socket(len_and_sockaddr *lsa)
{
int fd;
@ -654,8 +629,6 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_
static int spawn_https_helper_openssl(const char *host, unsigned port)
{
char *allocated = NULL;
char *servername;
char *colon_ptr;
int sp[2];
int pid;
IF_FEATURE_WGET_SSL_HELPER(volatile int child_failed = 0;)
@ -664,39 +637,15 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
/* Kernel can have AF_UNIX support disabled */
bb_perror_msg_and_die("socketpair");
/*
* Per RFC 6066 Section 3, the only permitted values in the
* TLS server_name (SNI) field are FQDNs (DNS hostnames).
* IPv4 nor IPv6 addresses are supported, nor is use of an
* alternate port number.
*
* The host argument to spawn_https_helper_openssl() can
* contain things like: test.com, test.com:8080, 1.2.3.4, or
* 1.2.3.4:8888. The strchr() check determines if the user
* passed something like test.com:8080 or 1.2.3.4:8888.
*
* The rest of the code ensures that servername only gets
* set to the hostname portion, and that the -servername
* argument to openssl s_client is only used if the hostname
* itself is an actual FQDN, not an IPv4/IPv6 address.
*/
if (!strchr(host, ':'))
host = allocated = xasprintf("%s:%u", host, port);
servername = xstrdup(host);
colon_ptr = strrchr(servername, ':');
*colon_ptr = '\0';
if (is_ip_address(servername))
servername = NULL;
fflush_all();
pid = xvfork();
if (pid == 0) {
/* Child */
char *argv[8];
char *argv[6];
memset(&argv, 0, sizeof(argv));
close(sp[0]);
xmove_fd(sp[1], 0);
xdup2(0, 1);
@ -712,12 +661,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
argv[2] = (char*)"-quiet";
argv[3] = (char*)"-connect";
argv[4] = (char*)host;
if (servername) {
argv[5] = (char*)"-servername";
argv[6] = (char*)servername;
}
argv[5] = NULL;
BB_EXECVP(argv[0], argv);
xmove_fd(3, 2);
# if ENABLE_FEATURE_WGET_SSL_HELPER
@ -731,7 +675,6 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
/* Parent */
free(allocated);
free(servername);
close(sp[1]);
# if ENABLE_FEATURE_WGET_SSL_HELPER
if (child_failed) {

@ -117,11 +117,11 @@
#define TAG_SELECTED_BG COLOR_BLUE
#define TAG_SELECTED_HL TRUE
#define TAG_KEY_FG COLOR_RED
#define TAG_KEY_FG COLOR_YELLOW
#define TAG_KEY_BG COLOR_WHITE
#define TAG_KEY_HL TRUE
#define TAG_KEY_SELECTED_FG COLOR_GREEN
#define TAG_KEY_SELECTED_FG COLOR_YELLOW
#define TAG_KEY_SELECTED_BG COLOR_BLUE
#define TAG_KEY_SELECTED_HL TRUE

@ -146,7 +146,7 @@ static void klogd_close(void)
#endif
char log_buffer[6 * 1024 + 1]; /* Big enough to not lose msgs at bootup */
#define log_buffer bb_common_bufsiz1
enum {
KLOGD_LOGBUF_SIZE = COMMON_BUFSIZE,
OPT_LEVEL = (1 << 0),
@ -173,7 +173,6 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
char *opt_c;
int opt;
int used;
unsigned int cnt;
setup_common_bufsiz();
@ -234,12 +233,10 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
write_pidfile(CONFIG_PID_FILE_PATH "/klogd.pid");
used = 0;
cnt = 0;
while (!bb_got_signal) {
int n;
int priority;
char *start;
char *eor;
/* "2 -- Read from the log." */
start = log_buffer + used;
@ -251,7 +248,6 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
break;
}
start[n] = '\0';
eor = &start[n];
/* Process each newline-terminated line in the buffer */
start = log_buffer;
@ -285,13 +281,8 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
start++;
}
/* Log (only non-empty lines) */
if (*start) {
if (*start)
syslog(priority, "%s", start);
/* give syslog time to catch up */
++cnt;
if ((cnt & 0x07) == 0 && (cnt < 300 || (eor - start) > 200))
usleep(50 * 1000);
}
if (!newline)
break;

@ -22,7 +22,7 @@ int blkid_main(int argc UNUSED_PARAM, char **argv)
while (*++argv) {
/* Note: bogus device names don't cause any error messages */
add_to_uuid_cache(*argv, 0);
add_to_uuid_cache(*argv);
scan_devices = 0;
}

@ -423,8 +423,8 @@ static sector_t bb_BLKGETSIZE_sectors(int fd)
unsigned long longsectors;
if (ioctl(fd, BLKGETSIZE64, &v64) == 0) {
/* Got bytes, convert to sectors */
v64 /= sector_size;
/* Got bytes, convert to 512 byte sectors */
v64 >>= 9;
if (v64 != (sector_t)v64) {
ret_trunc:
/* Not only DOS, but all other partition tables
@ -1939,7 +1939,7 @@ check_consistency(const struct partition *p, int partition)
static void
list_disk_geometry(void)
{
ullong bytes = ((ullong)total_number_of_sectors * sector_size);
ullong bytes = ((ullong)total_number_of_sectors << 9);
long megabytes = bytes / 1000000;
if (megabytes < 10000)
@ -1952,7 +1952,7 @@ list_disk_geometry(void)
g_heads, g_sectors, g_cylinders);
if (units_per_sector == 1)
printf(", total %"SECT_FMT"u sectors",
total_number_of_sectors);
total_number_of_sectors / (sector_size/512));
printf("\nUnits = %s of %u * %u = %u bytes\n\n",
str_units(PLURAL),
units_per_sector, sector_size, units_per_sector * sector_size);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save