aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/Kbuild2
-rw-r--r--networking/ether-wake.c2
-rw-r--r--networking/httpd.c13
-rw-r--r--networking/ifupdown.c22
-rw-r--r--networking/inetd.c22
-rw-r--r--networking/nc.c2
-rw-r--r--networking/sendmail.c4
-rw-r--r--networking/telnetd.c4
-rw-r--r--networking/traceroute.c4
-rw-r--r--networking/udhcp/clientsocket.c2
-rw-r--r--networking/wget.c2
11 files changed, 57 insertions, 22 deletions
diff --git a/networking/Kbuild b/networking/Kbuild
index e06a12462..44258e9b0 100644
--- a/networking/Kbuild
+++ b/networking/Kbuild
@@ -17,7 +17,7 @@ lib-$(CONFIG_FTPPUT) += ftpgetput.o
lib-$(CONFIG_HOSTNAME) += hostname.o
lib-$(CONFIG_HTTPD) += httpd.o
lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o
-lib-$(CONFIG_IFENSLAVE) += ifenslave.o
+lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o
lib-$(CONFIG_IFUPDOWN) += ifupdown.o
lib-$(CONFIG_INETD) += inetd.o
lib-$(CONFIG_IP) += ip.o
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index b752152e1..fcd7dd2bc 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -179,7 +179,7 @@ static int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd)
}
int ether_wake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int ether_wake_main(int argc, char **argv)
+int ether_wake_main(int argc ATTRIBUTE_UNUSED, char **argv)
{
const char *ifname = "eth0";
char *pass;
diff --git a/networking/httpd.c b/networking/httpd.c
index 54f288c7a..522e7eec0 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1972,7 +1972,11 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
/* Try and do our best to parse more lines */
if ((STRNCASECMP(iobuf, "Content-length:") == 0)) {
/* extra read only for POST */
- if (prequest != request_GET && prequest != request_HEAD) {
+ if (prequest != request_GET
+#if ENABLE_FEATURE_HTTPD_CGI
+ && prequest != request_HEAD
+#endif
+ ) {
tptr = iobuf + sizeof("Content-length:") - 1;
if (!tptr[0])
send_headers_and_exit(HTTP_BAD_REQUEST);
@@ -2129,7 +2133,12 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
*/
send_file_and_exit(tptr,
- (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS));
+#if ENABLE_FEATURE_HTTPD_CGI
+ (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS)
+#else
+ SEND_HEADERS_AND_BODY
+#endif
+ );
}
/*
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 6aa929a30..586c3db63 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -483,9 +483,9 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
};
#endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */
+#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
{
-#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
int i;
#if ENABLE_FEATURE_IFUPDOWN_IP
/* ip doesn't up iface when it configures it (unlike ifconfig) */
@@ -498,7 +498,10 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
}
bb_error_msg("no dhcp clients found");
return 0;
+}
#elif ENABLE_APP_UDHCPC
+static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
+{
#if ENABLE_FEATURE_IFUPDOWN_IP
/* ip doesn't up iface when it configures it (unlike ifconfig) */
if (!execute("ip link set %iface% up", ifd, exec))
@@ -507,14 +510,18 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
"-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
ifd, exec);
+}
#else
+static int dhcp_up(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
+ execfn *exec ATTRIBUTE_UNUSED)
+{
return 0; /* no dhcp support */
-#endif
}
+#endif
+#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
{
-#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
int i;
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
if (exists_execable(ext_dhcp_clients[i].name))
@@ -522,13 +529,20 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
}
bb_error_msg("no dhcp clients found, using static interface shutdown");
return static_down(ifd, exec);
+}
#elif ENABLE_APP_UDHCPC
+static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
+{
return execute("kill "
"`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+}
#else
+static int dhcp_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
+ execfn *exec ATTRIBUTE_UNUSED)
+{
return 0; /* no dhcp support */
-#endif
}
+#endif
static int manual_up_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED, execfn *exec ATTRIBUTE_UNUSED)
{
diff --git a/networking/inetd.c b/networking/inetd.c
index 0ddfa6b45..b931aa1e0 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1331,10 +1331,10 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
continue; /* -> check next fd in fd set */
}
- /* we are either child or didn't fork at all */
+ /* we are either child or didn't vfork at all */
#ifdef INETD_BUILTINS_ENABLED
if (sep->se_builtin) {
- if (pid) { /* "pid" is -1: we did fork */
+ if (pid) { /* "pid" is -1: we did vfork */
close(sep->se_fd); /* listening socket */
logmode = 0; /* make xwrite etc silent */
}
@@ -1343,8 +1343,8 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
sep->se_builtin->bi_stream_fn(ctrl, sep);
else
sep->se_builtin->bi_dgram_fn(ctrl, sep);
- if (pid) /* we did fork */
- _exit(0);
+ if (pid) /* we did vfork */
+ _exit(1);
maybe_close(accepted_fd);
continue; /* -> check next fd in fd set */
}
@@ -1430,11 +1430,15 @@ static void echo_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
xwrite(s, line, sz);
}
#else
+ /* We are after vfork here! */
static const char *const args[] = { "cat", NULL };
- /* no error messages */
+ /* move network socket to stdin */
+ xmove_fd(s, STDIN_FILENO);
+ xdup2(STDIN_FILENO, STDOUT_FILENO);
+ /* no error messages please... */
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
BB_EXECVP("cat", (char**)args);
- _exit(1);
+ /* on failure we return to main, which does exit(1) */
#endif
}
static void echo_dg(int s, servtab_t *sep)
@@ -1463,11 +1467,15 @@ static void discard_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
while (safe_read(s, line, LINE_SIZE) > 0)
continue;
#else
+ /* We are after vfork here! */
static const char *const args[] = { "dd", "of=/dev/null", NULL };
+ /* move network socket to stdin */
+ xmove_fd(s, STDIN_FILENO);
+ xdup2(STDIN_FILENO, STDOUT_FILENO);
/* no error messages */
xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
BB_EXECVP("dd", (char**)args);
- _exit(1);
+ /* on failure we return to main, which does exit(1) */
#endif
}
/* ARGSUSED */
diff --git a/networking/nc.c b/networking/nc.c
index 7c2aafaf6..7d4a6e047 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -17,7 +17,7 @@
* when compared to "standard" nc
*/
-static void timeout(int signum)
+static void timeout(int signum ATTRIBUTE_UNUSED)
{
bb_error_msg_and_die("timed out");
}
diff --git a/networking/sendmail.c b/networking/sendmail.c
index 241028b92..2eb01dc94 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -551,11 +551,11 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
int rc;
// retrieve message in ./tmp/
- pop3_check(retr, (const char *)nmsg);
+ pop3_check(retr, (const char *)(ptrdiff_t)nmsg);
pop3_message(filename);
// delete message from server
if (opts & OPTF_z)
- pop3_check("DELE %u", (const char*)nmsg);
+ pop3_check("DELE %u", (const char*)(ptrdiff_t)nmsg);
// run postprocessing program
if (*fargs) {
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 20c57925f..2ed3b74bc 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -161,14 +161,14 @@ make_new_session(
const char *login_argv[2];
struct termios termbuf;
int fd, pid;
- char tty_name[32];
+ char tty_name[GETPTY_BUFSIZE];
struct tsession *ts = xzalloc(sizeof(struct tsession) + BUFSIZE * 2);
/*ts->buf1 = (char *)(ts + 1);*/
/*ts->buf2 = ts->buf1 + BUFSIZE;*/
/* Got a new connection, set up a tty. */
- fd = getpty(tty_name, 32);
+ fd = getpty(tty_name);
if (fd < 0) {
bb_error_msg("can't create pty");
return NULL;
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 582840af6..c0b4a3fd2 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -729,6 +729,10 @@ pr_type(unsigned char t)
}
#endif
+#if !ENABLE_FEATURE_TRACEROUTE_VERBOSE
+#define packet_ok(buf, cc, from, seq) \
+ packet_ok(buf, cc, seq)
+#endif
static int
packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
{
diff --git a/networking/udhcp/clientsocket.c b/networking/udhcp/clientsocket.c
index b5534f83e..0be661d4f 100644
--- a/networking/udhcp/clientsocket.c
+++ b/networking/udhcp/clientsocket.c
@@ -76,7 +76,7 @@ int raw_socket(int ifindex)
BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0),
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, SERVER_AND_CLIENT_PORTS, 0, 1), /* L3, L4 */
/* returns */
- BPF_STMT(BPF_RET|BPF_K, ~0UL), /* L3: pass */
+ BPF_STMT(BPF_RET|BPF_K, (~(uint32_t)0) ), /* L3: pass */
BPF_STMT(BPF_RET|BPF_K, 0), /* L4: reject */
};
static const struct sock_fprog filter_prog = {
diff --git a/networking/wget.c b/networking/wget.c
index dc1dc2ad9..f8adcd700 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -189,7 +189,7 @@ static void progressmeter(int flag)
*/
#else /* FEATURE_WGET_STATUSBAR */
-static ALWAYS_INLINE void progressmeter(int flag) { }
+static ALWAYS_INLINE void progressmeter(int flag ATTRIBUTE_UNUSED) { }
#endif