On 02/15/2018 11:43 AM, Daniel P. Berrangé wrote:
Ensure all enum cases are listed in switch statements, or cast away
enum type in places where we don't wish to cover all cases.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/nwfilter/nwfilter_ebiptables_driver.c | 16 +++++++++++-----
src/nwfilter/nwfilter_learnipaddr.c | 6 +++++-
2 files changed, 16 insertions(+), 6 deletions(-)
[...]
diff --git a/src/nwfilter/nwfilter_learnipaddr.c
b/src/nwfilter/nwfilter_learnipaddr.c
index 5b95f0e613..9ca0639576 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -430,7 +430,7 @@ learnIPAddressThread(void *arg)
}
virBufferAddLit(&buf, "src port 67 and dst port 68");
break;
- default:
+ case DETECT_STATIC:
if (techdriver->applyBasicRules(req->ifname,
&req->macaddr) < 0) {
req->status = EINVAL;
@@ -438,6 +438,10 @@ learnIPAddressThread(void *arg)
}
virBufferAsprintf(&buf, "ether host %s or ether dst
ff:ff:ff:ff:ff:ff",
macaddr);
+ break;
+ default:
+ req->status = EINVAL;
+ goto done;
Could add a VIR_DEBUG() in this just to "track" the reason it was EINVAL
since there's so many ways it could be EINVAL, not that important...
}
if (virBufferError(&buf)) {
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John