diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-03-22 07:19:29 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-03-22 07:19:29 +0000 |
commit | ff2310ce3662eefa6a565ec5f53e8ca42baf7e60 (patch) | |
tree | 39ef4729f8c2fa40f9d87a074cd3310508896d20 /usr.sbin/bgpd/util.c | |
parent | e1c409490b89b2618370aea810a2e84a3ccd07ba (diff) |
Rework parse_notification() to use the ibuf API for everything.
While there fix the RFC5492 handling of ERR_OPEN_CAPA (the current code
has the logic inversed). ERR_OPEN_CAPA is there to signal that a needed
capability is missing in our OPEN message. Just add the handling of
ERR_OPEN_CAPA to log_notification().
Also rework the handling of the shutdown reason and move the printing
into log_notification().
OK tb@
Diffstat (limited to 'usr.sbin/bgpd/util.c')
-rw-r--r-- | usr.sbin/bgpd/util.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index db4f5e75765..cdbcc576d2b 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.83 2024/03/20 09:35:46 claudio Exp $ */ +/* $OpenBSD: util.c,v 1.84 2024/03/22 07:19:28 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -309,6 +309,32 @@ log_policy(enum role role) } } +const char * +log_capability(uint8_t capa) +{ + static char buf[20]; + + switch (capa) { + case CAPA_MP: + return "Multiprotocol Extensions"; + case CAPA_REFRESH: + return "Route Refresh"; + case CAPA_ROLE: + return "BGP Role"; + case CAPA_RESTART: + return "Graceful Restart"; + case CAPA_AS4BYTE: + return "4-octet AS number"; + case CAPA_ADD_PATH: + return "ADD-PATH"; + case CAPA_ENHANCED_RR: + return "Enhanced Route Refresh"; + default: + snprintf(buf, sizeof(buf), "unknown %u", capa); + return buf; + } +} + static const char * aspath_delim(uint8_t seg_type, int closing) { |