diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-04-18 22:03:35 -0300 | 
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-04-26 10:36:30 -0300 | 
| commit | 274f5abf24fd5c9c79dce4102c3dfa583a791559 (patch) | |
| tree | 7c67de88798a29e37beea6424ca2b73c5aa8f124 /ldpd/lde.h | |
| parent | 01d1458f6abafaebeed04c1e6cb588298efb6546 (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>
Diffstat (limited to 'ldpd/lde.h')
| -rw-r--r-- | ldpd/lde.h | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/ldpd/lde.h b/ldpd/lde.h index 57791cd1b0..3349d4ca00 100644 --- a/ldpd/lde.h +++ b/ldpd/lde.h @@ -139,7 +139,8 @@ extern struct nbr_tree	 lde_nbrs;  extern struct thread	*gc_timer;  /* lde.c */ -void		 lde(const char *, const char *, u_short instance); +void		 lde(void); +void		 lde_init(struct ldpd_init *);  int		 lde_imsg_compose_parent(int, pid_t, void *, uint16_t);  int		 lde_imsg_compose_ldpe(int, uint32_t, pid_t, void *, uint16_t);  int		 lde_acl_check(char *, int, union ldpd_addr *, uint8_t);  | 
