]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Cleanup peer->su handling
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 7 Oct 2018 23:54:07 +0000 (19:54 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 8 Oct 2018 00:55:52 +0000 (20:55 -0400)
Cleanup calls where we were passing in the su for
peer creation a tiny bit.

Creating a peer from the cli will always have a conf_if *or*
a su but not both. While a doppelganger will have both.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_network.c
bgpd/bgp_vty.c
bgpd/bgpd.c

index d56fdd75cee62dcfed059eb89995c5cdd5d63cbf..191b1641b2224286fe1d6124b6f474200397098b 100644 (file)
@@ -406,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);
 
index 58f23fd2f4338d16f1c12f07def034bfa32464d9..f617c9f997fd3646a4e93ce7f407c6bbf15e3076 100644 (file)
@@ -2835,7 +2835,7 @@ static int peer_conf_interface_get(struct vty *vty, const char *conf_if,
        peer = peer_lookup_by_conf_if(bgp, conf_if);
        if (peer) {
                if (as_str)
-                       ret = peer_remote_as(bgp, &su, conf_if, &as, as_type,
+                       ret = peer_remote_as(bgp, NULL, conf_if, &as, as_type,
                                             afi, safi);
        } else {
                if (bgp_flag_check(bgp, BGP_FLAG_NO_DEFAULT_IPV4)
index 0300485e9110f6bbc97a67f0b5c24d9d8e6dc419..ebaa0a3e5fac1005c437585df2f4549b27aec8fb 100644 (file)
@@ -1439,6 +1439,8 @@ struct peer *peer_create(union sockunion *su, const char *conf_if,
                if (peer->host)
                        XFREE(MTYPE_BGP_PEER_HOST, peer->host);
                peer->host = XSTRDUP(MTYPE_BGP_PEER_HOST, conf_if);
+               if (su)
+                       peer->su = *su;
        } else if (su) {
                peer->su = *su;
                sockunion2str(su, buf, SU_ADDRSTRLEN);