From: claudio Date: Wed, 15 Jun 2022 16:00:37 +0000 (+0000) Subject: Prevent busy poll loop on pfkey message error. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d542978219e5229e0ff7dd36423fc4b5b924f356;p=openbsd Prevent busy poll loop on pfkey message error. When pfkey_reply() detects an error in a message it needs to flush that message out of the buffer because pfkey_read() only did a peak read. OK tb@ --- diff --git a/usr.sbin/bgpd/pfkey.c b/usr.sbin/bgpd/pfkey.c index 6da7de6519c..fafef64b98f 100644 --- a/usr.sbin/bgpd/pfkey.c +++ b/usr.sbin/bgpd/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.63 2022/06/15 14:09:30 claudio Exp $ */ +/* $OpenBSD: pfkey.c,v 1.64 2022/06/15 16:00:37 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -469,6 +469,9 @@ pfkey_reply(int sd, uint32_t *spi) return (0); else { log_warn("pfkey"); + /* discard error message */ + if (read(sd, &hdr, sizeof(hdr)) == -1) + log_warn("pfkey read"); return (-1); } }