From 7621f336e2f346edee43227f0b1ef93fe769720b Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Tue, 1 May 2012 16:24:35 +0100 Subject: bgpd: Make socket init separate, so unit tests work again. * Separate out BGP socket initialisation from bgp_get, and make it an explicit function. Allows unit tests to work again and probably also benefits dry-run. * bgpd.c: (bgp_get) move socket init out... (bgp_socket_init) to here * bgp_main.c: and call it after dry-run. * bgpd.h: (bgp_socket_init) add prototype --- bgpd/bgp_main.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bgpd/bgp_main.c') diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 0f1d4829..5abc8756 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -441,6 +441,12 @@ main (int argc, char **argv) if(dryrun) return(0); + if (bgp_socket_init ()) + { + zlog_err ("BGP socket creation failed"); + return 1; + } + /* Turn into daemon if daemon_mode is set. */ if (daemon_mode && daemon (0, 0) < 0) { -- cgit v1.2.1