Skip to content

Commit

Permalink
rtr_parse_notify() state check is special since we ignore the PDU when
Browse files Browse the repository at this point in the history
it arrives in a strange moment. The RFC is as helpful about this as one
could expect. Still I botched the state check and later added an
rtr_send_error() call which made the previous worse.
OK tb@
  • Loading branch information
cjeker committed Jan 9, 2024
1 parent 4fa7a5b commit 964d668
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions usr.sbin/bgpd/rtr_proto.c
@@ -1,4 +1,4 @@
/* $OpenBSD: rtr_proto.c,v 1.25 2024/01/09 14:15:15 claudio Exp $ */
/* $OpenBSD: rtr_proto.c,v 1.26 2024/01/09 14:43:41 claudio Exp $ */

/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
Expand Down Expand Up @@ -524,11 +524,10 @@ rtr_parse_notify(struct rtr_session *rs, struct ibuf *pdu)
if (rtr_check_session_id(rs, rs->session_id, &notify.hdr, pdu) == -1)
return -1;

if (rs->state != RTR_STATE_EXCHANGE) {
if (rs->state != RTR_STATE_ESTABLISHED) {
log_warnx("rtr %s: received %s: while in state %s (ignored)",
log_rtr(rs), log_rtr_type(SERIAL_NOTIFY),
rtr_statenames[rs->state]);
rtr_send_error(rs, CORRUPT_DATA, "out of context", pdu);
return 0;
}

Expand Down

0 comments on commit 964d668

Please sign in to comment.