diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-02-10 08:23:14 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-02-10 08:23:14 +0000 |
commit | 0f646f48585a60a6ed2c6a203f778c65f936dfe5 (patch) | |
tree | 03096e3f63f2468643fa150522b79cd93cda2bd6 /usr.sbin/ripd | |
parent | f5ccda6996b82c0129c5eb8249f0efbb75ff8b5a (diff) |
Sync kroute code with what we do in ospfd/bgpd (EAGAIN handling).
Diffstat (limited to 'usr.sbin/ripd')
-rw-r--r-- | usr.sbin/ripd/kroute.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c index d92d89988b5..ff66a291107 100644 --- a/usr.sbin/ripd/kroute.c +++ b/usr.sbin/ripd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.27 2015/02/09 12:34:07 claudio Exp $ */ +/* $OpenBSD: kroute.c,v 1.28 2015/02/10 08:23:13 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -1025,6 +1025,8 @@ dispatch_rtmsg(void) u_int8_t metric, prio; if ((n = read(kr_state.fd, &buf, sizeof(buf))) == -1) { + if (errno == EAGAIN || errno == EINTR) + return (0); log_warn("dispatch_rtmsg: read error"); return (-1); } @@ -1037,6 +1039,9 @@ dispatch_rtmsg(void) lim = buf + n; for (next = buf; next < lim; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)next; + if (lim < next + sizeof(*rtm) || + lim < next + rtm->rtm_msglen) + fatalx("dispatch_rtmsg: partial rtm in buffer"); if (rtm->rtm_version != RTM_VERSION) continue; |