diff options
author | Paul Jakma <paul@quagga.net> | 2012-06-14 10:40:26 +0100 |
---|---|---|
committer | Paul Jakma <paul@quagga.net> | 2012-06-14 17:30:14 +0100 |
commit | cccbc0151883cfb4f43d6fa0a4a3caedc27e6cf5 (patch) | |
tree | 0c0296eb09551c556717e93250e5492fc1c7c85f /bgpd/bgpd.c | |
parent | 2fb2a455263c569119ca32be59b0337a3d8cd9b3 (diff) |
bgpd: Add "no listen" socket option for the BGP master configuration
* bgpd.h: add a BGP_OPT_NO_LISTEN option for the master BGP configuration,
to prevent any listen socket being created automatically. Allows code
to be used outside of BGP daemon settings.
* bgpd.c: (bgp_get) honour above the flag, suppress auto-creation of listen
socket on first BGP instance if set.
(bgp_option_set) whitelist BGP_OPT_NO_LISTEN
Diffstat (limited to 'bgpd/bgpd.c')
-rw-r--r-- | bgpd/bgpd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index bdc4e289..69c8c0a3 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -82,6 +82,7 @@ bgp_option_set (int flag) case BGP_OPT_NO_FIB: case BGP_OPT_MULTIPLE_INSTANCE: case BGP_OPT_CONFIG_CISCO: + case BGP_OPT_NO_LISTEN: SET_FLAG (bm->options, flag); break; default: @@ -2064,7 +2065,8 @@ bgp_get (struct bgp **bgp_val, as_t *as, const char *name) *bgp_val = bgp; /* Create BGP server socket, if first instance. */ - if (list_isempty(bm->bgp)) + if (list_isempty(bm->bgp) + && !bgp_option_check (BGP_OPT_NO_LISTEN)) { if (bgp_socket (bm->port, bm->address) < 0) return BGP_ERR_INVALID_VALUE; |