#include "bgpd/bgpd.h"
#include "bgpd/bgp_debug.h"
+#include "bgpd/bgp_errors.h"
#include "bgpd/bgp_fsm.h"
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_packet.h"
#include "bgpd/bgp_nht.h"
#include "bgpd/bgp_mplsvpn.h"
#include "bgpd/bgp_label.h"
+#include "bgpd/bgp_addpath.h"
/********************
* PRIVATE FUNCTIONS
vec = &pkt->arr.entries[BGP_ATTR_VEC_NH];
if (CHECK_FLAG(vec->flags, BPKT_ATTRVEC_FLAGS_UPDATED)) {
uint8_t nhlen;
- afi_t nhafi = AFI_MAX; /* NH AFI is based on nhlen! */
+ afi_t nhafi;
int route_map_sets_nh;
nhlen = stream_getc_from(s, vec->offset);
if (peer_cap_enhe(peer, paf->afi, paf->safi))
break;
default:
/* TODO: handle IPv6 nexthops */
- zlog_warn(
+ flog_warn(
+ EC_BGP_INVALID_NEXTHOP_LENGTH,
"%s: %s: invalid MP nexthop length (AFI IP): %u",
__func__, peer->host, nhlen);
stream_free(s);
nh_modified = 1;
} else if (
peer->sort == BGP_PEER_EBGP
- && paf->safi != SAFI_EVPN
&& (bgp_multiaccess_check_v4(v4nh, peer) == 0)
&& !CHECK_FLAG(
vec->flags,
BPKT_ATTRVEC_FLAGS_RMAP_NH_UNCHANGED)
&& !peer_af_flag_check(
- peer, nhafi, paf->safi,
+ peer, paf->afi, paf->safi,
PEER_FLAG_NEXTHOP_UNCHANGED)) {
/* NOTE: not handling case where NH has new AFI
*/
break;
default:
/* TODO: handle IPv4 nexthops */
- zlog_warn(
+ flog_warn(
+ EC_BGP_INVALID_NEXTHOP_LENGTH,
"%s: %s: invalid MP nexthop length (AFI IP6): %u",
__func__, peer->host, nhlen);
stream_free(s);
struct bgp_adj_out *adj;
struct bgp_advertise *adv;
struct bgp_node *rn = NULL;
- struct bgp_info *binfo = NULL;
+ struct bgp_path_info *path = NULL;
bgp_size_t total_attr_len = 0;
unsigned long attrlen_pos = 0;
size_t mpattrlen_pos = 0;
rn = adv->rn;
adj = adv->adj;
addpath_tx_id = adj->addpath_tx_id;
- binfo = adv->binfo;
+ path = adv->pathi;
space_remaining = STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))
- BGP_MAX_PACKET_SIZE_OVERFLOW;
if (stream_empty(s)) {
struct peer *from = NULL;
- if (binfo)
- from = binfo->peer;
+ if (path)
+ from = path->peer;
/* 1: Write the BGP message header - 16 bytes marker, 2
* bytes length,
* NLRI then
* return */
if (space_remaining < space_needed) {
- zlog_err(
+ flog_err(
+ EC_BGP_UPDGRP_ATTR_LEN,
"u%" PRIu64 ":s%" PRIu64
" attributes too long, cannot send UPDATE",
subgrp->update_group->id, subgrp->id);
prd = (struct prefix_rd *)&rn->prn->p;
if (safi == SAFI_LABELED_UNICAST) {
- label = bgp_adv_label(rn, binfo, peer, afi,
+ label = bgp_adv_label(rn, path, peer, afi,
safi);
label_pnt = &label;
num_labels = 1;
- } else if (binfo && binfo->extra) {
- label_pnt = &binfo->extra->label[0];
- num_labels = binfo->extra->num_labels;
+ } else if (path && path->extra) {
+ label_pnt = &path->extra->label[0];
+ num_labels = path->extra->num_labels;
}
if (stream_empty(snlri))
snprintf(tx_id_buf, sizeof(tx_id_buf),
" with addpath ID %u",
BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE);
+ else
+ tx_id_buf[0] = '\0';
zlog_debug("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s",
(SUBGRP_UPDGRP(subgrp))->id, subgrp->id,