summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2017-01-17 09:21:51 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2017-01-17 09:21:51 +0000
commit24861dea0c7235feec9d87f7ead65507e6b6c708 (patch)
treeff47b965020a786b6223ad5f7eb1b3d3f740db25
parent532db86ef41cdec4a759d45fef27500d12b36522 (diff)
Fix OXM parser for set-field messages. Found it the hardway while
testing set-field configuration.
-rw-r--r--usr.sbin/switchd/ofp13.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/switchd/ofp13.c b/usr.sbin/switchd/ofp13.c
index e16381bf5ad..9d49e4e886e 100644
--- a/usr.sbin/switchd/ofp13.c
+++ b/usr.sbin/switchd/ofp13.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp13.c,v 1.42 2016/12/22 15:31:43 rzalamena Exp $ */
+/* $OpenBSD: ofp13.c,v 1.43 2017/01/17 09:21:50 rzalamena Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -791,15 +791,15 @@ ofp13_validate_action(struct switchd *sc, struct ofp_header *oh,
print_map(type, ofp_action_map), len);
len -= sizeof(*asf) - sizeof(asf->asf_field);
- while (len) {
+ while (len > 0) {
if ((oxm = ibuf_seek(ibuf, moff, sizeof(*oxm)))
== NULL)
return (-1);
if (ofp13_validate_oxm(sc, oxm, oh, ibuf, moff) == -1)
return (-1);
- len -= sizeof(*oxm) - oxm->oxm_length;
- moff += sizeof(*oxm) - oxm->oxm_length;
+ len -= sizeof(*oxm) + oxm->oxm_length;
+ moff += sizeof(*oxm) + oxm->oxm_length;
}
break;