summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Jakma <paul@quagga.net>2012-06-13 22:50:07 +0100
committerPaul Jakma <paul@quagga.net>2012-06-13 22:50:07 +0100
commitad12dde6f9596997337ebc210dd2d4593438556b (patch)
tree661e013c488b2f7003b8b817d680fa9d03f4eb30
parent22714f99c4ffeb4d1bade7ad6374adeba0e06e4c (diff)
Revert "bgpd: Make socket init separate, so unit tests work again."
This reverts commit 7621f336e2f346edee43227f0b1ef93fe769720b. See bug #727
-rw-r--r--bgpd/bgp_main.c6
-rw-r--r--bgpd/bgpd.c16
-rw-r--r--bgpd/bgpd.h1
3 files changed, 7 insertions, 16 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 5abc8756..0f1d4829 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -441,12 +441,6 @@ 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)
{
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 31ce5a16..bdc4e289 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2063,6 +2063,13 @@ bgp_get (struct bgp **bgp_val, as_t *as, const char *name)
bgp_router_id_set(bgp, &router_id_zebra);
*bgp_val = bgp;
+ /* Create BGP server socket, if first instance. */
+ if (list_isempty(bm->bgp))
+ {
+ if (bgp_socket (bm->port, bm->address) < 0)
+ return BGP_ERR_INVALID_VALUE;
+ }
+
listnode_add (bm->bgp, bgp);
return 0;
@@ -5342,15 +5349,6 @@ bgp_master_init (void)
}
-int
-bgp_socket_init (void)
-{
- /* Create BGP server socket */
- if (bgp_socket (bm->port, bm->address) < 0)
- return BGP_ERR_INVALID_VALUE;
- return 0;
-}
-
void
bgp_init (void)
{
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 03a998b9..bb307160 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -846,7 +846,6 @@ extern void bgp_config_write_family_header (struct vty *, afi_t, safi_t, int *);
extern void bgp_master_init (void);
extern void bgp_init (void);
-extern int bgp_socket_init (void);
extern void bgp_route_map_init (void);
extern int bgp_option_set (int);