diff options
-rw-r--r-- | usr.sbin/bgpd/session.c | 6 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.h | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index e881f05c45a..6fab38bfd8e 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.209 2004/12/07 17:19:09 henning Exp $ */ +/* $OpenBSD: session.c,v 1.210 2004/12/23 15:15:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1421,7 +1421,7 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p) { ssize_t n, rpos, av, left; socklen_t len; - int error; + int error, processed = 0; u_int16_t msglen; u_int8_t msgtype; @@ -1537,6 +1537,8 @@ session_dispatch_msg(struct pollfd *pfd, struct peer *p) "unknown type %u", msgtype); } rpos += msglen; + if (++processed > MSG_PROCESS_LIMIT) + break; } if (p->rbuf == NULL) return (1); diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index 9488f495af0..103dc5fc368 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.73 2004/12/23 15:08:43 henning Exp $ */ +/* $OpenBSD: session.h,v 1.74 2004/12/23 15:15:55 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -34,6 +34,7 @@ #define MSGSIZE_UPDATE_MIN 23 #define MSGSIZE_KEEPALIVE MSGSIZE_HEADER #define MSGSIZE_RREFRESH MSGSIZE_HEADER + 4 +#define MSG_PROCESS_LIMIT 25 enum session_state { STATE_NONE, |