]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Add "no listen" socket option for the BGP master configuration
authorPaul Jakma <paul@quagga.net>
Thu, 14 Jun 2012 09:40:26 +0000 (10:40 +0100)
committerPaul Jakma <paul@quagga.net>
Thu, 14 Jun 2012 16:30:14 +0000 (17:30 +0100)
* 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

bgpd/bgpd.c
bgpd/bgpd.h

index bdc4e2896509d40da9b712fa7e7e2d614efc9f19..69c8c0a33dddae4aceb90a41344fe7683523f669 100644 (file)
@@ -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;
index bb3071600a0d35d9d5dbc5141b2baeba74966313..63e326af9e5a07a3eceb6b8cc0e2b5b5205ec5c7 100644 (file)
@@ -59,6 +59,7 @@ struct bgp_master
 #define BGP_OPT_NO_FIB                   (1 << 0)
 #define BGP_OPT_MULTIPLE_INSTANCE        (1 << 1)
 #define BGP_OPT_CONFIG_CISCO             (1 << 2)
+#define BGP_OPT_NO_LISTEN                (1 << 3)
 };
 
 /* BGP instance structure.  */