diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-03-11 13:35:07 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-03-11 13:35:07 +0000 |
commit | 4711b14624e2746e8235e925b9df2b14b11db7f9 (patch) | |
tree | de0b8506b0516c6e1091bc247daebf69703ccac0 | |
parent | f718b3d294cbef062f940e39a990c50a5597909e (diff) |
Free unneeded mrt lists in SE and on exit. OK henning@
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 12 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 17 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.h | 4 |
3 files changed, 25 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index b3f94f52392..4d6082bf16e 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.84 2004/03/10 15:15:48 henning Exp $ */ +/* $OpenBSD: bgpd.c,v 1.85 2004/03/11 13:35:05 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -99,7 +99,7 @@ main(int argc, char *argv[]) struct filter_head *rules_l; struct network *net; struct filter_rule *r; - struct mrt *(mrt[POLL_MAX]); + struct mrt *(mrt[POLL_MAX]), *m; struct pollfd pfd[POLL_MAX]; pid_t io_pid = 0, rde_pid = 0, pid; char *conffile; @@ -196,8 +196,8 @@ main(int argc, char *argv[]) /* fork children */ rde_pid = rde_main(&conf, peer_l, &net_l, rules_l, pipe_m2r, pipe_s2r); - io_pid = session_main(&conf, peer_l, &net_l, rules_l, pipe_m2s, - pipe_s2r); + io_pid = session_main(&conf, peer_l, &net_l, rules_l, &mrt_l, + pipe_m2s, pipe_s2r); setproctitle("parent"); @@ -326,6 +326,10 @@ main(int argc, char *argv[]) peer_l = p->next; free(p); } + while ((m = LIST_FIRST(&mrt_l)) != NULL) { + LIST_REMOVE(m, list); + free(m); + } free(rules_l); control_cleanup(); diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index c099992f0d6..5b4df51dab7 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.133 2004/03/10 15:15:48 henning Exp $ */ +/* $OpenBSD: session.c,v 1.134 2004/03/11 13:35:05 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -139,7 +139,7 @@ setup_listener(void) int session_main(struct bgpd_config *config, struct peer *cpeers, struct network_head *net_l, struct filter_head *rules, - int pipe_m2s[2], int pipe_s2r[2]) + struct mrt_head *m_l, int pipe_m2s[2], int pipe_s2r[2]) { int nfds, i, j, timeout, idx_peers; pid_t pid; @@ -147,6 +147,8 @@ session_main(struct bgpd_config *config, struct peer *cpeers, struct passwd *pw; struct peer *p, *peer_l[OPEN_MAX], *last, *next; struct network *net; + struct mrt *m; + struct mrt_config *mrt; struct filter_rule *r; struct pollfd pfd[OPEN_MAX]; struct ctl_conn *ctl_conn; @@ -213,6 +215,12 @@ session_main(struct bgpd_config *config, struct peer *cpeers, free(net); } + /* main mrt list is not used in the SE */ + while ((m = LIST_FIRST(m_l)) != NULL) { + LIST_REMOVE(m, list); + free(m); + } + while (session_quit == 0) { bzero(&pfd, sizeof(pfd)); pfd[PFD_LISTEN].fd = sock; @@ -367,6 +375,11 @@ session_main(struct bgpd_config *config, struct peer *cpeers, free(p); } + while ((mrt = LIST_FIRST(&mrt_l)) != NULL) { + LIST_REMOVE(mrt, list); + free(mrt); + } + msgbuf_write(&ibuf_rde.w); msgbuf_clear(&ibuf_rde.w); msgbuf_write(&ibuf_main.w); diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index df8bb83d4c4..e6d5c1b795c 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.37 2004/03/10 15:15:48 henning Exp $ */ +/* $OpenBSD: session.h,v 1.38 2004/03/11 13:35:06 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -172,7 +172,7 @@ struct peer *peers; void session_socket_blockmode(int, enum blockmodes); int session_main(struct bgpd_config *, struct peer *, struct network_head *, struct filter_head *, - int[2], int[2]); + struct mrt_head *, int[2], int[2]); void bgp_fsm(struct peer *, enum session_events); struct peer *getpeerbyip(in_addr_t); int imsg_compose_parent(int, pid_t, void *, u_int16_t); |