Support reading output from IptablesRestoreController.
Add the ability to IptablesRestoreController to return the output
of a command. This is useful to run commands that list chains or
return counters through the ip[6]tables-restore.
Also enable unsigned-integer-overflow sanitization the unit tests
because their behaviour should be representative of actual code.
Having address sanitization enabled would have saved a fair
amount of time debugging an on-device abort() that did not affect
the tests.
Test: new unit test passes
Bug: 32323979
Change-Id: I70726ebbade0cb792aba38787c57378df177f2d8
diff --git a/server/NetdConstants.h b/server/NetdConstants.h
index f283ed0..668b9be 100644
--- a/server/NetdConstants.h
+++ b/server/NetdConstants.h
@@ -45,6 +45,8 @@
int execIptables(IptablesTarget target, ...);
int execIptablesSilently(IptablesTarget target, ...);
int execIptablesRestore(IptablesTarget target, const std::string& commands);
+int execIptablesRestoreWithOutput(IptablesTarget target, const std::string& commands,
+ std::string *output);
bool isIfaceName(const char *name);
int parsePrefix(const char *prefix, uint8_t *family, void *address, int size, uint8_t *prefixlen);