diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-04-19 03:03:35 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-04-26 15:36:30 +0200 |
commit | 274f5abf24fd5c9c79dce4102c3dfa583a791559 (patch) | |
tree | 7c67de88798a29e37beea6424ca2b73c5aa8f124 /ldpd/ldpd.h | |
parent | ldpd: remove two unused imsg types (diff) | |
download | frr-274f5abf24fd5c9c79dce4102c3dfa583a791559.tar.xz frr-274f5abf24fd5c9c79dce4102c3dfa583a791559.zip |
ldpd: simplify initialization of the child processes
In order to have separate ASLR/cookies per process, ldpd calls exec()
in the child processes after fork() (this is also known as the fork+exec
model).
This is an important security feature but it makes the initialization
of the child processes a bit more complicated as they're not a copy of
the parent anymore, so all parameters given via command line are lost.
To solve this problem, we were creating an argv array by hand with all
necessary parameters and providing it to the exec() syscall. This works
but it's a very ugly solution. This patch introduces a different approach
to solve the problem: send an IMSG_INIT message to the child processes
with all parameters they need in order to initialize properly. This
makes adding additional initialization parameters much more convenient
and less error prone.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/ldpd.h')
-rw-r--r-- | ldpd/ldpd.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h index ad83b9aad..cba1939d9 100644 --- a/ldpd/ldpd.h +++ b/ldpd/ldpd.h @@ -145,7 +145,16 @@ enum imsg_type { IMSG_RECONF_END, IMSG_DEBUG_UPDATE, IMSG_LOG, - IMSG_ACL_CHECK + IMSG_ACL_CHECK, + IMSG_INIT +}; + +struct ldpd_init { + char user[256]; + char group[256]; + char ctl_sock_path[MAXPATHLEN]; + char zclient_serv_path[MAXPATHLEN]; + u_short instance; }; union ldpd_addr { @@ -508,7 +517,6 @@ struct ldpd_af_global { struct ldpd_global { int cmd_opts; int sighup; - time_t uptime; struct in_addr rtr_id; struct ldpd_af_global ipv4; struct ldpd_af_global ipv6; @@ -652,6 +660,7 @@ struct ctl_pw { extern struct ldpd_conf *ldpd_conf, *vty_conf; extern struct ldpd_global global; +extern struct ldpd_init init; /* parse.y */ struct ldpd_conf *parse_config(char *); |