summaryrefslogtreecommitdiff
path: root/busybox/networking
diff options
context:
space:
mode:
Diffstat (limited to 'busybox/networking')
-rw-r--r--busybox/networking/httpd.c2
-rw-r--r--busybox/networking/ifconfig.c6
-rw-r--r--busybox/networking/ifupdown.c16
-rw-r--r--busybox/networking/inetd.c2
-rw-r--r--busybox/networking/libiproute/utils.c2
-rw-r--r--busybox/networking/nc.c10
-rw-r--r--busybox/networking/telnetd.c18
-rw-r--r--busybox/networking/tftp.c6
-rw-r--r--busybox/networking/udhcp/dhcpc.c3
9 files changed, 44 insertions, 21 deletions
diff --git a/busybox/networking/httpd.c b/busybox/networking/httpd.c
index 83ded53..94fcfc8 100644
--- a/busybox/networking/httpd.c
+++ b/busybox/networking/httpd.c
@@ -734,7 +734,7 @@ static char *encodeString(const char *string)
while ((ch = *string++)) {
// very simple check for what to encode
if (isalnum(ch)) *p++ = ch;
- else p += sprintf(p, "&#%d", (unsigned char) ch);
+ else p += sprintf(p, "&#%d;", (unsigned char) ch);
}
*p=0;
return out;
diff --git a/busybox/networking/ifconfig.c b/busybox/networking/ifconfig.c
index 4e3df29..fc7798f 100644
--- a/busybox/networking/ifconfig.c
+++ b/busybox/networking/ifconfig.c
@@ -46,8 +46,8 @@
#include <netpacket/packet.h>
#include <net/ethernet.h>
#else
-#include <asm/types.h>
-#include <linux/if_ether.h>
+#include <sys/types.h>
+#include <netinet/if_ether.h>
#endif
#include "inet_common.h"
#include "busybox.h"
@@ -177,7 +177,7 @@ struct in6_ifreq {
struct arg1opt {
const char *name;
- unsigned short selector;
+ int selector;
unsigned short ifr_offset;
};
diff --git a/busybox/networking/ifupdown.c b/busybox/networking/ifupdown.c
index 1842be5..21afe42 100644
--- a/busybox/networking/ifupdown.c
+++ b/busybox/networking/ifupdown.c
@@ -150,7 +150,7 @@ struct interfaces_file_t
static char no_act = 0;
static char verbose = 0;
-static char **environ = NULL;
+static char **__myenviron = NULL;
#ifdef CONFIG_FEATURE_IFUPDOWN_IP
@@ -961,16 +961,16 @@ static void set_environ(struct interface_defn_t *iface, char *mode)
const int n_env_entries = iface->n_options + 5;
char **ppch;
- if (environ != NULL) {
- for (ppch = environ; *ppch; ppch++) {
+ if (__myenviron != NULL) {
+ for (ppch = __myenviron; *ppch; ppch++) {
free(*ppch);
*ppch = NULL;
}
- free(environ);
- environ = NULL;
+ free(__myenviron);
+ __myenviron = NULL;
}
- environ = xmalloc(sizeof(char *) * (n_env_entries + 1 /* for final NULL */ ));
- environend = environ;
+ __myenviron = xmalloc(sizeof(char *) * (n_env_entries + 1 /* for final NULL */ ));
+ environend = __myenviron;
*environend = NULL;
for (i = 0; i < iface->n_options; i++) {
@@ -1010,7 +1010,7 @@ static int doit(char *str)
case -1: /* failure */
return 0;
case 0: /* child */
- execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, NULL, environ);
+ execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, NULL, __myenviron);
exit(127);
}
waitpid(child, &status, 0);
diff --git a/busybox/networking/inetd.c b/busybox/networking/inetd.c
index 169cc87..a1fa29c 100644
--- a/busybox/networking/inetd.c
+++ b/busybox/networking/inetd.c
@@ -560,7 +560,7 @@ static void config(int signum)
if (sep != 0) {
int i;
-#define SWAP(type, a, b) {type c=(type)a; (type)a=(type)b; (type)b=(type)c;}
+#define SWAP(type, a, b) {type c=(type)(a); (a)=(type)(b); (b)=(type)c;}
sigprocmask(SIG_BLOCK, &emptymask, &oldmask);
/*
diff --git a/busybox/networking/libiproute/utils.c b/busybox/networking/libiproute/utils.c
index fa15486..d86d4f8 100644
--- a/busybox/networking/libiproute/utils.c
+++ b/busybox/networking/libiproute/utils.c
@@ -238,7 +238,7 @@ __u32 get_addr32(char *name)
return addr.data[0];
}
-void incomplete_command()
+void incomplete_command(void)
{
bb_error_msg("Command line is not complete. Try option \"help\"");
exit(-1);
diff --git a/busybox/networking/nc.c b/busybox/networking/nc.c
index 3099763..ab8ec0c 100644
--- a/busybox/networking/nc.c
+++ b/busybox/networking/nc.c
@@ -79,7 +79,7 @@ int nc_main(int argc, char **argv)
#ifdef GAPING_SECURITY_HOLE
if (pr00gie) {
/* won't need stdin */
- close (STDIN_FILENO);
+ close(STDIN_FILENO);
}
#endif /* GAPING_SECURITY_HOLE */
@@ -90,8 +90,8 @@ int nc_main(int argc, char **argv)
if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
bb_perror_msg_and_die("socket");
x = 1;
- if (setsockopt (sfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)) == -1)
- bb_perror_msg_and_die ("reuseaddr failed");
+ if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)) == -1)
+ bb_perror_msg_and_die("reuseaddr");
address.sin_family = AF_INET;
if (lport != 0) {
@@ -154,7 +154,7 @@ int nc_main(int argc, char **argv)
for (fd = 0; fd < FD_SETSIZE; fd++) {
if (FD_ISSET(fd, &testfds)) {
if ((nread = safe_read(fd, buf, sizeof(buf))) < 0)
- bb_perror_msg_and_die("read");
+ bb_perror_msg_and_die(bb_msg_read_error);
if (fd == sfd) {
if (nread == 0)
@@ -167,7 +167,7 @@ int nc_main(int argc, char **argv)
}
if (bb_full_write(ofd, buf, nread) < 0)
- bb_perror_msg_and_die("write");
+ bb_perror_msg_and_die(bb_msg_write_error);
if (delay > 0) {
sleep(delay);
}
diff --git a/busybox/networking/telnetd.c b/busybox/networking/telnetd.c
index 491c66f..b3d0a11 100644
--- a/busybox/networking/telnetd.c
+++ b/busybox/networking/telnetd.c
@@ -49,6 +49,15 @@
#define BUFSIZE 4000
+#ifdef CONFIG_FEATURE_IPV6
+#define SOCKET_TYPE AF_INET6
+typedef struct sockaddr_in6 sockaddr_type;
+#else
+#define SOCKET_TYPE AF_INET
+typedef struct sockaddr_in sockaddr_type;
+#endif
+
+
#ifdef CONFIG_LOGIN
static const char *loginpath = "/bin/login";
#else
@@ -373,7 +382,7 @@ int
telnetd_main(int argc, char **argv)
{
#ifndef CONFIG_FEATURE_TELNETD_INETD
- struct sockaddr_in sa;
+ sockaddr_type sa;
int master_fd;
#endif /* CONFIG_FEATURE_TELNETD_INETD */
fd_set rdfdset, wrfdset;
@@ -431,7 +440,7 @@ telnetd_main(int argc, char **argv)
/* Grab a TCP socket. */
- master_fd = socket(AF_INET, SOCK_STREAM, 0);
+ master_fd = socket(SOCKET_TYPE, SOCK_STREAM, 0);
if (master_fd < 0) {
bb_perror_msg_and_die("socket");
}
@@ -440,8 +449,13 @@ telnetd_main(int argc, char **argv)
/* Set it to listen to specified port. */
memset((void *)&sa, 0, sizeof(sa));
+#ifdef CONFIG_FEATURE_IPV6
+ sa.sin6_family = AF_INET6;
+ sa.sin6_port = htons(portnbr);
+#else
sa.sin_family = AF_INET;
sa.sin_port = htons(portnbr);
+#endif
if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
bb_perror_msg_and_die("bind");
diff --git a/busybox/networking/tftp.c b/busybox/networking/tftp.c
index 3c94731..47fc387 100644
--- a/busybox/networking/tftp.c
+++ b/busybox/networking/tftp.c
@@ -458,6 +458,12 @@ static inline int tftp(const int cmd, const struct hostent *host,
opcode = TFTP_ACK;
continue;
}
+ /* in case the last ack disappeared into the ether */
+ if ( tmp == (block_nr - 1) ) {
+ --block_nr;
+ opcode = TFTP_ACK;
+ continue;
+ }
}
if (cmd_put && (opcode == TFTP_ACK)) {
diff --git a/busybox/networking/udhcp/dhcpc.c b/busybox/networking/udhcp/dhcpc.c
index 449b517..91af915 100644
--- a/busybox/networking/udhcp/dhcpc.c
+++ b/busybox/networking/udhcp/dhcpc.c
@@ -419,6 +419,9 @@ int main(int argc, char *argv[])
(unsigned long) packet.xid, xid);
continue;
}
+ /* Ignore packets that aren't for us */
+ if (memcmp(client_config.arp,packet.chaddr,6))
+ continue;
if ((message = get_option(&packet, DHCP_MESSAGE_TYPE)) == NULL) {
DEBUG(LOG_ERR, "couldnt get option from packet -- ignoring");