From 253c4e787a799a3e1f92957ed791b5222f8d2f64 Mon Sep 17 00:00:00 2001 From: James Byrne Date: Fri, 12 Apr 2019 17:01:51 +0000 Subject: Optionally re-introduce bb_info_msg() Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was eliminated and calls to it changed to be bb_error_msg(). The downside of this is that daemons now log all messages to syslog at the LOG_ERR level which makes it hard to filter errors from informational messages. This change optionally re-introduces bb_info_msg(), controlled by a new option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that were removed (only in applets that set logmode to LOGMODE_SYSLOG or LOGMODE_BOTH), and also changes informational messages in ifplugd and ntpd. The code size change of this is as follows (using 'defconfig' on x86_64 with gcc 7.3.0-27ubuntu1~18.04) function old new delta bb_info_msg - 182 +182 bb_vinfo_msg - 27 +27 static.log7 194 198 +4 log8 190 191 +1 log5 190 191 +1 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes If you don't care about everything being logged at LOG_ERR level then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller: function old new delta static.log7 194 200 +6 log8 190 193 +3 log5 190 193 +3 syslog_level 1 - -1 bb_verror_msg 583 581 -2 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes Signed-off-by: James Byrne Signed-off-by: Denys Vlasenko --- networking/udhcp/common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'networking/udhcp/common.h') diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index 9d1f71aae..a897837f9 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h @@ -274,16 +274,16 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code) #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 # define IF_UDHCP_VERBOSE(...) __VA_ARGS__ extern unsigned dhcp_verbose; -# define log1(...) do { if (dhcp_verbose >= 1) bb_error_msg(__VA_ARGS__); } while (0) +# define log1(...) do { if (dhcp_verbose >= 1) bb_info_msg(__VA_ARGS__); } while (0) # if CONFIG_UDHCP_DEBUG >= 2 void udhcp_dump_packet(struct dhcp_packet *packet) FAST_FUNC; -# define log2(...) do { if (dhcp_verbose >= 2) bb_error_msg(__VA_ARGS__); } while (0) +# define log2(...) do { if (dhcp_verbose >= 2) bb_info_msg(__VA_ARGS__); } while (0) # else # define udhcp_dump_packet(...) ((void)0) # define log2(...) ((void)0) # endif # if CONFIG_UDHCP_DEBUG >= 3 -# define log3(...) do { if (dhcp_verbose >= 3) bb_error_msg(__VA_ARGS__); } while (0) +# define log3(...) do { if (dhcp_verbose >= 3) bb_info_msg(__VA_ARGS__); } while (0) # else # define log3(...) ((void)0) # endif -- cgit v1.2.3-55-g6feb From 1115e40c887fc4d9ddddbe2b0d71c091065ee997 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 23 May 2019 15:24:03 +0200 Subject: dhcp: tweak comments, no code changes Signed-off-by: Denys Vlasenko --- networking/udhcp/common.h | 52 ++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) (limited to 'networking/udhcp/common.h') diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index a897837f9..bba3d6037 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h @@ -40,7 +40,7 @@ struct dhcp_packet { uint32_t yiaddr; /* 'your' (client) IP address */ /* IP address of next server to use in bootstrap, returned in DHCPOFFER, DHCPACK by server */ uint32_t siaddr_nip; - uint32_t gateway_nip; /* relay agent IP address */ + uint32_t gateway_nip; /* aka 'giaddr': relay agent IP address */ uint8_t chaddr[16]; /* link-layer client hardware address (MAC) */ uint8_t sname[64]; /* server host name (ASCIZ) */ uint8_t file[128]; /* boot file name (ASCIZ) */ @@ -222,10 +222,9 @@ uint8_t *dname_enc(const uint8_t *cstr, int clen, const char *src, int *retlen) #endif struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code) FAST_FUNC; - // RFC 2131 Table 5: Fields and options used by DHCP clients // -// Fields 'hops', 'yiaddr', 'siaddr', 'giaddr' are always zero +// Fields 'hops', 'yiaddr', 'siaddr', 'giaddr' are always zero, 'chaddr' is always client's MAC // // Field DHCPDISCOVER DHCPINFORM DHCPREQUEST DHCPDECLINE DHCPRELEASE // ----- ------------ ------------ ----------- ----------- ----------- @@ -234,40 +233,33 @@ struct option_set *udhcp_find_option(struct option_set *opt_list, uint8_t code) // 'secs' 0 or seconds since 0 or seconds since 0 or seconds since 0 0 // DHCP process started DHCP process started DHCP process started // 'flags' Set 'BROADCAST' Set 'BROADCAST' Set 'BROADCAST' 0 0 -// flag if client flag if client flag if client -// requires broadcast requires broadcast requires broadcast -// reply reply reply +// flag if client needs flag if client needs flag if client needs +// broadcast reply broadcast reply broadcast reply // 'ciaddr' 0 client's IP 0 or client's IP 0 client's IP // (BOUND/RENEW/REBIND) -// 'chaddr' client's MAC client's MAC client's MAC client's MAC client's MAC // 'sname' options or sname options or sname options or sname (unused) (unused) // 'file' options or file options or file options or file (unused) (unused) // 'options' options options options message type opt message type opt // -// Option DHCPDISCOVER DHCPINFORM DHCPREQUEST DHCPDECLINE DHCPRELEASE -// ------ ------------ ---------- ----------- ----------- ----------- -// Requested IP address MAY MUST NOT MUST (in MUST MUST NOT -// SELECTING or -// INIT-REBOOT) -// MUST NOT (in -// BOUND or -// RENEWING) -// IP address lease time MAY MUST NOT MAY MUST NOT MUST NOT -// Use 'file'/'sname' fields MAY MAY MAY MAY MAY -// Client identifier MAY MAY MAY MAY MAY -// Vendor class identifier MAY MAY MAY MUST NOT MUST NOT -// Server identifier MUST NOT MUST NOT MUST (after MUST MUST -// SELECTING) +// Option DHCPDISCOVER DHCPINFORM DHCPREQUEST DHCPDECLINE DHCPRELEASE +// ------ ------------ ---------- ----------- ----------- ----------- +// Requested IP address MAY MUST NOT MUST (in SELECTING MUST MUST NOT +// or INIT-REBOOT) +// MUST NOT (in BOUND +// or RENEWING) +// IP address lease time MAY MUST NOT MAY MUST NOT MUST NOT +// Use 'file'/'sname' fields MAY MAY MAY MAY MAY +// Client identifier MAY MAY MAY MAY MAY +// Vendor class identifier MAY MAY MAY MUST NOT MUST NOT +// Server identifier MUST NOT MUST NOT MUST (after SELECTING) MUST MUST // MUST NOT (after -// INIT-REBOOT, -// BOUND, RENEWING -// or REBINDING) -// Parameter request list MAY MAY MAY MUST NOT MUST NOT -// Maximum message size MAY MAY MAY MUST NOT MUST NOT -// Message SHOULD NOT SHOULD NOT SHOULD NOT SHOULD SHOULD -// Site-specific MAY MAY MAY MUST NOT MUST NOT -// All others MAY MAY MAY MUST NOT MUST NOT - +// INIT-REBOOT, BOUND, +// RENEWING or REBINDING) +// Parameter request list MAY MAY MAY MUST NOT MUST NOT +// Maximum message size MAY MAY MAY MUST NOT MUST NOT +// Message SHOULD NOT SHOULD NOT SHOULD NOT SHOULD SHOULD +// Site-specific MAY MAY MAY MUST NOT MUST NOT +// All others MAY MAY MAY MUST NOT MUST NOT /*** Logging ***/ -- cgit v1.2.3-55-g6feb