diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-08-26 23:30:10 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-09-09 22:28:05 +0200 |
commit | 3842286ed40d727fa338910139fc40daf9228d50 (patch) | |
tree | 62aa5e3f0ab8b6675ee5ed7838e2403d951a71ad /bgpd/bgp_open.c | |
parent | bgpd: move t_pmax_restart to peer_connection (diff) | |
download | frr-3842286ed40d727fa338910139fc40daf9228d50.tar.xz frr-3842286ed40d727fa338910139fc40daf9228d50.zip |
bgpd: bgp_notify_send use peer_connection instead of peer
The bgp_notify_send function should use a peer_connection
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_open.c')
-rw-r--r-- | bgpd/bgp_open.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index c7c91da74..9bfc06ec3 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -392,7 +392,7 @@ static int bgp_capability_orf_entry(struct peer *peer, zlog_info( "%s ORF Capability entry length error, Cap length %u, num %u", peer->host, hdr->length, num); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -965,7 +965,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length, if (stream_get_getp(s) + 2 > end) { zlog_info("%s Capability length error (< header)", peer->host); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -978,7 +978,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length, if (start + caphdr.length > end) { zlog_info("%s Capability length error (< length)", peer->host); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1013,7 +1013,8 @@ static int bgp_capability_parse(struct peer *peer, size_t length, NULL), caphdr.length, (unsigned)cap_minsizes[caphdr.code]); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, + BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1026,7 +1027,8 @@ static int bgp_capability_parse(struct peer *peer, size_t length, NULL), caphdr.length, (unsigned)cap_modsizes[caphdr.code]); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, + BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1122,7 +1124,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length, } if (ret < 0) { - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1170,7 +1172,7 @@ static bool bgp_role_violation(struct peer *peer) (local_role == ROLE_RS_SERVER && remote_role == ROLE_RS_CLIENT) || (local_role == ROLE_RS_CLIENT && remote_role == ROLE_RS_SERVER))) { - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_ROLE_MISMATCH); return true; } @@ -1178,7 +1180,7 @@ static bool bgp_role_violation(struct peer *peer) CHECK_FLAG(peer->flags, PEER_FLAG_ROLE_STRICT_MODE)) { const char *err_msg = "Strict mode. Please set the role on your side."; - bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_ROLE_MISMATCH, (uint8_t *)err_msg, strlen(err_msg)); return true; @@ -1306,7 +1308,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, */ if (STREAM_READABLE(s) < 1) { zlog_info("%s Option length error", peer->host); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1319,7 +1321,8 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, if (BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)) { if (STREAM_READABLE(s) < 2) { zlog_info("%s Option length error", peer->host); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, + BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1328,7 +1331,8 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, } else { if (STREAM_READABLE(s) < 1) { zlog_info("%s Option length error", peer->host); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, + BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1340,7 +1344,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, if (STREAM_READABLE(s) < opt_length) { zlog_info("%s Option length error (%d)", peer->host, opt_length); - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } @@ -1359,7 +1363,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, mp_capability, &error); break; default: - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_PARAM); ret = -1; break; @@ -1378,7 +1382,8 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, if (CHECK_FLAG(peer->flags, PEER_FLAG_STRICT_CAP_MATCH)) { /* If Unsupported Capability exists. */ if (error != error_data) { - bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send_with_data(peer->connection, + BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_CAPBL, error_data, error - error_data); @@ -1388,7 +1393,7 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, /* Check local capability does not negotiated with remote peer. */ if (!strict_capability_same(peer)) { - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_CAPBL); return -1; } @@ -1427,12 +1432,14 @@ int bgp_open_option_parse(struct peer *peer, uint16_t length, peer->host); if (error != error_data) - bgp_notify_send_with_data( - peer, BGP_NOTIFY_OPEN_ERR, - BGP_NOTIFY_OPEN_UNSUP_CAPBL, error_data, - error - error_data); + bgp_notify_send_with_data(peer->connection, + BGP_NOTIFY_OPEN_ERR, + BGP_NOTIFY_OPEN_UNSUP_CAPBL, + error_data, + error - error_data); else - bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR, + bgp_notify_send(peer->connection, + BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_UNSUP_CAPBL); return -1; } |