summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ripd
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-02-10 08:23:13 +0000
committerclaudio <claudio@openbsd.org>2015-02-10 08:23:13 +0000
commit8dddb481f401cc24791077c6061809680c1c11ad (patch)
tree002601e8ee2d9590295f24cc5a4cad3d08a98a08 /usr.sbin/ripd
parentEncode directory listings. (diff)
downloadwireguard-openbsd-8dddb481f401cc24791077c6061809680c1c11ad.tar.xz
wireguard-openbsd-8dddb481f401cc24791077c6061809680c1c11ad.zip
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.c7
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;