]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_network.c
*: remove the configuration lock from all daemons
[mirror_frr.git] / bgpd / bgp_network.c
index 458edab50d30be2c1d797298e48d8331ef05c5d0..e15b8f4ec38c356d7a418872e23fdc0d3d81bf47 100644 (file)
@@ -36,6 +36,7 @@
 #include "filter.h"
 #include "ns.h"
 #include "lib_errors.h"
+#include "nexthop.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_open.h"
@@ -44,6 +45,7 @@
 #include "bgpd/bgp_debug.h"
 #include "bgpd/bgp_errors.h"
 #include "bgpd/bgp_network.h"
+#include "bgpd/bgp_zebra.h"
 
 extern struct zebra_privs_t bgpd_privs;
 
@@ -404,7 +406,6 @@ static int bgp_accept(struct thread *thread)
 
        peer = peer_create(&su, peer1->conf_if, peer1->bgp, peer1->local_as,
                           peer1->as, peer1->as_type, 0, 0, NULL);
-       peer->su = su;
        hash_release(peer->bgp->peerhash, peer);
        hash_get(peer->bgp->peerhash, peer, hash_alloc_intern);
 
@@ -618,15 +619,12 @@ int bgp_getsockname(struct peer *peer)
        if (!peer->su_remote)
                return -1;
 
-       if (bgp_nexthop_set(peer->su_local, peer->su_remote, &peer->nexthop,
-                           peer)) {
-#if defined(HAVE_CUMULUS)
-               flog_err(
-                       EC_BGP_NH_UPD,
-                       "%s: nexthop_set failed, resetting connection - intf %p",
-                       peer->host, peer->nexthop.ifp);
+       if (!bgp_zebra_nexthop_set(peer->su_local, peer->su_remote,
+                                  &peer->nexthop, peer)) {
+               flog_err(EC_BGP_NH_UPD,
+                        "%s: nexthop_set failed, resetting connection - intf %p",
+                        peer->host, peer->nexthop.ifp);
                return -1;
-#endif
        }
        return 0;
 }
@@ -710,7 +708,11 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
                             gai_strerror(ret));
                return -1;
        }
-
+       if (bgp_option_check(BGP_OPT_NO_ZEBRA) &&
+           bgp->vrf_id != VRF_DEFAULT) {
+               freeaddrinfo(ainfo_save);
+               return -1;
+       }
        count = 0;
        for (ainfo = ainfo_save; ainfo; ainfo = ainfo->ai_next) {
                int sock;