diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-10 14:45:26 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-03-10 14:45:26 +0000 |
commit | a7c89a3d6c175ef43aecb238ce95c25527802845 (patch) | |
tree | 59b1944ce8ceafa19e167eeec6e441a90e9c589f /usr.sbin/bgpd/session.c | |
parent | 0f19558f9f07930052353aba7b3d13834b933bca (diff) |
pass a pointer to the filter rule list to session_main() so we can free()
the list entries and the head there after forking
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r-- | usr.sbin/bgpd/session.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 61477b44e11..d2f51c7fd5c 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.130 2004/03/10 14:29:37 henning Exp $ */ +/* $OpenBSD: session.c,v 1.131 2004/03/10 14:45:25 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -137,17 +137,18 @@ setup_listener(void) int -session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2], - int pipe_s2r[2]) +session_main(struct bgpd_config *config, struct peer *cpeers, + struct filter_head *rules, int pipe_m2s[2], int pipe_s2r[2]) { - int nfds, i, j, timeout, idx_peers; - pid_t pid; - time_t nextaction; - struct passwd *pw; - struct peer *p, *peer_l[OPEN_MAX], *last, *next; - struct pollfd pfd[OPEN_MAX]; - struct ctl_conn *ctl_conn; - short events; + int nfds, i, j, timeout, idx_peers; + pid_t pid; + time_t nextaction; + struct passwd *pw; + struct peer *p, *peer_l[OPEN_MAX], *last, *next; + struct filter_rule *r; + struct pollfd pfd[OPEN_MAX]; + struct ctl_conn *ctl_conn; + short events; conf = config; peers = cpeers; @@ -197,6 +198,13 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2], csock = control_listen(); LIST_INIT(&mrt_l); + /* filter rules are not used in the SE */ + while ((r = TAILQ_FIRST(rules)) != NULL) { + TAILQ_REMOVE(rules, r, entries); + free(r); + } + free(rules); + while (session_quit == 0) { bzero(&pfd, sizeof(pfd)); pfd[PFD_LISTEN].fd = sock; @@ -355,7 +363,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2], control_shutdown(); log_info("session engine exiting"); - _exit(0); + exit(0); } void |