aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/ntpd.c20
-rw-r--r--networking/tcpudp.c2
-rw-r--r--networking/traceroute.c2
3 files changed, 16 insertions, 8 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 12e498d48..e2c3506ed 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -7,7 +7,9 @@
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9#include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */ 9#include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */
10 10#ifndef IPTOS_LOWDELAY
11# define IPTOS_LOWDELAY 0x10
12#endif
11#ifndef IP_PKTINFO 13#ifndef IP_PKTINFO
12# error "Sorry, your kernel has to support IP_PKTINFO" 14# error "Sorry, your kernel has to support IP_PKTINFO"
13#endif 15#endif
@@ -161,10 +163,11 @@ enum {
161 OPT_n = (1 << 0), 163 OPT_n = (1 << 0),
162 OPT_g = (1 << 1), 164 OPT_g = (1 << 1),
163 OPT_q = (1 << 2), 165 OPT_q = (1 << 2),
166 OPT_N = (1 << 3),
164 /* Insert new options above this line. */ 167 /* Insert new options above this line. */
165 /* Non-compat options: */ 168 /* Non-compat options: */
166 OPT_p = (1 << 3), 169 OPT_p = (1 << 4),
167 OPT_l = (1 << 4), 170 OPT_l = (1 << 5) * ENABLE_FEATURE_NTPD_SERVER,
168}; 171};
169 172
170 173
@@ -877,16 +880,18 @@ static NOINLINE void ntp_init(char **argv)
877 /* tzset(); - why? it's called automatically when needed, no? */ 880 /* tzset(); - why? it's called automatically when needed, no? */
878 881
879 if (getuid()) 882 if (getuid())
880 bb_error_msg_and_die("need root privileges"); 883 bb_error_msg_and_die(bb_msg_you_must_be_root);
881 884
882 peers = NULL; 885 peers = NULL;
883 opt_complementary = "dd:p::"; /* d: counter, p: list */ 886 opt_complementary = "dd:p::"; /* d: counter, p: list */
884 opts = getopt32(argv, 887 opts = getopt32(argv,
885 "ngq" /* compat */ 888 "ngqN" /* compat */
886 "p:"IF_FEATURE_NTPD_SERVER("l") /* NOT compat */ 889 "p:"IF_FEATURE_NTPD_SERVER("l") /* NOT compat */
887 "d" /* compat */ 890 "d" /* compat */
888 "46aAbLNx", /* compat, ignored */ 891 "46aAbLx", /* compat, ignored */
889 &peers, &G.verbose); 892 &peers, &G.verbose);
893 if (!(opts & (OPT_p|OPT_l)))
894 bb_show_usage();
890#if ENABLE_FEATURE_NTPD_SERVER 895#if ENABLE_FEATURE_NTPD_SERVER
891 G.listen_fd = -1; 896 G.listen_fd = -1;
892 if (opts & OPT_l) { 897 if (opts & OPT_l) {
@@ -903,6 +908,9 @@ static NOINLINE void ntp_init(char **argv)
903 logmode = LOGMODE_NONE; 908 logmode = LOGMODE_NONE;
904 bb_daemonize(DAEMON_DEVNULL_STDIO); 909 bb_daemonize(DAEMON_DEVNULL_STDIO);
905 } 910 }
911 /* I hesitate to set -20 prio. -15 should be high enough for timekeeping */
912 if (opts & OPT_N)
913 setpriority(PRIO_PROCESS, 0, -15);
906 914
907 /* Set some globals */ 915 /* Set some globals */
908 { 916 {
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index 25b3319ec..d0db33b79 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -239,7 +239,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
239 client = 0; 239 client = 0;
240 if ((getuid() == 0) && !(opts & OPT_u)) { 240 if ((getuid() == 0) && !(opts & OPT_u)) {
241 xfunc_exitcode = 100; 241 xfunc_exitcode = 100;
242 bb_error_msg_and_die("-U ssluser must be set when running as root"); 242 bb_error_msg_and_die(bb_msg_you_must_be_root);
243 } 243 }
244 if (opts & OPT_u) 244 if (opts & OPT_u)
245 if (!uidgid_get(&sslugid, ssluser, 1)) { 245 if (!uidgid_get(&sslugid, ssluser, 1)) {
diff --git a/networking/traceroute.c b/networking/traceroute.c
index e9f3cc6c9..110bdfa76 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -835,7 +835,7 @@ common_traceroute_main(int op, char **argv)
835 * probe (e.g., on a multi-homed host). 835 * probe (e.g., on a multi-homed host).
836 */ 836 */
837 if (getuid() != 0) 837 if (getuid() != 0)
838 bb_error_msg_and_die("you must be root to use -s"); 838 bb_error_msg_and_die(bb_msg_you_must_be_root);
839 } 839 }
840 if (op & OPT_WAITTIME) 840 if (op & OPT_WAITTIME)
841 waittime = xatou_range(waittime_str, 1, 24 * 60 * 60); 841 waittime = xatou_range(waittime_str, 1, 24 * 60 * 60);