BandwidthController: fix bad flushing for bw_costly_* tables.

Some of the bw_costly_<iface> rules would not get correctly flushed and
cleared on netd re-start, which would cause a failure when trying to
setup the bw_penalty_box as bw_costly_<iface> would reference it.
The resulting symptom would be that bandwidth could not be re-enabled.

Bug: 10183445
Change-Id: I79a8a73ae52e18b3bff8a58e47ac1aea2454ae63
diff --git a/BandwidthController.h b/BandwidthController.h
index 3953e26..74e595c 100644
--- a/BandwidthController.h
+++ b/BandwidthController.h
@@ -164,6 +164,22 @@
     static int parseForwardChainStats(SocketClient *cli, const TetherStats filter, FILE *fp,
                                       std::string &extraProcessingInfo);
 
+    /*
+     * Attempt to find the bw_costly_* tables that need flushing,
+     * and flush them.
+     * If doClean then remove the tables also.
+     * Deals with both ip4 and ip6 tables.
+     */
+    void flushExistingCostlyTables(bool doClean);
+    static void parseAndFlushCostlyTables(FILE *fp, bool doRemove);
+
+    /*
+     * Attempt to flush our tables.
+     * If doClean then remove them also.
+     * Deals with both ip4 and ip6 tables.
+     */
+    void flushCleanTables(bool doClean);
+
     /*------------------*/
 
     std::list<std::string> sharedQuotaIfaces;