summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-03-10 15:15:49 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-03-10 15:15:49 +0000
commitca9bc431e47f19584636a3665e756a609163e145 (patch)
tree2d8b8326611a2a327f8c0e683eac14c863f3ba6c /usr.sbin
parent853ecc4e3fcf1f0cf0ee328c9746559bfa50ca20 (diff)
pass a pointer to the network list as well to session_main so we can free()
the members after fork
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.c5
-rw-r--r--usr.sbin/bgpd/session.c12
-rw-r--r--usr.sbin/bgpd/session.h5
3 files changed, 16 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 8cb2b376101..b3f94f52392 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.83 2004/03/10 14:45:24 henning Exp $ */
+/* $OpenBSD: bgpd.c,v 1.84 2004/03/10 15:15:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -196,7 +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, rules_l, pipe_m2s, pipe_s2r);
+ io_pid = session_main(&conf, peer_l, &net_l, rules_l, pipe_m2s,
+ pipe_s2r);
setproctitle("parent");
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 9e9b64e4c0f..c099992f0d6 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.132 2004/03/10 14:54:11 henning Exp $ */
+/* $OpenBSD: session.c,v 1.133 2004/03/10 15:15:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -138,13 +138,15 @@ setup_listener(void)
int
session_main(struct bgpd_config *config, struct peer *cpeers,
- struct filter_head *rules, int pipe_m2s[2], int pipe_s2r[2])
+ struct network_head *net_l, 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 network *net;
struct filter_rule *r;
struct pollfd pfd[OPEN_MAX];
struct ctl_conn *ctl_conn;
@@ -205,6 +207,12 @@ session_main(struct bgpd_config *config, struct peer *cpeers,
}
free(rules);
+ /* network list is not used in the SE */
+ while ((net = TAILQ_FIRST(net_l)) != NULL) {
+ TAILQ_REMOVE(net_l, net, network_l);
+ free(net);
+ }
+
while (session_quit == 0) {
bzero(&pfd, sizeof(pfd));
pfd[PFD_LISTEN].fd = sock;
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 9ab267941e4..df8bb83d4c4 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.36 2004/03/10 14:45:25 henning Exp $ */
+/* $OpenBSD: session.h,v 1.37 2004/03/10 15:15:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -171,7 +171,8 @@ struct peer *peers;
/* session.c */
void session_socket_blockmode(int, enum blockmodes);
int session_main(struct bgpd_config *, struct peer *,
- struct filter_head *, int[2], int[2]);
+ struct network_head *, struct filter_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);