diff options
| -rw-r--r-- | babeld/message.c | 28 | ||||
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 4 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 11 |
3 files changed, 36 insertions, 7 deletions
diff --git a/babeld/message.c b/babeld/message.c index e4d3bf7d49..c8b1318c7a 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -290,7 +290,7 @@ parse_request_subtlv(int ae, const unsigned char *a, int alen, int have_src_prefix = 0; while(i < alen) { - type = a[0]; + type = a[i]; if(type == SUBTLV_PAD1) { i++; continue; @@ -591,6 +591,20 @@ parse_packet(const unsigned char *from, struct interface *ifp, int rc, parsed_len; bool ignore_update = false; + // Basic sanity check on length + if (len < 10) { + if (len < 2 || (message[3] & 0x80)) { + have_v4_prefix = have_v6_prefix = 0; + } + goto fail; + } + + if(!known_ae(message[2])) { + debugf(BABEL_DEBUG_COMMON,"Received update with unknown AE %d. Ignoring.", + message[2]); + goto done; + } + DO_NTOHS(interval, message + 6); DO_NTOHS(seqno, message + 8); DO_NTOHS(metric, message + 10); @@ -629,7 +643,7 @@ parse_packet(const unsigned char *from, struct interface *ifp, } have_router_id = 1; } - if(!have_router_id && message[2] != 0) { + if(metric < INFINITY && !have_router_id && message[2] != 0) { flog_err(EC_BABEL_PACKET, "Received prefix with no router id."); goto fail; @@ -641,9 +655,15 @@ parse_packet(const unsigned char *from, struct interface *ifp, format_address(from), ifp->name); if(message[2] == 0) { - if(metric < 0xFFFF) { + if(metric < INFINITY) { + flog_err(EC_BABEL_PACKET, + "Received wildcard update with finite metric."); + goto done; + } + // Add check for Plen and Omitted + if(message[4] != 0 || message[5] != 0) { flog_err(EC_BABEL_PACKET, - "Received wildcard update with finite metric."); + "Received wildcard retraction with non-zero Plen or Omitted."); goto done; } retract_neighbour_routes(neigh); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 038f38a49b..782d29a7f5 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -397,6 +397,8 @@ void vpn_leak_zebra_vrf_sid_update_per_af(struct bgp *bgp, afi_t afi) ctx.argument_len = bgp->vpn_policy[afi] .tovpn_sid_locator->argument_bits_length; + if (CHECK_FLAG(bgp->vpn_policy[afi].tovpn_sid_locator->flags, SRV6_LOCATOR_USID)) + SET_SRV6_FLV_OP(ctx.flv.flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_NEXT_CSID); } ctx.table = vrf->data.l.table_id; act = afi == AFI_IP ? ZEBRA_SEG6_LOCAL_ACTION_END_DT4 @@ -454,6 +456,8 @@ void vpn_leak_zebra_vrf_sid_update_per_vrf(struct bgp *bgp) ctx.node_len = bgp->tovpn_sid_locator->node_bits_length; ctx.function_len = bgp->tovpn_sid_locator->function_bits_length; ctx.argument_len = bgp->tovpn_sid_locator->argument_bits_length; + if (CHECK_FLAG(bgp->tovpn_sid_locator->flags, SRV6_LOCATOR_USID)) + SET_SRV6_FLV_OP(ctx.flv.flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_NEXT_CSID); } ctx.table = vrf->data.l.table_id; act = ZEBRA_SEG6_LOCAL_ACTION_END_DT46; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index b6fd9ecfd9..1df8b4ffe2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -14088,9 +14088,14 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi, ? "Advertise" : "Withdraw"); - /* Receive prefix count */ - vty_out(vty, " %u accepted prefixes\n", - p->pcount[afi][safi]); + /* Receive and sent prefix count, if available */ + paf = peer_af_find(p, afi, safi); + if (paf && PAF_SUBGRP(paf)) + vty_out(vty, " %u accepted, %u sent prefixes\n", + p->pcount[afi][safi], PAF_SUBGRP(paf)->scount); + else + vty_out(vty, " %u accepted prefixes\n", + p->pcount[afi][safi]); /* maximum-prefix-out */ if (CHECK_FLAG(p->af_flags[afi][safi], |
