diff options
author | Maria Matejka <mq@ucw.cz> | 2023-01-24 09:45:40 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-01-24 09:45:40 +0100 |
commit | 02b2a4ecaaf850ce04b0cd2e74c1ff6fede3f181 (patch) | |
tree | 70e459c6543dc09059055a103d4f388e9b5b9c18 /proto/bgp | |
parent | 3d96a16ae85db4329d2a24b7df9b3c18ae4e1045 (diff) | |
parent | 3186ffe79714a48542d5ad61a94c81216b522fd0 (diff) |
Merge commit '3186ffe79714a48542d5ad61a94c81216b522fd0' into thread-next
Diffstat (limited to 'proto/bgp')
-rw-r--r-- | proto/bgp/bgp.c | 2 | ||||
-rw-r--r-- | proto/bgp/bgp.h | 4 | ||||
-rw-r--r-- | proto/bgp/packets.c | 10 |
3 files changed, 10 insertions, 6 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index e8e65ad7..48e98bdf 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -2431,7 +2431,7 @@ bgp_show_afis(int code, char *s, u32 *afis, uint count) cli_msg(code, b.start); } -static const char * +const char * bgp_format_role_name(u8 role) { static const char *bgp_role_names[] = { "provider", "rs_server", "rs_client", "customer", "peer" }; diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 5a680022..6402921a 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -554,9 +554,7 @@ void bgp_refresh_begin(struct bgp_channel *c); void bgp_refresh_end(struct bgp_channel *c); void bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code); void bgp_stop(struct bgp_proto *p, int subcode, byte *data, uint len); - -struct rte_source *bgp_find_source(struct bgp_proto *p, u32 path_id); -struct rte_source *bgp_get_source(struct bgp_proto *p, u32 path_id); +const char *bgp_format_role_name(u8 role); static inline int rte_resolvable(const rte *rt) diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 0b8a899a..924d6828 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -908,10 +908,10 @@ bgp_rx_open(struct bgp_conn *conn, byte *pkt, uint len) (local_role == BGP_ROLE_PROVIDER && neigh_role == BGP_ROLE_CUSTOMER) || (local_role == BGP_ROLE_RS_CLIENT && neigh_role == BGP_ROLE_RS_SERVER) || (local_role == BGP_ROLE_RS_SERVER && neigh_role == BGP_ROLE_RS_CLIENT))) - { bgp_error(conn, 2, 11, NULL, 0); return; } + { bgp_error(conn, 2, 11, &neigh_role, -1); return; } if ((p->cf->require_roles) && (neigh_role == BGP_ROLE_UNDEFINED)) - { bgp_error(conn, 2, 11, NULL, 0); return; } + { bgp_error(conn, 2, 11, &neigh_role, -1); return; } /* Check the other connection */ other = (conn == &p->outgoing_conn) ? &p->incoming_conn : &p->outgoing_conn; @@ -3152,6 +3152,12 @@ bgp_log_error(struct bgp_proto *p, u8 class, char *msg, uint code, uint subcode, goto done; } + if ((code == 2) && (subcode == 11) && (len == 1)) + { + t += bsprintf(t, " (%s)", bgp_format_role_name(get_u8(data))); + goto done; + } + /* RFC 8203 - shutdown communication */ if (((code == 6) && ((subcode == 2) || (subcode == 4)))) if (bgp_handle_message(p, data, len, &t)) |