diff options
author | bluhm <bluhm@openbsd.org> | 2015-07-18 22:33:46 +0000 |
---|---|---|
committer | bluhm <bluhm@openbsd.org> | 2015-07-18 22:33:46 +0000 |
commit | 5edb47cb1a80d1f13daf331eb009ea4d70796f34 (patch) | |
tree | 9f16a44fb4e07c1a3db1534a81aa1f88737ee5da | |
parent | Remove repeated code in dtls1_get_record. (diff) | |
download | wireguard-openbsd-5edb47cb1a80d1f13daf331eb009ea4d70796f34.tar.xz wireguard-openbsd-5edb47cb1a80d1f13daf331eb009ea4d70796f34.zip |
As libtls previously did not set SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER,
syslogd had to drop messages after tls_write() returned
TLS_{READ,WRITE}_AGAIN. Now after libtls has been fixed, remove
the workaround. Messages are stored in the libevent write buffer
as we can safely do a realloc(3) now.
OK reyk@
-rw-r--r-- | usr.sbin/syslogd/evbuffer_tls.c | 5 | ||||
-rw-r--r-- | usr.sbin/syslogd/evbuffer_tls.h | 4 | ||||
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 18 |
3 files changed, 4 insertions, 23 deletions
diff --git a/usr.sbin/syslogd/evbuffer_tls.c b/usr.sbin/syslogd/evbuffer_tls.c index 6c164bdf67c..4514e0c14e8 100644 --- a/usr.sbin/syslogd/evbuffer_tls.c +++ b/usr.sbin/syslogd/evbuffer_tls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evbuffer_tls.c,v 1.4 2015/07/06 16:12:16 millert Exp $ */ +/* $OpenBSD: evbuffer_tls.c,v 1.5 2015/07/18 22:33:46 bluhm Exp $ */ /* * Copyright (c) 2002-2004 Niels Provos <provos@citi.umich.edu> @@ -185,7 +185,6 @@ buffertls_writecb(int fd, short event, void *arg) if (res <= 0) goto error; } - buftls->bt_flags &= ~BT_WRITE_AGAIN; event_set(&bufev->ev_write, fd, EV_WRITE, buffertls_writecb, buftls); if (EVBUFFER_LENGTH(bufev->output) != 0) @@ -202,7 +201,6 @@ buffertls_writecb(int fd, short event, void *arg) return; reschedule: - buftls->bt_flags |= BT_WRITE_AGAIN; if (EVBUFFER_LENGTH(bufev->output) != 0) bufferevent_add(&bufev->ev_write, bufev->timeout_write); return; @@ -277,7 +275,6 @@ buffertls_set(struct buffertls *buftls, struct bufferevent *bufev, event_set(&bufev->ev_write, fd, EV_WRITE, buffertls_writecb, buftls); buftls->bt_bufev = bufev; buftls->bt_ctx = ctx; - buftls->bt_flags = 0; } void diff --git a/usr.sbin/syslogd/evbuffer_tls.h b/usr.sbin/syslogd/evbuffer_tls.h index e28ed53cc6b..d895808947f 100644 --- a/usr.sbin/syslogd/evbuffer_tls.h +++ b/usr.sbin/syslogd/evbuffer_tls.h @@ -1,4 +1,4 @@ -/* $OpenBSD: evbuffer_tls.h,v 1.2 2015/02/20 00:56:32 bluhm Exp $ */ +/* $OpenBSD: evbuffer_tls.h,v 1.3 2015/07/18 22:33:46 bluhm Exp $ */ /* * Copyright (c) 2014-2015 Alexander Bluhm <bluhm@openbsd.org> @@ -28,8 +28,6 @@ struct buffertls { struct bufferevent *bt_bufev; struct tls *bt_ctx; const char *bt_hostname; - int bt_flags; -#define BT_WRITE_AGAIN 0x1 }; void buffertls_set(struct buffertls *, struct bufferevent *, struct tls *, diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index eb762595cbb..89e14064205 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.173 2015/07/16 23:29:14 bluhm Exp $ */ +/* $OpenBSD: syslogd.c,v 1.174 2015/07/18 22:33:46 bluhm Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -1498,22 +1498,8 @@ fprintlog(struct filed *f, int flags, char *msg) } break; - case F_FORWTLS: - if (f->f_un.f_forw.f_buftls.bt_flags & BT_WRITE_AGAIN) { - /* - * After an OpenSSL SSL_ERROR_WANT_WRITE you must not - * modify the buffer pointer or length until the next - * successful write. Otherwise there will be an - * error SSL3_WRITE_PENDING:bad write retry. - * XXX This should be handled in the buffertls layer. - */ - dprintf(" %s (dropped tls write again)\n", - f->f_un.f_forw.f_loghost); - f->f_un.f_forw.f_dropped++; - break; - } - /* FALLTHROUGH */ case F_FORWTCP: + case F_FORWTLS: dprintf(" %s", f->f_un.f_forw.f_loghost); if (EVBUFFER_LENGTH(f->f_un.f_forw.f_bufev->output) >= MAX_TCPBUF) { |