summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-08-26 17:30:10 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-09-09 16:28:05 -0400
commit3842286ed40d727fa338910139fc40daf9228d50 (patch)
tree62aa5e3f0ab8b6675ee5ed7838e2403d951a71ad
parent513c8c4f74b24c67ed7e56582c5b1e0093e5118e (diff)
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>
-rw-r--r--bgpd/bgp_attr.c34
-rw-r--r--bgpd/bgp_bfd.c2
-rw-r--r--bgpd/bgp_fsm.c9
-rw-r--r--bgpd/bgp_open.c47
-rw-r--r--bgpd/bgp_packet.c122
-rw-r--r--bgpd/bgp_packet.h9
-rw-r--r--bgpd/bgp_route.c3
-rw-r--r--bgpd/bgp_vty.c6
-rw-r--r--bgpd/bgpd.c127
9 files changed, 197 insertions, 162 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 3b22702937..0511fe8c39 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1368,7 +1368,8 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
/* Only relax error handling for eBGP peers */
if (peer->sort != BGP_PEER_EBGP) {
- bgp_notify_send_with_data(peer, BGP_NOTIFY_UPDATE_ERR, subcode,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR, subcode,
notify_datap, length);
return BGP_ATTR_PARSE_ERROR;
}
@@ -1412,7 +1413,8 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
return BGP_ATTR_PARSE_WITHDRAW;
case BGP_ATTR_MP_REACH_NLRI:
case BGP_ATTR_MP_UNREACH_NLRI:
- bgp_notify_send_with_data(peer, BGP_NOTIFY_UPDATE_ERR, subcode,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR, subcode,
notify_datap, length);
return BGP_ATTR_PARSE_ERROR;
}
@@ -1768,7 +1770,8 @@ enum bgp_attr_parse_ret bgp_attr_nexthop_valid(struct peer *peer,
data[1] = BGP_ATTR_NEXT_HOP;
data[2] = BGP_ATTR_NHLEN_IPV4;
memcpy(&data[3], &attr->nexthop.s_addr, BGP_ATTR_NHLEN_IPV4);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_INVAL_NEXT_HOP,
data, 7);
return BGP_ATTR_PARSE_ERROR;
@@ -3487,7 +3490,8 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
- stream_pnt(BGP_INPUT(peer))));
if (peer->sort != BGP_PEER_EBGP) {
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
ret = BGP_ATTR_PARSE_ERROR;
} else {
@@ -3516,7 +3520,8 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
- stream_pnt(BGP_INPUT(peer))));
if (peer->sort != BGP_PEER_EBGP) {
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
ret = BGP_ATTR_PARSE_ERROR;
} else {
@@ -3581,10 +3586,10 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
stream_get(&ndata[lfl + 1], BGP_INPUT(peer), ndl);
- bgp_notify_send_with_data(
- peer, BGP_NOTIFY_UPDATE_ERR,
- BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, ndata,
- ndl + lfl + 1);
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR,
+ BGP_NOTIFY_UPDATE_ATTR_LENG_ERR,
+ ndata, ndl + lfl + 1);
ret = BGP_ATTR_PARSE_ERROR;
goto done;
@@ -3619,7 +3624,8 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
"%s: error BGP attribute type %d appears twice in a message",
peer->host, type);
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
ret = BGP_ATTR_PARSE_ERROR;
goto done;
@@ -3747,7 +3753,7 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
}
if (ret == BGP_ATTR_PARSE_ERROR_NOTIFYPLS) {
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
ret = BGP_ATTR_PARSE_ERROR;
goto done;
@@ -3777,7 +3783,7 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
flog_warn(EC_BGP_ATTRIBUTE_FETCH_ERROR,
"%s: BGP attribute %s, fetch error",
peer->host, lookup_msg(attr_str, type, NULL));
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
ret = BGP_ATTR_PARSE_ERROR;
goto done;
@@ -3800,7 +3806,7 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
flog_warn(EC_BGP_ATTRIBUTES_MISMATCH,
"%s: BGP attribute %s, length mismatch", peer->host,
lookup_msg(attr_str, type, NULL));
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_ATTR_LENG_ERR);
ret = BGP_ATTR_PARSE_ERROR;
@@ -3852,7 +3858,7 @@ enum bgp_attr_parse_ret bgp_attr_parse(struct peer *peer, struct attr *attr,
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH))
&& bgp_attr_munge_as4_attrs(peer, attr, as4_path, as4_aggregator,
&as4_aggregator_addr)) {
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
ret = BGP_ATTR_PARSE_ERROR;
goto done;
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 7f83e97107..ba04c6fe85 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -57,7 +57,7 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
/* rfc9384 */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_BFD_DOWN);
BGP_EVENT_ADD(peer, BGP_Stop);
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 96a46f5f54..781c8aa1e2 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -1632,7 +1632,7 @@ static enum bgp_fsm_state_progress
bgp_stop_with_notify(struct peer *peer, uint8_t code, uint8_t sub_code)
{
/* Send notify to remote peer */
- bgp_notify_send(peer, code, sub_code);
+ bgp_notify_send(peer->connection, code, sub_code);
if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
@@ -1727,7 +1727,7 @@ bgp_connect_success(struct peer_connection *connection)
flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname(): failed for peer %s, fd %d",
__func__, peer->host, connection->fd);
- bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_FSM_ERR,
bgp_fsm_error_subcode(connection->status));
bgp_writes_on(connection);
return BGP_FSM_FAILURE;
@@ -1773,7 +1773,7 @@ bgp_connect_success_w_delayopen(struct peer_connection *connection)
flog_err_sys(EC_LIB_SOCKET,
"%s: bgp_getsockname(): failed for peer %s, fd %d",
__func__, peer->host, connection->fd);
- bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_FSM_ERR,
bgp_fsm_error_subcode(connection->status));
bgp_writes_on(connection);
return BGP_FSM_FAILURE;
@@ -2348,7 +2348,8 @@ bgp_establish(struct peer_connection *connection)
peer->host);
if (peer->doppelganger->connection->status > Active)
- bgp_notify_send(peer->doppelganger, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->doppelganger->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
else
peer_delete(peer->doppelganger);
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index c7c91da74d..9bfc06ec3a 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;
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 69fe7558ae..e90593356e 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -903,15 +903,17 @@ bool bgp_notify_received_hard_reset(struct peer *peer, uint8_t code,
* @param data Data portion
* @param datalen length of data portion
*/
-static void bgp_notify_send_internal(struct peer *peer, uint8_t code,
- uint8_t sub_code, uint8_t *data,
- size_t datalen, bool use_curr)
+static void bgp_notify_send_internal(struct peer_connection *connection,
+ uint8_t code, uint8_t sub_code,
+ uint8_t *data, size_t datalen,
+ bool use_curr)
{
struct stream *s;
+ struct peer *peer = connection->peer;
bool hard_reset = bgp_notify_send_hard_reset(peer, code, sub_code);
/* Lock I/O mutex to prevent other threads from pushing packets */
- frr_mutex_lock_autounlock(&peer->connection->io_mtx);
+ frr_mutex_lock_autounlock(&connection->io_mtx);
/* ============================================== */
/* Allocate new stream. */
@@ -944,7 +946,7 @@ static void bgp_notify_send_internal(struct peer *peer, uint8_t code,
bgp_packet_set_size(s);
/* wipe output buffer */
- stream_fifo_clean(peer->connection->obuf);
+ stream_fifo_clean(connection->obuf);
/*
* If possible, store last packet for debugging purposes. This check is
@@ -1029,7 +1031,7 @@ static void bgp_notify_send_internal(struct peer *peer, uint8_t code,
peer->last_reset = PEER_DOWN_NOTIFY_SEND;
/* Add packet to peer's output queue */
- stream_fifo_push(peer->connection->obuf, s);
+ stream_fifo_push(connection->obuf, s);
bgp_peer_gr_flags_update(peer);
BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(peer->bgp,
@@ -1048,18 +1050,20 @@ static void bgp_notify_send_internal(struct peer *peer, uint8_t code,
* @param code BGP error code
* @param sub_code BGP error subcode
*/
-void bgp_notify_send(struct peer *peer, uint8_t code, uint8_t sub_code)
+void bgp_notify_send(struct peer_connection *connection, uint8_t code,
+ uint8_t sub_code)
{
- bgp_notify_send_internal(peer, code, sub_code, NULL, 0, true);
+ bgp_notify_send_internal(connection, code, sub_code, NULL, 0, true);
}
/*
* Enqueue notification; called from the main pthread, peer object access is ok.
*/
-void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
+void bgp_notify_send_with_data(struct peer_connection *connection, uint8_t code,
uint8_t sub_code, uint8_t *data, size_t datalen)
{
- bgp_notify_send_internal(peer, code, sub_code, data, datalen, true);
+ bgp_notify_send_internal(connection, code, sub_code, data, datalen,
+ true);
}
/*
@@ -1070,7 +1074,8 @@ void bgp_notify_io_invalid(struct peer *peer, uint8_t code, uint8_t sub_code,
uint8_t *data, size_t datalen)
{
/* Avoid touching the peer object */
- bgp_notify_send_internal(peer, code, sub_code, data, datalen, false);
+ bgp_notify_send_internal(peer->connection, code, sub_code, data,
+ datalen, false);
}
/*
@@ -1384,7 +1389,7 @@ static int bgp_collision_detect(struct peer *new, struct in_addr remote_id)
* connection upon receipt of new one.
*/
if (peer_established(peer) || peer->connection->status == Clearing) {
- bgp_notify_send(new, BGP_NOTIFY_CEASE,
+ bgp_notify_send(new->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
return -1;
}
@@ -1417,11 +1422,11 @@ static int bgp_collision_detect(struct peer *new, struct in_addr remote_id)
* and accepts BGP connection initiated by
* the remote system.
*/
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
return 1;
} else {
- bgp_notify_send(new, BGP_NOTIFY_CEASE,
+ bgp_notify_send(new->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
return -1;
}
@@ -1440,11 +1445,11 @@ static int bgp_collision_detect(struct peer *new, struct in_addr remote_id)
* OpenConfirm state).
*/
if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) {
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
return 1;
} else {
- bgp_notify_send(new, BGP_NOTIFY_CEASE,
+ bgp_notify_send(new->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_COLLISION_RESOLUTION);
return -1;
}
@@ -1526,7 +1531,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
EC_BGP_PKT_OPEN,
"%s: stream does not have enough bytes for extended optional parameters",
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 BGP_Stop;
}
@@ -1538,7 +1543,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
EC_BGP_PKT_OPEN,
"%s: stream does not have enough bytes to read the extended optional parameters optlen",
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 BGP_Stop;
}
@@ -1565,7 +1571,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_PKT_OPEN,
"%s: stream has not enough bytes (%u)",
peer->host, optlen);
- bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_MALFORMED_ATTR);
return BGP_Stop;
}
@@ -1587,7 +1593,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_PKT_OPEN,
"%s bad OPEN, got AS4 capability, but AS4 set to 0",
peer->host);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as4, 4);
return BGP_Stop;
@@ -1597,7 +1603,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
if (remote_as == BGP_AS_ZERO) {
flog_err(EC_BGP_PKT_OPEN, "%s bad OPEN, got AS set to 0",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS);
return BGP_Stop;
}
@@ -1612,7 +1618,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
EC_BGP_PKT_OPEN,
"%s [AS4] NEW speaker using AS_TRANS for AS4, not allowed",
peer->host);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as4, 4);
return BGP_Stop;
@@ -1640,7 +1647,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
EC_BGP_PKT_OPEN,
"%s bad OPEN, got AS4 capability, but remote_as %u mismatch with 16bit 'myasn' %u in open",
peer->host, as4, remote_as);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as4, 4);
return BGP_Stop;
@@ -1660,7 +1668,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s bad OPEN, wrong router identifier %pI4",
peer->host, &remote_id);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_BGP_IDENT,
notify_data_remote_id, 4);
return BGP_Stop;
@@ -1675,7 +1683,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
"%s bad protocol version, remote requested %d, local request %d",
peer->host, version, BGP_VERSION_4);
/* Data must be in network byte order here */
- 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_VERSION,
(uint8_t *)&maxver, 2);
return BGP_Stop;
@@ -1687,7 +1695,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
zlog_debug(
"%s bad OPEN, remote AS is unspecified currently",
peer->host);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as, 2);
return BGP_Stop;
@@ -1697,7 +1705,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
zlog_debug(
"%s bad OPEN, remote AS is %u, internal specified",
peer->host, remote_as);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as, 2);
return BGP_Stop;
@@ -1709,7 +1718,8 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
zlog_debug(
"%s bad OPEN, remote AS is %u, external specified",
peer->host, remote_as);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as, 2);
return BGP_Stop;
@@ -1719,7 +1729,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s bad OPEN, remote AS is %u, expected %u",
peer->host, remote_as, peer->as);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_BAD_PEER_AS,
notify_data_remote_as, 2);
return BGP_Stop;
@@ -1752,7 +1762,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
*/
if (holdtime < 3 && holdtime != 0) {
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNACEP_HOLDTIME,
(uint8_t *)holdtime_ptr, 2);
return BGP_Stop;
@@ -1762,7 +1772,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
* is smaller than configured minimum Hold Time. */
if (holdtime < peer->bgp->default_min_holdtime
&& peer->bgp->default_min_holdtime != 0) {
- bgp_notify_send_with_data(peer, BGP_NOTIFY_OPEN_ERR,
+ bgp_notify_send_with_data(peer->connection, BGP_NOTIFY_OPEN_ERR,
BGP_NOTIFY_OPEN_UNACEP_HOLDTIME,
(uint8_t *)holdtime_ptr, 2);
return BGP_Stop;
@@ -1865,7 +1875,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_SND_FAIL,
"%s: No local IPv6 address, and zebra does not support V6 routing with v4 nexthops, BGP routing for V6 will not work",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -1981,7 +1991,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
peer->host,
lookup_msg(bgp_status_msg, peer->connection->status,
NULL));
- bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_FSM_ERR,
bgp_fsm_error_subcode(peer->connection->status));
return BGP_Stop;
}
@@ -2005,7 +2015,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (packet length is short for unfeasible length)",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
return BGP_Stop;
}
@@ -2018,7 +2028,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_UPDATE_RCV,
"%s [Error] Update packet error (packet unfeasible length overflow %d)",
peer->host, withdraw_len);
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
return BGP_Stop;
}
@@ -2038,7 +2048,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
EC_BGP_UPDATE_PACKET_SHORT,
"%s [Error] Packet Error (update packet is short for attribute length)",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
return BGP_Stop;
}
@@ -2052,7 +2062,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
EC_BGP_UPDATE_PACKET_LONG,
"%s [Error] Packet Error (update packet attribute length overflow %d)",
peer->host, attribute_len);
- bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MAL_ATTR);
return BGP_Stop;
}
@@ -2168,11 +2178,11 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_UPDATE_RCV,
"%s [Error] Error parsing NLRI", peer->host);
if (peer_established(peer))
- bgp_notify_send(
- peer, BGP_NOTIFY_UPDATE_ERR,
- i <= NLRI_WITHDRAW
- ? BGP_NOTIFY_UPDATE_INVAL_NETWORK
- : BGP_NOTIFY_UPDATE_OPT_ATTR_ERR);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_UPDATE_ERR,
+ i <= NLRI_WITHDRAW
+ ? BGP_NOTIFY_UPDATE_INVAL_NETWORK
+ : BGP_NOTIFY_UPDATE_OPT_ATTR_ERR);
bgp_attr_unintern_sub(&attr);
return BGP_Stop;
}
@@ -2421,7 +2431,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_NO_CAP,
"%s [Error] BGP route refresh is not enabled",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESTYPE);
return BGP_Stop;
}
@@ -2433,7 +2443,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
peer->host,
lookup_msg(bgp_status_msg, peer->connection->status,
NULL));
- bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_FSM_ERR,
bgp_fsm_error_subcode(peer->connection->status));
return BGP_Stop;
}
@@ -2472,9 +2482,9 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
zlog_err(
"%s Enhanced Route Refresh message length error",
peer->host);
- bgp_notify_send(
- peer, BGP_NOTIFY_ROUTE_REFRESH_ERR,
- BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_ROUTE_REFRESH_ERR,
+ BGP_NOTIFY_ROUTE_REFRESH_INVALID_MSG_LEN);
}
/* When the BGP speaker receives a ROUTE-REFRESH message
@@ -2490,7 +2500,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (msg_length < 5) {
zlog_info("%s ORF route refresh length error",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -2925,7 +2935,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
* length. */
if (pnt + 3 > end) {
zlog_err("%pBP: Capability length error", peer);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -2937,7 +2947,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
&& action != CAPABILITY_ACTION_UNSET) {
zlog_err("%pBP: Capability Action Value error %d", peer,
action);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -2949,7 +2959,7 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
/* Capability length check. */
if ((pnt + hdr->length + 3) > end) {
zlog_err("%pBP: Capability length error", peer);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -3034,7 +3044,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
if ((hdr->length - 2) % 4) {
zlog_err("%pBP: Received invalid Graceful-Restart capability length %d",
peer, hdr->length);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -3057,7 +3068,8 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
if (hdr->length != CAPABILITY_CODE_ROLE_LEN) {
zlog_err("%pBP: Capability (%s) length error",
peer, capability);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
@@ -3112,7 +3124,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size)
flog_err(EC_BGP_NO_CAP,
"%s [Error] BGP dynamic capability is not enabled",
peer->host);
- bgp_notify_send(peer, BGP_NOTIFY_HEADER_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_HEADER_ERR,
BGP_NOTIFY_HEADER_BAD_MESTYPE);
return BGP_Stop;
}
@@ -3124,7 +3136,7 @@ int bgp_capability_receive(struct peer *peer, bgp_size_t size)
peer->host,
lookup_msg(bgp_status_msg, peer->connection->status,
NULL));
- bgp_notify_send(peer, BGP_NOTIFY_FSM_ERR,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_FSM_ERR,
bgp_fsm_error_subcode(peer->connection->status));
return BGP_Stop;
}
diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h
index 04bdb81849..09c25c13ef 100644
--- a/bgpd/bgp_packet.h
+++ b/bgpd/bgp_packet.h
@@ -44,10 +44,11 @@ DECLARE_HOOK(bgp_packet_send,
/* Packet send and receive function prototypes. */
extern void bgp_keepalive_send(struct peer *peer);
extern void bgp_open_send(struct peer *peer);
-extern void bgp_notify_send(struct peer *peer, uint8_t code, uint8_t sub_code);
-extern void bgp_notify_send_with_data(struct peer *peer, uint8_t code,
- uint8_t sub_code, uint8_t *data,
- size_t datalen);
+extern void bgp_notify_send(struct peer_connection *connection, uint8_t code,
+ uint8_t sub_code);
+extern void bgp_notify_send_with_data(struct peer_connection *connection,
+ uint8_t code, uint8_t sub_code,
+ uint8_t *data, size_t datalen);
void bgp_notify_io_invalid(struct peer *peer, uint8_t code, uint8_t sub_code,
uint8_t *data, size_t datalen);
extern void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index d1556bb05b..467163d48a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3819,7 +3819,8 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
ndata[6] = (peer->pmax[afi][safi]);
SET_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
- bgp_notify_send_with_data(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_MAX_PREFIX,
ndata, 7);
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index dc9d00071d..1e2af357e7 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -2890,7 +2890,7 @@ DEFUN(bgp_reject_as_sets, bgp_reject_as_sets_cmd,
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_AS_SETS_REJECT;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -2916,7 +2916,7 @@ DEFUN(no_bgp_reject_as_sets, no_bgp_reject_as_sets_cmd,
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_AS_SETS_REJECT;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -4876,7 +4876,7 @@ static int peer_conf_interface_get(struct vty *vty, const char *conf_if,
/* v6only flag changed. Reset bgp seesion */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_V6ONLY_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(peer);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 62c803546c..1e18b1602c 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -309,7 +309,7 @@ static int bgp_router_id_set(struct bgp *bgp, const struct in_addr *id,
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_RID_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -488,7 +488,7 @@ void bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id)
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_CLID_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -512,7 +512,7 @@ void bgp_cluster_id_unset(struct bgp *bgp)
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_CLID_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -597,9 +597,9 @@ void bgp_confederation_id_set(struct bgp *bgp, as_t as, const char *as_str)
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_ID_CHANGE;
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset_safe(peer, &nnode);
}
@@ -615,9 +615,9 @@ void bgp_confederation_id_set(struct bgp *bgp, as_t as, const char *as_str)
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_ID_CHANGE;
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset_safe(peer, &nnode);
}
@@ -642,7 +642,8 @@ void bgp_confederation_id_unset(struct bgp *bgp)
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status)) {
peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
@@ -697,9 +698,9 @@ void bgp_confederation_peers_add(struct bgp *bgp, as_t as, const char *as_str)
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_PEER_CHANGE;
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset_safe(peer, &nnode);
}
@@ -754,9 +755,9 @@ void bgp_confederation_peers_remove(struct bgp *bgp, as_t as)
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_PEER_CHANGE;
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset_safe(peer, &nnode);
}
@@ -1970,7 +1971,7 @@ void peer_as_change(struct peer *peer, as_t as, int as_specified,
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_REMOTE_AS_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(peer);
@@ -2336,14 +2337,15 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
}
} else {
peer->last_reset = PEER_DOWN_AF_ACTIVATE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
if (peer->connection->status == OpenSent ||
peer->connection->status == OpenConfirm) {
peer->last_reset = PEER_DOWN_AF_ACTIVATE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
/*
@@ -2359,7 +2361,7 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
if (other && (other->connection->status == OpenSent ||
other->connection->status == OpenConfirm)) {
other->last_reset = PEER_DOWN_AF_ACTIVATE;
- bgp_notify_send(other, BGP_NOTIFY_CEASE,
+ bgp_notify_send(other->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -2467,12 +2469,13 @@ static bool non_peergroup_deactivate_af(struct peer *peer, afi_t afi,
peer->pcount[afi][safi] = 0;
} else {
peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
} else {
peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
@@ -2917,7 +2920,7 @@ int peer_group_remote_as(struct bgp *bgp, const char *group_name, as_t *as,
void peer_notify_unconfig(struct peer *peer)
{
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_PEER_UNCONFIG);
}
@@ -2932,7 +2935,7 @@ static void peer_notify_shutdown(struct peer *peer)
}
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
}
@@ -3200,7 +3203,7 @@ int peer_group_bind(struct bgp *bgp, union sockunion *su, struct peer *peer,
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_RMAP_BIND;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else {
bgp_session_reset(peer);
@@ -3755,7 +3758,7 @@ void bgp_instance_down(struct bgp *bgp)
/* Bring down peers, so corresponding routes are purged. */
for (ALL_LIST_ELEMENTS(bgp->peer, node, next, peer)) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
else
bgp_session_reset(peer);
@@ -4443,7 +4446,7 @@ void peer_change_action(struct peer *peer, afi_t afi, safi_t safi,
PEER_FLAG_CONFIG_NODE)))
peer_delete(peer->doppelganger);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else if (type == peer_change_reset_in) {
if (CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_RCV))
@@ -4456,7 +4459,7 @@ void peer_change_action(struct peer *peer, afi_t afi, safi_t safi,
PEER_FLAG_CONFIG_NODE)))
peer_delete(peer->doppelganger);
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
} else if (type == peer_change_reset_out) {
@@ -4627,13 +4630,14 @@ static void peer_flag_modify_action(struct peer *peer, uint64_t flag)
memcpy(msgbuf + 1, msg, msglen);
bgp_notify_send_with_data(
- peer, BGP_NOTIFY_CEASE,
+ peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
msgbuf, msglen + 1);
} else
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
} else
bgp_session_reset(peer);
} else {
@@ -4648,7 +4652,7 @@ static void peer_flag_modify_action(struct peer *peer, uint64_t flag)
else if (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)
peer->last_reset = PEER_DOWN_MULTIHOP_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(peer);
@@ -4687,14 +4691,14 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg)
data[0] = datalen;
memcpy(data + 1, msg, datalen);
- bgp_notify_send_with_data(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, data,
- datalen + 1);
+ bgp_notify_send_with_data(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN,
+ data, datalen + 1);
} else {
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
}
}
@@ -5101,7 +5105,8 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
if (peer->sort != BGP_PEER_IBGP) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
@@ -5120,7 +5125,8 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
@@ -5157,7 +5163,7 @@ int peer_ebgp_multihop_unset(struct peer *peer)
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
@@ -5176,9 +5182,9 @@ int peer_ebgp_multihop_unset(struct peer *peer)
if (peer->connection->fd >= 0) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
- bgp_notify_send(
- peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
}
@@ -5332,7 +5338,7 @@ int peer_update_source_if_set(struct peer *peer, const char *ifname)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(peer);
@@ -5370,7 +5376,7 @@ int peer_update_source_if_set(struct peer *peer, const char *ifname)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) {
member->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
- bgp_notify_send(member, BGP_NOTIFY_CEASE,
+ bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
@@ -5403,7 +5409,7 @@ void peer_update_source_addr_set(struct peer *peer, const union sockunion *su)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(peer);
@@ -5440,7 +5446,7 @@ void peer_update_source_addr_set(struct peer *peer, const union sockunion *su)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) {
member->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
- bgp_notify_send(member, BGP_NOTIFY_CEASE,
+ bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
@@ -5491,7 +5497,7 @@ void peer_update_source_unset(struct peer *peer)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(peer);
@@ -5527,7 +5533,7 @@ void peer_update_source_unset(struct peer *peer)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) {
member->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
- bgp_notify_send(member, BGP_NOTIFY_CEASE,
+ bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
@@ -6492,7 +6498,7 @@ int peer_local_as_unset(struct peer *peer)
/* Send notification or stop peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
BGP_EVENT_ADD(peer, BGP_Stop);
@@ -6520,7 +6526,7 @@ int peer_local_as_unset(struct peer *peer)
/* Send notification or stop peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status)) {
member->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
- bgp_notify_send(member, BGP_NOTIFY_CEASE,
+ bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
@@ -6551,7 +6557,7 @@ int peer_password_set(struct peer *peer, const char *password)
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
@@ -6587,7 +6593,7 @@ int peer_password_set(struct peer *peer, const char *password)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member, BGP_NOTIFY_CEASE,
+ bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(member);
@@ -6632,7 +6638,7 @@ int peer_password_unset(struct peer *peer)
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
@@ -6659,7 +6665,7 @@ int peer_password_unset(struct peer *peer)
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member, BGP_NOTIFY_CEASE,
+ bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(member);
@@ -8008,7 +8014,7 @@ int peer_clear(struct peer *peer, struct listnode **nnode)
peer->v_start = BGP_INIT_START_TIMER;
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_ADMIN_RESET);
else
bgp_session_reset_safe(peer, nnode);
@@ -8415,7 +8421,8 @@ void bgp_terminate(void)
}
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
+ bgp_notify_send(peer->connection,
+ BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_PEER_UNCONFIG);
}
}