mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-12 18:43:21 +00:00
bgpd: Use zlog_err and not zlog_info when we have an error for dynamic capability
Also change the outputs a bit to be consistent and more detailed. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
dccd9ab848
commit
83ed05c7d3
@ -27,22 +27,23 @@
|
|||||||
#include "bgpd/bgp_vty.h"
|
#include "bgpd/bgp_vty.h"
|
||||||
#include "bgpd/bgp_memory.h"
|
#include "bgpd/bgp_memory.h"
|
||||||
|
|
||||||
static const struct message capcode_str[] = {
|
const struct message capcode_str[] = {
|
||||||
{CAPABILITY_CODE_MP, "MultiProtocol Extensions"},
|
{ CAPABILITY_CODE_MP, "MultiProtocol Extensions" },
|
||||||
{CAPABILITY_CODE_REFRESH, "Route Refresh"},
|
{ CAPABILITY_CODE_REFRESH, "Route Refresh" },
|
||||||
{CAPABILITY_CODE_ORF, "Cooperative Route Filtering"},
|
{ CAPABILITY_CODE_ORF, "Cooperative Route Filtering" },
|
||||||
{CAPABILITY_CODE_RESTART, "Graceful Restart"},
|
{ CAPABILITY_CODE_RESTART, "Graceful Restart" },
|
||||||
{CAPABILITY_CODE_AS4, "4-octet AS number"},
|
{ CAPABILITY_CODE_AS4, "4-octet AS number" },
|
||||||
{CAPABILITY_CODE_ADDPATH, "AddPath"},
|
{ CAPABILITY_CODE_ADDPATH, "AddPath" },
|
||||||
{CAPABILITY_CODE_DYNAMIC, "Dynamic"},
|
{ CAPABILITY_CODE_DYNAMIC, "Dynamic" },
|
||||||
{CAPABILITY_CODE_ENHE, "Extended Next Hop Encoding"},
|
{ CAPABILITY_CODE_ENHE, "Extended Next Hop Encoding" },
|
||||||
{CAPABILITY_CODE_FQDN, "FQDN"},
|
{ CAPABILITY_CODE_FQDN, "FQDN" },
|
||||||
{CAPABILITY_CODE_ENHANCED_RR, "Enhanced Route Refresh"},
|
{ CAPABILITY_CODE_ENHANCED_RR, "Enhanced Route Refresh" },
|
||||||
{CAPABILITY_CODE_EXT_MESSAGE, "BGP Extended Message"},
|
{ CAPABILITY_CODE_EXT_MESSAGE, "BGP Extended Message" },
|
||||||
{CAPABILITY_CODE_LLGR, "Long-lived BGP Graceful Restart"},
|
{ CAPABILITY_CODE_LLGR, "Long-lived BGP Graceful Restart" },
|
||||||
{CAPABILITY_CODE_ROLE, "Role"},
|
{ CAPABILITY_CODE_ROLE, "Role" },
|
||||||
{CAPABILITY_CODE_SOFT_VERSION, "Software Version"},
|
{ CAPABILITY_CODE_SOFT_VERSION, "Software Version" },
|
||||||
{0}};
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/* Minimum sizes for length field of each cap (so not inc. the header) */
|
/* Minimum sizes for length field of each cap (so not inc. the header) */
|
||||||
static const size_t cap_minsizes[] = {
|
static const size_t cap_minsizes[] = {
|
||||||
|
@ -94,5 +94,6 @@ extern uint16_t bgp_open_capability(struct stream *s, struct peer *peer,
|
|||||||
extern void bgp_capability_vty_out(struct vty *vty, struct peer *peer,
|
extern void bgp_capability_vty_out(struct vty *vty, struct peer *peer,
|
||||||
bool use_json, json_object *json_neigh);
|
bool use_json, json_object *json_neigh);
|
||||||
extern as_t peek_for_as4_capability(struct peer *peer, uint16_t length);
|
extern as_t peek_for_as4_capability(struct peer *peer, uint16_t length);
|
||||||
|
extern const struct message capcode_str[];
|
||||||
|
|
||||||
#endif /* _QUAGGA_BGP_OPEN_H */
|
#endif /* _QUAGGA_BGP_OPEN_H */
|
||||||
|
@ -2772,6 +2772,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
iana_safi_t pkt_safi;
|
iana_safi_t pkt_safi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
char soft_version[BGP_MAX_SOFT_VERSION + 1] = {};
|
char soft_version[BGP_MAX_SOFT_VERSION + 1] = {};
|
||||||
|
const char *capability;
|
||||||
|
|
||||||
end = pnt + length;
|
end = pnt + length;
|
||||||
|
|
||||||
@ -2779,7 +2780,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
/* We need at least action, capability code and capability
|
/* We need at least action, capability code and capability
|
||||||
* length. */
|
* length. */
|
||||||
if (pnt + 3 > end) {
|
if (pnt + 3 > end) {
|
||||||
zlog_info("%s Capability length error", peer->host);
|
zlog_err("%pBP: Capability length error", peer);
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
||||||
return BGP_Stop;
|
return BGP_Stop;
|
||||||
@ -2790,21 +2791,20 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
/* Action value check. */
|
/* Action value check. */
|
||||||
if (action != CAPABILITY_ACTION_SET
|
if (action != CAPABILITY_ACTION_SET
|
||||||
&& action != CAPABILITY_ACTION_UNSET) {
|
&& action != CAPABILITY_ACTION_UNSET) {
|
||||||
zlog_info("%s Capability Action Value error %d",
|
zlog_err("%pBP: Capability Action Value error %d", peer,
|
||||||
peer->host, action);
|
action);
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
||||||
return BGP_Stop;
|
return BGP_Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bgp_debug_neighbor_events(peer))
|
if (bgp_debug_neighbor_events(peer))
|
||||||
zlog_debug(
|
zlog_debug("%pBP: CAPABILITY has action: %d, code: %u, length %u",
|
||||||
"%s CAPABILITY has action: %d, code: %u, length %u",
|
peer, action, hdr->code, hdr->length);
|
||||||
peer->host, action, hdr->code, hdr->length);
|
|
||||||
|
|
||||||
/* Capability length check. */
|
/* Capability length check. */
|
||||||
if ((pnt + hdr->length + 3) > end) {
|
if ((pnt + hdr->length + 3) > end) {
|
||||||
zlog_info("%s Capability length error", peer->host);
|
zlog_err("%pBP: Capability length error", peer);
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
||||||
return BGP_Stop;
|
return BGP_Stop;
|
||||||
@ -2814,6 +2814,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
if (CHECK_FLAG(peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
|
if (CHECK_FLAG(peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
capability = lookup_msg(capcode_str, hdr->code, "Unknown");
|
||||||
|
|
||||||
switch (hdr->code) {
|
switch (hdr->code) {
|
||||||
case CAPABILITY_CODE_SOFT_VERSION:
|
case CAPABILITY_CODE_SOFT_VERSION:
|
||||||
if (action == CAPABILITY_ACTION_SET) {
|
if (action == CAPABILITY_ACTION_SET) {
|
||||||
@ -2835,8 +2837,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
break;
|
break;
|
||||||
case CAPABILITY_CODE_MP:
|
case CAPABILITY_CODE_MP:
|
||||||
if (hdr->length < sizeof(struct capability_mp_data)) {
|
if (hdr->length < sizeof(struct capability_mp_data)) {
|
||||||
zlog_info("%pBP Capability structure is not properly filled out, expected at least %zu bytes but header length specified is %d",
|
zlog_err("%pBP: Capability (%s) structure is not properly filled out, expected at least %zu bytes but header length specified is %d",
|
||||||
peer,
|
peer, capability,
|
||||||
sizeof(struct capability_mp_data),
|
sizeof(struct capability_mp_data),
|
||||||
hdr->length);
|
hdr->length);
|
||||||
return BGP_Stop;
|
return BGP_Stop;
|
||||||
@ -2850,9 +2852,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi,
|
if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi,
|
||||||
&safi)) {
|
&safi)) {
|
||||||
if (bgp_debug_neighbor_events(peer))
|
if (bgp_debug_neighbor_events(peer))
|
||||||
zlog_debug(
|
zlog_debug("%pBP: Dynamic Capability %s afi/safi invalid (%s/%s)",
|
||||||
"%s Dynamic Capability MP_EXT afi/safi invalid (%s/%s)",
|
peer, capability,
|
||||||
peer->host,
|
|
||||||
iana_afi2str(pkt_afi),
|
iana_afi2str(pkt_afi),
|
||||||
iana_safi2str(pkt_safi));
|
iana_safi2str(pkt_safi));
|
||||||
continue;
|
continue;
|
||||||
@ -2860,13 +2861,12 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
|
|
||||||
/* Address family check. */
|
/* Address family check. */
|
||||||
if (bgp_debug_neighbor_events(peer))
|
if (bgp_debug_neighbor_events(peer))
|
||||||
zlog_debug(
|
zlog_debug("%pBP: CAPABILITY has %s %s CAP for afi/safi: %s/%s",
|
||||||
"%s CAPABILITY has %s MP_EXT CAP for afi/safi: %s/%s",
|
peer,
|
||||||
peer->host,
|
|
||||||
action == CAPABILITY_ACTION_SET
|
action == CAPABILITY_ACTION_SET
|
||||||
? "Advertising"
|
? "Advertising"
|
||||||
: "Removing",
|
: "Removing",
|
||||||
iana_afi2str(pkt_afi),
|
capability, iana_afi2str(pkt_afi),
|
||||||
iana_safi2str(pkt_safi));
|
iana_safi2str(pkt_safi));
|
||||||
|
|
||||||
if (action == CAPABILITY_ACTION_SET) {
|
if (action == CAPABILITY_ACTION_SET) {
|
||||||
@ -2900,9 +2900,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
break;
|
break;
|
||||||
case CAPABILITY_CODE_ROLE:
|
case CAPABILITY_CODE_ROLE:
|
||||||
if (hdr->length != CAPABILITY_CODE_ROLE_LEN) {
|
if (hdr->length != CAPABILITY_CODE_ROLE_LEN) {
|
||||||
flog_warn(EC_BGP_CAPABILITY_INVALID_LENGTH,
|
zlog_err("%pBP: Capability (%s) length error",
|
||||||
"Role: Received invalid length %d",
|
peer, capability);
|
||||||
hdr->length);
|
|
||||||
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
||||||
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
|
||||||
return BGP_Stop;
|
return BGP_Stop;
|
||||||
@ -2920,10 +2919,9 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
flog_warn(
|
flog_warn(EC_BGP_UNRECOGNIZED_CAPABILITY,
|
||||||
EC_BGP_UNRECOGNIZED_CAPABILITY,
|
"%pBP: unrecognized capability code: %d - ignored",
|
||||||
"%s unrecognized capability code: %d - ignored",
|
peer, hdr->code);
|
||||||
peer->host, hdr->code);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user