Remove legacy support for exiting after obtaining a DHCP lease.
This commit is contained in:
parent
ade4e988af
commit
4575f74164
20
src/arp.c
20
src/arp.c
@ -500,24 +500,6 @@ int arp_gw_query_timeout(struct client_state_t cs[static 1], long long nowts)
|
||||
return ARPR_OK;
|
||||
}
|
||||
|
||||
// Failure here is difficult to handle gracefully, as we do have a valid
|
||||
// IP but have not yet announced it to other hosts on our ethernet
|
||||
// segment. We try to do so for one minute. We must measure the time
|
||||
// directly so that carrier loss or suspend are handled properly.
|
||||
__attribute__((noreturn))
|
||||
static void quit_after_lease_handler(struct client_state_t cs[static 1])
|
||||
{
|
||||
long long init_ts = curms();
|
||||
for (;;) {
|
||||
if (arp_announcement(cs) >= 0)
|
||||
exit(EXIT_SUCCESS);
|
||||
log_warning("%s: (%s) Failed to send ARP announcement: %s",
|
||||
client_config.interface, __func__, strerror(errno));
|
||||
if (curms() - init_ts > (60LL * 1000LL)) break;
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int arp_collision_timeout(struct client_state_t cs[static 1], long long nowts)
|
||||
{
|
||||
if (nowts >= garp.arp_check_start_ts + ANNOUNCE_WAIT ||
|
||||
@ -539,8 +521,6 @@ int arp_collision_timeout(struct client_state_t cs[static 1], long long nowts)
|
||||
cs->routerAddr = get_option_router(&garp.dhcp_packet);
|
||||
stop_dhcp_listen(cs);
|
||||
write_leasefile(temp_addr);
|
||||
if (client_config.quit_after_lease)
|
||||
quit_after_lease_handler(cs);
|
||||
return ARPR_FREE;
|
||||
}
|
||||
long long rtts = garp.send_stats[ASEND_COLLISION_CHECK].ts +
|
||||
|
12
src/cfg.rl
12
src/cfg.rl
@ -60,12 +60,6 @@ struct cfgparse {
|
||||
case -1: client_config.abort_if_no_lease = false; default: break;
|
||||
}
|
||||
}
|
||||
action quit {
|
||||
switch (ccfg.ternary) {
|
||||
case 1: client_config.quit_after_lease = true; break;
|
||||
case -1: client_config.quit_after_lease = false; default: break;
|
||||
}
|
||||
}
|
||||
action request { set_client_addr(ccfg.buf); }
|
||||
action vendorid {
|
||||
copy_cmdarg(client_config.vendor, ccfg.buf,
|
||||
@ -177,7 +171,6 @@ struct cfgparse {
|
||||
hostname = 'hostname' value @hostname;
|
||||
interface = 'interface' value @interface;
|
||||
now = 'now' boolval @now;
|
||||
quit = 'quit' boolval @quit;
|
||||
request = 'request' value @request;
|
||||
vendorid = 'vendorid' value @vendorid;
|
||||
user = 'user' value @user;
|
||||
@ -197,7 +190,7 @@ struct cfgparse {
|
||||
rfkill_idx = 'rfkill-idx' value @rfkill_idx;
|
||||
|
||||
main := blankline |
|
||||
clientid | hostname | interface | now | quit |
|
||||
clientid | hostname | interface | now |
|
||||
request | vendorid | user | ifch_user | sockd_user | chroot |
|
||||
state_dir | seccomp_enforce | relentless_defense | arp_probe_wait |
|
||||
arp_probe_num | arp_probe_min | arp_probe_max | gw_metric |
|
||||
@ -280,7 +273,6 @@ static void parse_cfgfile(const char fname[static 1])
|
||||
hostname = ('-h'|'--hostname') argval @hostname;
|
||||
interface = ('-i'|'--interface') argval @interface;
|
||||
now = ('-n'|'--now') tbv @now;
|
||||
quit = ('-q'|'--quit') tbv @quit;
|
||||
request = ('-r'|'--request') argval @request;
|
||||
vendorid = ('-V'|'--vendorid') argval @vendorid;
|
||||
user = ('-u'|'--user') argval @user;
|
||||
@ -303,7 +295,7 @@ static void parse_cfgfile(const char fname[static 1])
|
||||
|
||||
main := (
|
||||
cfgfile | clientid | hostname | interface |
|
||||
now | quit | request | vendorid | user | ifch_user | sockd_user |
|
||||
now | request | vendorid | user | ifch_user | sockd_user |
|
||||
chroot | state_dir | seccomp_enforce | relentless_defense |
|
||||
arp_probe_wait | arp_probe_num | arp_probe_min | arp_probe_max |
|
||||
gw_metric | resolv_conf | dhcp_set_hostname | rfkill_idx |
|
||||
|
@ -52,9 +52,6 @@ should use by name. The default is to listen on 'eth0'.
|
||||
.BI \-n ,\ \-\-now
|
||||
Exit with failure if a lease cannot be obtained. Useful for some init scripts.
|
||||
.TP
|
||||
.BI \-q ,\ \-\-quit
|
||||
Exit after obtaining a lease. Useful for some init scripts.
|
||||
.TP
|
||||
.BI \-r\ IP ,\ \-\-request= IP
|
||||
Request the specified IP address from the remote DHCP server. The DHCP server
|
||||
has no obligation to provide us with this IP, but it may acquiesce to the
|
||||
|
@ -152,7 +152,6 @@ void show_usage(void)
|
||||
" -i, --interface=INTERFACE Interface to use (default: eth0)\n"
|
||||
" -n, --now Exit with failure if lease cannot be\n"
|
||||
" immediately negotiated.\n"
|
||||
" -q, --quit Quit after obtaining lease\n"
|
||||
" -r, --request=IP IP address to request (default: none)\n"
|
||||
" -u, --user=USER Change ndhc privileges to this user\n"
|
||||
" -U, --ifch-user=USER Change ndhc-ifch privileges to this user\n"
|
||||
|
@ -69,7 +69,6 @@ struct client_config_t {
|
||||
int metric; // Metric for the default route
|
||||
int ifindex; // Index number of the interface to use
|
||||
uint8_t clientid_len; // Length of the clientid
|
||||
bool quit_after_lease; // Quit after obtaining lease
|
||||
bool abort_if_no_lease; // Abort if no lease
|
||||
bool enable_rfkill; // Listen for rfkill events
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user