diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-01-13 13:34:57 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-01-13 13:34:57 +0000 |
commit | 1362b94978385d3814ccba450d0fe991c491b1a1 (patch) | |
tree | ca8868203a18bb5916f702b5eb9e7a1ca8d794a9 /usr.sbin/bgpd/session.c | |
parent | 49fb134781c0e49beca418a3ea4b43b807728a92 (diff) |
Better update error handling. Ensure that the session goes down and
ignore all queued updates after an error. Looks good henning@
Diffstat (limited to 'usr.sbin/bgpd/session.c')
-rw-r--r-- | usr.sbin/bgpd/session.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 8f4ba4de1e1..526022863f6 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.86 2004/01/11 20:13:00 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.87 2004/01/13 13:34:56 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1379,6 +1379,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) struct peer *p, *next; enum reconf_action reconf; int n; + u_int8_t suberr; if ((n = imsg_read(ibuf)) == -1) fatal("session_dispatch_imsg: imsg_read error"); @@ -1483,6 +1484,23 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx) session_update(imsg.hdr.peerid, imsg.data, imsg.hdr.len - IMSG_HEADER_SIZE); break; + case IMSG_UPDATE_ERR: + if (idx != PFD_PIPE_ROUTE) + fatalx("update request not from RDE"); + if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(suberr)) { + logit(LOG_CRIT, + "RDE sent invalid notification"); + break; + } + if ((p = getpeerbyid(imsg.hdr.peerid)) == NULL) + logit(LOG_CRIT, "no such peer: id=%u", + imsg.hdr.peerid); + else { + memcpy(&suberr, imsg.data, sizeof(suberr)); + session_notification(p, ERR_UPDATE, suberr, + NULL, 0); + } + break; default: break; } |