#include <zebra.h>
#include "command.h"
-#include "thread.h"
+#include "frrevent.h"
#include "prefix.h"
#include "lib/json.h"
#include "zclient.h"
void bgp_tip_hash_destroy(struct bgp *bgp)
{
- if (bgp->tip_hash == NULL)
- return;
- hash_clean(bgp->tip_hash, bgp_tip_hash_free);
- hash_free(bgp->tip_hash);
- bgp->tip_hash = NULL;
+ hash_clean_and_free(&bgp->tip_hash, bgp_tip_hash_free);
}
/* Add/Update Tunnel-IP entry of bgp martian next-hop table.
void bgp_address_destroy(struct bgp *bgp)
{
- if (bgp->address_hash == NULL)
- return;
- hash_clean(bgp->address_hash, bgp_address_hash_free);
- hash_free(bgp->address_hash);
- bgp->address_hash = NULL;
+ hash_clean_and_free(&bgp->address_hash, bgp_address_hash_free);
}
static void bgp_address_add(struct bgp *bgp, struct connected *ifc,
}
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV6:
- vty_out(vty, " gate %pI6\n", &nexthop->gate.ipv6);
- break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
- vty_out(vty, " gate %pI6, if %s\n",
- &nexthop->gate.ipv6,
- ifindex2ifname(bnc->ifindex ? bnc->ifindex
- : nexthop->ifindex,
- bgp->vrf_id));
+ vty_out(vty, " gate %pI6", &nexthop->gate.ipv6);
+ if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX &&
+ bnc->ifindex)
+ vty_out(vty, ", if %s\n",
+ ifindex2ifname(bnc->ifindex,
+ bgp->vrf_id));
+ else if (nexthop->ifindex)
+ vty_out(vty, ", if %s\n",
+ ifindex2ifname(nexthop->ifindex,
+ bgp->vrf_id));
+ else
+ vty_out(vty, "\n");
break;
case NEXTHOP_TYPE_IPV4:
- vty_out(vty, " gate %pI4\n", &nexthop->gate.ipv4);
+ case NEXTHOP_TYPE_IPV4_IFINDEX:
+ vty_out(vty, " gate %pI4", &nexthop->gate.ipv4);
+ if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX &&
+ bnc->ifindex)
+ vty_out(vty, ", if %s\n",
+ ifindex2ifname(bnc->ifindex,
+ bgp->vrf_id));
+ else if (nexthop->ifindex)
+ vty_out(vty, ", if %s\n",
+ ifindex2ifname(nexthop->ifindex,
+ bgp->vrf_id));
+ else
+ vty_out(vty, "\n");
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out(vty, " if %s\n",
: nexthop->ifindex,
bgp->vrf_id));
break;
- case NEXTHOP_TYPE_IPV4_IFINDEX:
- vty_out(vty, " gate %pI4, if %s\n",
- &nexthop->gate.ipv4,
- ifindex2ifname(bnc->ifindex ? bnc->ifindex
- : nexthop->ifindex,
- bgp->vrf_id));
- break;
case NEXTHOP_TYPE_BLACKHOLE:
vty_out(vty, " blackhole\n");
break;