diff options
author | Rafael Zalamena <rzalamena@cvs.openbsd.org> | 2016-11-21 08:28:20 +0000 |
---|---|---|
committer | Rafael Zalamena <rzalamena@cvs.openbsd.org> | 2016-11-21 08:28:20 +0000 |
commit | d6f258cf3464ccffb98335df1b2181475cfc792e (patch) | |
tree | 8f65d98f2efcc32f1975c0255182b3ddc8d95e85 /sys/net | |
parent | 7445ed909173171dab6cd28f67239171bd6a21e8 (diff) |
Include the OFP header of the message that caused the error on error
messages.
ok reyk@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/switchofp.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c index 571cfd05811..ddfc5bab523 100644 --- a/sys/net/switchofp.c +++ b/sys/net/switchofp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchofp.c,v 1.34 2016/11/20 12:45:26 reyk Exp $ */ +/* $OpenBSD: switchofp.c,v 1.35 2016/11/21 08:28:19 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -4589,10 +4589,9 @@ swofp_send_error(struct switch_softc *sc, struct mbuf *m, /* Reuse mbuf from request message */ oe = mtod(m, struct ofp_error *); - len = min((ntohs(oe->err_oh.oh_length) - sizeof(struct ofp_header)), - OFP_ERRDATA_MAX); - - m_copydata(m, sizeof(struct ofp_header), len, data); + /* Save data for the response and copy back later. */ + len = min(ntohs(oe->err_oh.oh_length), OFP_ERRDATA_MAX); + m_copydata(m, 0, len, data); oe->err_oh.oh_version = OFP_V_1_3; oe->err_oh.oh_type = OFP_T_ERROR; |