diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-08-30 17:58:41 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-08-30 17:58:41 +0000 |
commit | 44d155c12dbd78c40e73fe7c1cc8684d756e0827 (patch) | |
tree | 63511a32ccd5fb43978757ae8af6a4d47662898a | |
parent | aa9b94be317f9c66f21e3ce148cd7576175f4231 (diff) |
writing to the pfkey socket can give EAGAIN and we must retry.
ok claudio hshoexer deraadt
-rw-r--r-- | usr.sbin/bgpd/pfkey.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/pfkey.c b/usr.sbin/bgpd/pfkey.c index 8c4227538cf..33196d05901 100644 --- a/usr.sbin/bgpd/pfkey.c +++ b/usr.sbin/bgpd/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.31 2004/11/10 14:48:25 claudio Exp $ */ +/* $OpenBSD: pfkey.c,v 1.32 2006/08/30 17:58:40 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -41,9 +41,9 @@ static int fd; int pfkey_reply(int, u_int32_t *); int pfkey_send(int, uint8_t, uint8_t, uint8_t, - struct bgpd_addr *, struct bgpd_addr *, - u_int32_t, uint8_t, int, char *, uint8_t, int, char *, - uint16_t, uint16_t); + struct bgpd_addr *, struct bgpd_addr *, + u_int32_t, uint8_t, int, char *, uint8_t, int, char *, + uint16_t, uint16_t); int pfkey_sa_add(struct bgpd_addr *, struct bgpd_addr *, u_int8_t, char *, u_int32_t *); int pfkey_sa_remove(struct bgpd_addr *, struct bgpd_addr *, u_int32_t *); @@ -394,13 +394,12 @@ pfkey_send(int sd, uint8_t satype, uint8_t mtype, uint8_t dir, } len = smsg.sadb_msg_len * 8; - if ((n = writev(sd, iov, iov_cnt)) == -1) { - log_warn("writev (%d/%d)", iov_cnt, len); - return (-1); - } + do { + n = writev(sd, iov, iov_cnt); + } while (n == -1 && (errno == EAGAIN || errno == EINTR)); - if (n != len) { - log_warn("writev: should=%d has=%d", len, n); + if (n == -1) { + log_warn("writev (%d/%d)", iov_cnt, len); return (-1); } |