Improve iptables timeout behaviour.
1. Increase the default timeout from 1s to 5s. This is necessary
for as long as our version of iptables sleeps for 1 second at
a time while the iptables lock is contended.
2. When a timeout occurs, kill the process to ensure that if it
recovers, any output is not returned to subsequent commands.
Add corresponding unit tests.
While I'm at it:
- Ensure that iptables commands that take an output string clear
the output string before appending to it. Otherwise, callers
that passed the same output string object to two separate
iptables commands would think the second command returned both
outputs. This does not affect any existing callers.
- Delete some unused code.
Bug: 35634318
Test: netd_{unit,integration}_test pass
Change-Id: Ife3dfd328ea82f2e93fb903fcf3660a13078b7b5
3 files changed