summaryrefslogtreecommitdiff
path: root/proto/bgp/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-01-20 15:55:47 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2023-01-20 15:55:47 +0100
commitaf611f93aa5040acc606ed289a873bf1136831c2 (patch)
treedcd61f23c2fb91c7d60117e06aaff8943c2ecfa0 /proto/bgp/packets.c
parent804916daa91834a4740edba96a43c7f0a43744b3 (diff)
BGP: Add received role value to role mismatch log message
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r--proto/bgp/packets.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index ddbc9226..16818cf3 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;
@@ -3158,6 +3158,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))