summaryrefslogtreecommitdiff
path: root/busybox/networking
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2005-07-18 23:51:27 +0000
committerEric Andersen <andersen@codepoet.org>2005-07-18 23:51:27 +0000
commit164a716f964bba247c660bc70149234f95146871 (patch)
tree95a8a6f75cb2ed1bb07cb6019088db7348ebf4d4 /busybox/networking
parent8c59a0bf0e9e2d87b0ff273ea3f0bf05bbbf6373 (diff)
downloadbusybox-w32-164a716f964bba247c660bc70149234f95146871.tar.gz
busybox-w32-164a716f964bba247c660bc70149234f95146871.tar.bz2
busybox-w32-164a716f964bba247c660bc70149234f95146871.zip
busybox-1.0.1-rc1.patch
http://busybox.net/lists/busybox/2005-July/014974.html
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 83ded5330..94fcfc8c1 100644
--- a/busybox/networking/httpd.c
+++ b/busybox/networking/httpd.c
@@ -734,7 +734,7 @@ static char *encodeString(const char *string)
734 while ((ch = *string++)) { 734 while ((ch = *string++)) {
735 // very simple check for what to encode 735 // very simple check for what to encode
736 if (isalnum(ch)) *p++ = ch; 736 if (isalnum(ch)) *p++ = ch;
737 else p += sprintf(p, "&#%d", (unsigned char) ch); 737 else p += sprintf(p, "&#%d;", (unsigned char) ch);
738 } 738 }
739 *p=0; 739 *p=0;
740 return out; 740 return out;
diff --git a/busybox/networking/ifconfig.c b/busybox/networking/ifconfig.c
index 4e3df2982..fc7798f2d 100644
--- a/busybox/networking/ifconfig.c
+++ b/busybox/networking/ifconfig.c
@@ -46,8 +46,8 @@
46#include <netpacket/packet.h> 46#include <netpacket/packet.h>
47#include <net/ethernet.h> 47#include <net/ethernet.h>
48#else 48#else
49#include <asm/types.h> 49#include <sys/types.h>
50#include <linux/if_ether.h> 50#include <netinet/if_ether.h>
51#endif 51#endif
52#include "inet_common.h" 52#include "inet_common.h"
53#include "busybox.h" 53#include "busybox.h"
@@ -177,7 +177,7 @@ struct in6_ifreq {
177 177
178struct arg1opt { 178struct arg1opt {
179 const char *name; 179 const char *name;
180 unsigned short selector; 180 int selector;
181 unsigned short ifr_offset; 181 unsigned short ifr_offset;
182}; 182};
183 183
diff --git a/busybox/networking/ifupdown.c b/busybox/networking/ifupdown.c
index 1842be58b..21afe42d4 100644
--- a/busybox/networking/ifupdown.c
+++ b/busybox/networking/ifupdown.c
@@ -150,7 +150,7 @@ struct interfaces_file_t
150 150
151static char no_act = 0; 151static char no_act = 0;
152static char verbose = 0; 152static char verbose = 0;
153static char **environ = NULL; 153static char **__myenviron = NULL;
154 154
155#ifdef CONFIG_FEATURE_IFUPDOWN_IP 155#ifdef CONFIG_FEATURE_IFUPDOWN_IP
156 156
@@ -961,16 +961,16 @@ static void set_environ(struct interface_defn_t *iface, char *mode)
961 const int n_env_entries = iface->n_options + 5; 961 const int n_env_entries = iface->n_options + 5;
962 char **ppch; 962 char **ppch;
963 963
964 if (environ != NULL) { 964 if (__myenviron != NULL) {
965 for (ppch = environ; *ppch; ppch++) { 965 for (ppch = __myenviron; *ppch; ppch++) {
966 free(*ppch); 966 free(*ppch);
967 *ppch = NULL; 967 *ppch = NULL;
968 } 968 }
969 free(environ); 969 free(__myenviron);
970 environ = NULL; 970 __myenviron = NULL;
971 } 971 }
972 environ = xmalloc(sizeof(char *) * (n_env_entries + 1 /* for final NULL */ )); 972 __myenviron = xmalloc(sizeof(char *) * (n_env_entries + 1 /* for final NULL */ ));
973 environend = environ; 973 environend = __myenviron;
974 *environend = NULL; 974 *environend = NULL;
975 975
976 for (i = 0; i < iface->n_options; i++) { 976 for (i = 0; i < iface->n_options; i++) {
@@ -1010,7 +1010,7 @@ static int doit(char *str)
1010 case -1: /* failure */ 1010 case -1: /* failure */
1011 return 0; 1011 return 0;
1012 case 0: /* child */ 1012 case 0: /* child */
1013 execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, NULL, environ); 1013 execle(DEFAULT_SHELL, DEFAULT_SHELL, "-c", str, NULL, __myenviron);
1014 exit(127); 1014 exit(127);
1015 } 1015 }
1016 waitpid(child, &status, 0); 1016 waitpid(child, &status, 0);
diff --git a/busybox/networking/inetd.c b/busybox/networking/inetd.c
index 169cc8716..a1fa29ce4 100644
--- a/busybox/networking/inetd.c
+++ b/busybox/networking/inetd.c
@@ -560,7 +560,7 @@ static void config(int signum)
560 if (sep != 0) { 560 if (sep != 0) {
561 int i; 561 int i;
562 562
563#define SWAP(type, a, b) {type c=(type)a; (type)a=(type)b; (type)b=(type)c;} 563#define SWAP(type, a, b) {type c=(type)(a); (a)=(type)(b); (b)=(type)c;}
564 564
565 sigprocmask(SIG_BLOCK, &emptymask, &oldmask); 565 sigprocmask(SIG_BLOCK, &emptymask, &oldmask);
566 /* 566 /*
diff --git a/busybox/networking/libiproute/utils.c b/busybox/networking/libiproute/utils.c
index fa1548609..d86d4f8f5 100644
--- a/busybox/networking/libiproute/utils.c
+++ b/busybox/networking/libiproute/utils.c
@@ -238,7 +238,7 @@ __u32 get_addr32(char *name)
238 return addr.data[0]; 238 return addr.data[0];
239} 239}
240 240
241void incomplete_command() 241void incomplete_command(void)
242{ 242{
243 bb_error_msg("Command line is not complete. Try option \"help\""); 243 bb_error_msg("Command line is not complete. Try option \"help\"");
244 exit(-1); 244 exit(-1);
diff --git a/busybox/networking/nc.c b/busybox/networking/nc.c
index 3099763b1..ab8ec0cd5 100644
--- a/busybox/networking/nc.c
+++ b/busybox/networking/nc.c
@@ -79,7 +79,7 @@ int nc_main(int argc, char **argv)
79#ifdef GAPING_SECURITY_HOLE 79#ifdef GAPING_SECURITY_HOLE
80 if (pr00gie) { 80 if (pr00gie) {
81 /* won't need stdin */ 81 /* won't need stdin */
82 close (STDIN_FILENO); 82 close(STDIN_FILENO);
83 } 83 }
84#endif /* GAPING_SECURITY_HOLE */ 84#endif /* GAPING_SECURITY_HOLE */
85 85
@@ -90,8 +90,8 @@ int nc_main(int argc, char **argv)
90 if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) 90 if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
91 bb_perror_msg_and_die("socket"); 91 bb_perror_msg_and_die("socket");
92 x = 1; 92 x = 1;
93 if (setsockopt (sfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)) == -1) 93 if (setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof (x)) == -1)
94 bb_perror_msg_and_die ("reuseaddr failed"); 94 bb_perror_msg_and_die("reuseaddr");
95 address.sin_family = AF_INET; 95 address.sin_family = AF_INET;
96 96
97 if (lport != 0) { 97 if (lport != 0) {
@@ -154,7 +154,7 @@ int nc_main(int argc, char **argv)
154 for (fd = 0; fd < FD_SETSIZE; fd++) { 154 for (fd = 0; fd < FD_SETSIZE; fd++) {
155 if (FD_ISSET(fd, &testfds)) { 155 if (FD_ISSET(fd, &testfds)) {
156 if ((nread = safe_read(fd, buf, sizeof(buf))) < 0) 156 if ((nread = safe_read(fd, buf, sizeof(buf))) < 0)
157 bb_perror_msg_and_die("read"); 157 bb_perror_msg_and_die(bb_msg_read_error);
158 158
159 if (fd == sfd) { 159 if (fd == sfd) {
160 if (nread == 0) 160 if (nread == 0)
@@ -167,7 +167,7 @@ int nc_main(int argc, char **argv)
167 } 167 }
168 168
169 if (bb_full_write(ofd, buf, nread) < 0) 169 if (bb_full_write(ofd, buf, nread) < 0)
170 bb_perror_msg_and_die("write"); 170 bb_perror_msg_and_die(bb_msg_write_error);
171 if (delay > 0) { 171 if (delay > 0) {
172 sleep(delay); 172 sleep(delay);
173 } 173 }
diff --git a/busybox/networking/telnetd.c b/busybox/networking/telnetd.c
index 491c66fd1..b3d0a1166 100644
--- a/busybox/networking/telnetd.c
+++ b/busybox/networking/telnetd.c
@@ -49,6 +49,15 @@
49 49
50#define BUFSIZE 4000 50#define BUFSIZE 4000
51 51
52#ifdef CONFIG_FEATURE_IPV6
53#define SOCKET_TYPE AF_INET6
54typedef struct sockaddr_in6 sockaddr_type;
55#else
56#define SOCKET_TYPE AF_INET
57typedef struct sockaddr_in sockaddr_type;
58#endif
59
60
52#ifdef CONFIG_LOGIN 61#ifdef CONFIG_LOGIN
53static const char *loginpath = "/bin/login"; 62static const char *loginpath = "/bin/login";
54#else 63#else
@@ -373,7 +382,7 @@ int
373telnetd_main(int argc, char **argv) 382telnetd_main(int argc, char **argv)
374{ 383{
375#ifndef CONFIG_FEATURE_TELNETD_INETD 384#ifndef CONFIG_FEATURE_TELNETD_INETD
376 struct sockaddr_in sa; 385 sockaddr_type sa;
377 int master_fd; 386 int master_fd;
378#endif /* CONFIG_FEATURE_TELNETD_INETD */ 387#endif /* CONFIG_FEATURE_TELNETD_INETD */
379 fd_set rdfdset, wrfdset; 388 fd_set rdfdset, wrfdset;
@@ -431,7 +440,7 @@ telnetd_main(int argc, char **argv)
431 440
432 /* Grab a TCP socket. */ 441 /* Grab a TCP socket. */
433 442
434 master_fd = socket(AF_INET, SOCK_STREAM, 0); 443 master_fd = socket(SOCKET_TYPE, SOCK_STREAM, 0);
435 if (master_fd < 0) { 444 if (master_fd < 0) {
436 bb_perror_msg_and_die("socket"); 445 bb_perror_msg_and_die("socket");
437 } 446 }
@@ -440,8 +449,13 @@ telnetd_main(int argc, char **argv)
440 /* Set it to listen to specified port. */ 449 /* Set it to listen to specified port. */
441 450
442 memset((void *)&sa, 0, sizeof(sa)); 451 memset((void *)&sa, 0, sizeof(sa));
452#ifdef CONFIG_FEATURE_IPV6
453 sa.sin6_family = AF_INET6;
454 sa.sin6_port = htons(portnbr);
455#else
443 sa.sin_family = AF_INET; 456 sa.sin_family = AF_INET;
444 sa.sin_port = htons(portnbr); 457 sa.sin_port = htons(portnbr);
458#endif
445 459
446 if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { 460 if (bind(master_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
447 bb_perror_msg_and_die("bind"); 461 bb_perror_msg_and_die("bind");
diff --git a/busybox/networking/tftp.c b/busybox/networking/tftp.c
index 3c947318b..47fc3879e 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,
458 opcode = TFTP_ACK; 458 opcode = TFTP_ACK;
459 continue; 459 continue;
460 } 460 }
461 /* in case the last ack disappeared into the ether */
462 if ( tmp == (block_nr - 1) ) {
463 --block_nr;
464 opcode = TFTP_ACK;
465 continue;
466 }
461 } 467 }
462 468
463 if (cmd_put && (opcode == TFTP_ACK)) { 469 if (cmd_put && (opcode == TFTP_ACK)) {
diff --git a/busybox/networking/udhcp/dhcpc.c b/busybox/networking/udhcp/dhcpc.c
index 449b51763..91af9153b 100644
--- a/busybox/networking/udhcp/dhcpc.c
+++ b/busybox/networking/udhcp/dhcpc.c
@@ -419,6 +419,9 @@ int main(int argc, char *argv[])
419 (unsigned long) packet.xid, xid); 419 (unsigned long) packet.xid, xid);
420 continue; 420 continue;
421 } 421 }
422 /* Ignore packets that aren't for us */
423 if (memcmp(client_config.arp,packet.chaddr,6))
424 continue;
422 425
423 if ((message = get_option(&packet, DHCP_MESSAGE_TYPE)) == NULL) { 426 if ((message = get_option(&packet, DHCP_MESSAGE_TYPE)) == NULL) {
424 DEBUG(LOG_ERR, "couldnt get option from packet -- ignoring"); 427 DEBUG(LOG_ERR, "couldnt get option from packet -- ignoring");