X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=bgpd%2Fbgp_zebra.c;h=c0f2dfca176c709cb020e70e4957459719c7d679;hb=a36898e7555036c786f7aa944b848966b45d5897;hp=a45480fdc27c0d7a65c3978bc27b985893ca9fdb;hpb=5fd270a114bc47e0aa3e527cc18215ea9fa50648;p=mirror_frr.git diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index a45480fdc..c0f2dfca1 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -793,6 +793,7 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote, peer->bgp->vrf_id); } if (local->sa.sa_family == AF_INET6) { + memcpy(&nexthop->v6_global, &local->sin6.sin6_addr, IPV6_MAX_BYTELEN); if (IN6_IS_ADDR_LINKLOCAL(&local->sin6.sin6_addr)) { if (peer->conf_if || peer->ifname) ifp = if_lookup_by_name(peer->conf_if @@ -1435,15 +1436,29 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, for (i = 0; i < api.nexthop_num; i++) { api_nh = &api.nexthops[i]; - if (api_nh->type == NEXTHOP_TYPE_IFINDEX) + switch (api_nh->type) { + case NEXTHOP_TYPE_IFINDEX: nh_buf[0] = '\0'; - else { - if (api_nh->type == NEXTHOP_TYPE_IPV4) - nh_family = AF_INET; - else - nh_family = AF_INET6; + break; + case NEXTHOP_TYPE_IPV4: + case NEXTHOP_TYPE_IPV4_IFINDEX: + nh_family = AF_INET; inet_ntop(nh_family, &api_nh->gate, nh_buf, sizeof(nh_buf)); + break; + case NEXTHOP_TYPE_IPV6: + case NEXTHOP_TYPE_IPV6_IFINDEX: + nh_family = AF_INET6; + inet_ntop(nh_family, &api_nh->gate, nh_buf, + sizeof(nh_buf)); + break; + case NEXTHOP_TYPE_BLACKHOLE: + strlcpy(nh_buf, "blackhole", sizeof(nh_buf)); + break; + default: + /* Note: add new nexthop case */ + assert(0); + break; } label_buf[0] = '\0'; @@ -2960,6 +2975,9 @@ void bgp_zebra_announce_default(struct bgp *bgp, struct nexthop *nh, SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); api_nh = &api.nexthops[0]; + api.distance = ZEBRA_EBGP_DISTANCE_DEFAULT; + SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE); + /* redirect IP */ if (nh->gate.ipv4.s_addr) { char buff[PREFIX_STRLEN];