summaryrefslogtreecommitdiff
path: root/ldpd/ldpd.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-04-18 22:03:35 -0300
committerRenato Westphal <renato@opensourcerouting.org>2017-06-05 12:23:02 -0300
commite75f810c2f6d3322e981c3e50f7d87f181005461 (patch)
tree01035ffbcd744e8cad91a7aa28b067f87666b09a /ldpd/ldpd.h
parente0d7c8996d6fe3bc39a1b9fd0310f17ff272ec1a (diff)
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> Conflicts: ldpd/ldpd.c ldpd/ldpd.h
Diffstat (limited to 'ldpd/ldpd.h')
-rw-r--r--ldpd/ldpd.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h
index 759f1d0da5..97239ed08e 100644
--- a/ldpd/ldpd.h
+++ b/ldpd/ldpd.h
@@ -147,7 +147,16 @@ enum imsg_type {
IMSG_LOG,
IMSG_ACL_CHECK,
IMSG_GET_LABEL_CHUNK,
- IMSG_RELEASE_LABEL_CHUNK
+ IMSG_RELEASE_LABEL_CHUNK,
+ 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 {
@@ -510,7 +519,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;
@@ -655,6 +663,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 *);