Remove legacy support for writing a pidfile.
This commit is contained in:
parent
4d33c00e04
commit
58067200d6
10
src/cfg.rl
10
src/cfg.rl
@ -59,10 +59,6 @@ struct cfgparse {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
action pidfile {
|
|
||||||
write_pid_enabled = true;
|
|
||||||
copy_cmdarg(pidfile, ccfg.buf, sizeof pidfile, "pidfile");
|
|
||||||
}
|
|
||||||
action hostname {
|
action hostname {
|
||||||
copy_cmdarg(client_config.hostname, ccfg.buf,
|
copy_cmdarg(client_config.hostname, ccfg.buf,
|
||||||
sizeof client_config.hostname, "hostname");
|
sizeof client_config.hostname, "hostname");
|
||||||
@ -192,7 +188,6 @@ struct cfgparse {
|
|||||||
|
|
||||||
clientid = 'clientid' value @clientid;
|
clientid = 'clientid' value @clientid;
|
||||||
background = 'background' boolval @background;
|
background = 'background' boolval @background;
|
||||||
pidfile = 'pidfile' value @pidfile;
|
|
||||||
hostname = 'hostname' value @hostname;
|
hostname = 'hostname' value @hostname;
|
||||||
interface = 'interface' value @interface;
|
interface = 'interface' value @interface;
|
||||||
now = 'now' boolval @now;
|
now = 'now' boolval @now;
|
||||||
@ -216,7 +211,7 @@ struct cfgparse {
|
|||||||
rfkill_idx = 'rfkill-idx' value @rfkill_idx;
|
rfkill_idx = 'rfkill-idx' value @rfkill_idx;
|
||||||
|
|
||||||
main := blankline |
|
main := blankline |
|
||||||
clientid | background | pidfile | hostname | interface | now | quit |
|
clientid | background | hostname | interface | now | quit |
|
||||||
request | vendorid | user | ifch_user | sockd_user | chroot |
|
request | vendorid | user | ifch_user | sockd_user | chroot |
|
||||||
state_dir | seccomp_enforce | relentless_defense | arp_probe_wait |
|
state_dir | seccomp_enforce | relentless_defense | arp_probe_wait |
|
||||||
arp_probe_num | arp_probe_min | arp_probe_max | gw_metric |
|
arp_probe_num | arp_probe_min | arp_probe_max | gw_metric |
|
||||||
@ -297,7 +292,6 @@ static void parse_cfgfile(const char fname[static 1])
|
|||||||
cfgfile = ('-c'|'--config') argval @cfgfile;
|
cfgfile = ('-c'|'--config') argval @cfgfile;
|
||||||
clientid = ('-I'|'--clientid') argval @clientid;
|
clientid = ('-I'|'--clientid') argval @clientid;
|
||||||
background = ('-b'|'--background') tbv @background;
|
background = ('-b'|'--background') tbv @background;
|
||||||
pidfile = ('-p'|'--pidfile') argval @pidfile;
|
|
||||||
hostname = ('-h'|'--hostname') argval @hostname;
|
hostname = ('-h'|'--hostname') argval @hostname;
|
||||||
interface = ('-i'|'--interface') argval @interface;
|
interface = ('-i'|'--interface') argval @interface;
|
||||||
now = ('-n'|'--now') tbv @now;
|
now = ('-n'|'--now') tbv @now;
|
||||||
@ -323,7 +317,7 @@ static void parse_cfgfile(const char fname[static 1])
|
|||||||
help = ('-?'|'--help') 0 @help;
|
help = ('-?'|'--help') 0 @help;
|
||||||
|
|
||||||
main := (
|
main := (
|
||||||
cfgfile | clientid | background | pidfile | hostname | interface |
|
cfgfile | clientid | background | hostname | interface |
|
||||||
now | quit | request | vendorid | user | ifch_user | sockd_user |
|
now | quit | request | vendorid | user | ifch_user | sockd_user |
|
||||||
chroot | state_dir | seccomp_enforce | relentless_defense |
|
chroot | state_dir | seccomp_enforce | relentless_defense |
|
||||||
arp_probe_wait | arp_probe_num | arp_probe_min | arp_probe_max |
|
arp_probe_wait | arp_probe_num | arp_probe_min | arp_probe_max |
|
||||||
|
@ -40,10 +40,6 @@ the vendor id option field. The default is to send the string 'ndhc'.
|
|||||||
.BI \-b ,\ \-\-background
|
.BI \-b ,\ \-\-background
|
||||||
Immediately fork into the background, even before obtaining a lease.
|
Immediately fork into the background, even before obtaining a lease.
|
||||||
.TP
|
.TP
|
||||||
.BI \-p\ PIDFILE ,\ \-\-pidfile= PIDFILE
|
|
||||||
Write the process id number of the ndhc process into the specified file name.
|
|
||||||
The default is to not write the process id number into any file at all.
|
|
||||||
.TP
|
|
||||||
.BI \-s\ STATEDIR ,\ \-\-state\-dir= STATEDIR
|
.BI \-s\ STATEDIR ,\ \-\-state\-dir= STATEDIR
|
||||||
Specifies the directory where the DHCP state associated with the given
|
Specifies the directory where the DHCP state associated with the given
|
||||||
interface will be stored. Such state will include the leased IP, the
|
interface will be stored. Such state will include the leased IP, the
|
||||||
|
@ -151,7 +151,6 @@ void show_usage(void)
|
|||||||
" -V, --vendorid=VENDORID Client vendor identification string\n"
|
" -V, --vendorid=VENDORID Client vendor identification string\n"
|
||||||
" -b, --background Fork to background if lease cannot be\n"
|
" -b, --background Fork to background if lease cannot be\n"
|
||||||
" immediately negotiated.\n"
|
" immediately negotiated.\n"
|
||||||
" -p, --pidfile=FILE File where the ndhc pid will be written\n"
|
|
||||||
" -i, --interface=INTERFACE Interface to use (default: eth0)\n"
|
" -i, --interface=INTERFACE Interface to use (default: eth0)\n"
|
||||||
" -n, --now Exit with failure if lease cannot be\n"
|
" -n, --now Exit with failure if lease cannot be\n"
|
||||||
" immediately negotiated.\n"
|
" immediately negotiated.\n"
|
||||||
@ -439,14 +438,12 @@ static void do_ndhc_work(void)
|
|||||||
char state_dir[PATH_MAX] = "/etc/ndhc";
|
char state_dir[PATH_MAX] = "/etc/ndhc";
|
||||||
char chroot_dir[PATH_MAX] = "";
|
char chroot_dir[PATH_MAX] = "";
|
||||||
char resolv_conf_d[PATH_MAX] = "";
|
char resolv_conf_d[PATH_MAX] = "";
|
||||||
char pidfile[PATH_MAX] = "";
|
|
||||||
uid_t ndhc_uid = 0;
|
uid_t ndhc_uid = 0;
|
||||||
gid_t ndhc_gid = 0;
|
gid_t ndhc_gid = 0;
|
||||||
int ifchSock[2];
|
int ifchSock[2];
|
||||||
int sockdSock[2];
|
int sockdSock[2];
|
||||||
int ifchStream[2];
|
int ifchStream[2];
|
||||||
int sockdStream[2];
|
int sockdStream[2];
|
||||||
bool write_pid_enabled = false;
|
|
||||||
|
|
||||||
static void create_ifch_ipc_sockets(void) {
|
static void create_ifch_ipc_sockets(void) {
|
||||||
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, ifchSock) < 0)
|
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, ifchSock) < 0)
|
||||||
@ -506,9 +503,6 @@ static void ndhc_main(void) {
|
|||||||
|
|
||||||
cs.rfkillFd = rfkill_open(&client_config.enable_rfkill);
|
cs.rfkillFd = rfkill_open(&client_config.enable_rfkill);
|
||||||
|
|
||||||
if (write_pid_enabled && !client_config.background_if_no_lease)
|
|
||||||
write_pid(pidfile);
|
|
||||||
|
|
||||||
open_leasefile();
|
open_leasefile();
|
||||||
|
|
||||||
nk_set_chroot(chroot_dir);
|
nk_set_chroot(chroot_dir);
|
||||||
@ -533,8 +527,6 @@ void background(void)
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (write_pid_enabled)
|
|
||||||
write_pid(pidfile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_for_rfkill()
|
static void wait_for_rfkill()
|
||||||
|
@ -91,10 +91,8 @@ extern int sockdStream[2];
|
|||||||
extern char state_dir[PATH_MAX];
|
extern char state_dir[PATH_MAX];
|
||||||
extern char chroot_dir[PATH_MAX];
|
extern char chroot_dir[PATH_MAX];
|
||||||
extern char resolv_conf_d[PATH_MAX];
|
extern char resolv_conf_d[PATH_MAX];
|
||||||
extern char pidfile[PATH_MAX];
|
|
||||||
extern uid_t ndhc_uid;
|
extern uid_t ndhc_uid;
|
||||||
extern gid_t ndhc_gid;
|
extern gid_t ndhc_gid;
|
||||||
extern bool write_pid_enabled;
|
|
||||||
|
|
||||||
int signals_flagged(void);
|
int signals_flagged(void);
|
||||||
void set_client_addr(const char v[static 1]);
|
void set_client_addr(const char v[static 1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user