*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
This commit is contained in:
@@ -133,7 +133,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
uint8_t *temp, *message;
|
||||
char *str_c, *str_V, *str_h, *str_F, *str_r;
|
||||
USE_FEATURE_UDHCP_PORT(char *str_P;)
|
||||
IF_FEATURE_UDHCP_PORT(char *str_P;)
|
||||
llist_t *list_O = NULL;
|
||||
int tryagain_timeout = 20;
|
||||
int discover_timeout = 3;
|
||||
@@ -175,8 +175,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
"no-default-options\0" No_argument "o"
|
||||
"foreground\0" No_argument "f"
|
||||
"background\0" No_argument "b"
|
||||
USE_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a")
|
||||
USE_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P")
|
||||
IF_FEATURE_UDHCPC_ARPING("arping\0" No_argument "a")
|
||||
IF_FEATURE_UDHCP_PORT("client-port\0" Required_argument "P")
|
||||
;
|
||||
#endif
|
||||
enum {
|
||||
@@ -204,33 +204,33 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
|
||||
/* The rest has variable bit positions, need to be clever */
|
||||
OPTBIT_f = 20,
|
||||
USE_FOR_MMU( OPTBIT_b,)
|
||||
USE_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
|
||||
USE_FEATURE_UDHCP_PORT( OPTBIT_P,)
|
||||
IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
|
||||
IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
|
||||
USE_FOR_MMU( OPT_b = 1 << OPTBIT_b,)
|
||||
USE_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
|
||||
USE_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,)
|
||||
IF_FEATURE_UDHCPC_ARPING(OPT_a = 1 << OPTBIT_a,)
|
||||
IF_FEATURE_UDHCP_PORT( OPT_P = 1 << OPTBIT_P,)
|
||||
};
|
||||
|
||||
/* Default options. */
|
||||
USE_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
|
||||
USE_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
|
||||
IF_FEATURE_UDHCP_PORT(SERVER_PORT = 67;)
|
||||
IF_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
|
||||
client_config.interface = "eth0";
|
||||
client_config.script = DEFAULT_SCRIPT;
|
||||
|
||||
/* Parse command line */
|
||||
/* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */
|
||||
opt_complementary = "c--C:C--c:O::T+:t+:A+";
|
||||
USE_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
|
||||
IF_GETOPT_LONG(applet_long_options = udhcpc_longopts;)
|
||||
opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:vSA:O:of"
|
||||
USE_FOR_MMU("b")
|
||||
USE_FEATURE_UDHCPC_ARPING("a")
|
||||
USE_FEATURE_UDHCP_PORT("P:")
|
||||
IF_FEATURE_UDHCPC_ARPING("a")
|
||||
IF_FEATURE_UDHCP_PORT("P:")
|
||||
, &str_c, &str_V, &str_h, &str_h, &str_F
|
||||
, &client_config.interface, &client_config.pidfile, &str_r /* i,p */
|
||||
, &client_config.script /* s */
|
||||
, &discover_timeout, &discover_retries, &tryagain_timeout /* T,t,A */
|
||||
, &list_O
|
||||
USE_FEATURE_UDHCP_PORT(, &str_P)
|
||||
IF_FEATURE_UDHCP_PORT(, &str_P)
|
||||
);
|
||||
if (opt & OPT_c)
|
||||
client_config.clientid = alloc_dhcp_option(DHCP_CLIENT_ID, str_c, 0);
|
||||
|
||||
@@ -10,7 +10,7 @@ struct client_config_t {
|
||||
/* TODO: combine flag fields into single "unsigned opt" */
|
||||
/* (can be set directly to the result of getopt32) */
|
||||
char no_default_options; /* Do not include default optins in request */
|
||||
USE_FEATURE_UDHCP_PORT(uint16_t port;)
|
||||
IF_FEATURE_UDHCP_PORT(uint16_t port;)
|
||||
int ifindex; /* Index number of the interface to use */
|
||||
uint8_t opt_mask[256 / 8]; /* Bitmask of options to send (-O option) */
|
||||
const char *interface; /* The name of the interface to use */
|
||||
|
||||
@@ -37,14 +37,14 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
||||
unsigned opt;
|
||||
struct option_set *option;
|
||||
struct dhcpOfferedAddr *lease, static_lease;
|
||||
USE_FEATURE_UDHCP_PORT(char *str_P;)
|
||||
IF_FEATURE_UDHCP_PORT(char *str_P;)
|
||||
|
||||
#if ENABLE_FEATURE_UDHCP_PORT
|
||||
SERVER_PORT = 67;
|
||||
CLIENT_PORT = 68;
|
||||
#endif
|
||||
|
||||
opt = getopt32(argv, "fS" USE_FEATURE_UDHCP_PORT("P:", &str_P));
|
||||
opt = getopt32(argv, "fS" IF_FEATURE_UDHCP_PORT("P:", &str_P));
|
||||
argv += optind;
|
||||
if (!(opt & 1)) { /* no -f */
|
||||
bb_daemonize_or_rexec(0, argv);
|
||||
|
||||
@@ -394,7 +394,7 @@ void FAST_FUNC read_leases(const char *file)
|
||||
struct dhcpOfferedAddr lease;
|
||||
int64_t written_at, time_passed;
|
||||
int fd;
|
||||
USE_UDHCP_DEBUG(unsigned i;)
|
||||
IF_UDHCP_DEBUG(unsigned i;)
|
||||
|
||||
fd = open_or_warn(file, O_RDONLY);
|
||||
if (fd < 0)
|
||||
@@ -410,7 +410,7 @@ void FAST_FUNC read_leases(const char *file)
|
||||
if ((uint64_t)time_passed > 12 * 60 * 60)
|
||||
goto ret;
|
||||
|
||||
USE_UDHCP_DEBUG(i = 0;)
|
||||
IF_UDHCP_DEBUG(i = 0;)
|
||||
while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) {
|
||||
/* ADDME: what if it matches some static lease? */
|
||||
uint32_t y = ntohl(lease.yiaddr);
|
||||
@@ -424,7 +424,7 @@ void FAST_FUNC read_leases(const char *file)
|
||||
bb_error_msg("too many leases while loading %s", file);
|
||||
break;
|
||||
}
|
||||
USE_UDHCP_DEBUG(i++;)
|
||||
IF_UDHCP_DEBUG(i++;)
|
||||
}
|
||||
}
|
||||
DEBUG("Read %d leases", i);
|
||||
|
||||
Reference in New Issue
Block a user