summaryrefslogtreecommitdiff
path: root/usr.sbin/switchd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-10-05 15:28:16 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-10-05 15:28:16 +0000
commit9a924939bfacd51be131ddc06008124b64b4464f (patch)
tree0a7f96f61f0808513fe9255b531ebab3db7d0938 /usr.sbin/switchd
parenteb13392cb7f372d014e22231b5a78323635d1033 (diff)
I added a second buffer as fix for the fact that /dev/switch doesn't
act like a socket. Unfortunately, this broke handling of jumbo buffers in the adjusted version of ofrelay. Don't abort the connection until there is no more data to read or the connection has been closed. Problem out by rzalamena@
Diffstat (limited to 'usr.sbin/switchd')
-rw-r--r--usr.sbin/switchd/ofrelay.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.sbin/switchd/ofrelay.c b/usr.sbin/switchd/ofrelay.c
index a403d26d8ed..eacf701792b 100644
--- a/usr.sbin/switchd/ofrelay.c
+++ b/usr.sbin/switchd/ofrelay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofrelay.c,v 1.3 2016/10/05 12:01:15 reyk Exp $ */
+/* $OpenBSD: ofrelay.c,v 1.4 2016/10/05 15:28:15 reyk Exp $ */
/*
* Copyright (c) 2016 Reyk Floeter <reyk@openbsd.org>
@@ -161,10 +161,8 @@ ofrelay_event(int fd, short event, void *arg)
if ((len = ofrelay_input_close(con, rbuf, rlen)) == -1) {
error = "close input";
goto fail;
- } else if (len == 0) {
- ofrelay_close(con);
- return;
- }
+ } else if (rlen == 0)
+ error = "done";
do {
rlen = ofrelay_input(fd, event, arg);
@@ -215,8 +213,11 @@ ofrelay_input(int fd, short event, void *arg)
if ((len = ofrelay_input_close(con, ibuf, rlen)) == -1)
return (-1);
- else if (len == 0)
+ else if (rlen == 0) {
+ if (ibuf_left(ibuf))
+ return (0);
goto done;
+ }
/* After we verified the openflow header, set the size accordingly */
if (oh != NULL && (hlen + rlen) == sizeof(*oh)) {