patchpanel: correctly remove jump rules to traffic accounting chains

This patch fixes a mistake when adding or removing jump rules for
virtual or physical interfaces which was part of patch with Change-Id
I3f0e7feabea5a18f164b1fc78ef9628da4b353eb: the |op| argument was simply
ignored.

BUG=b:160112868
TEST=unit tests. Deployed patchpanel on rammus, connected and
disconnected a VPN multiple times and checked that jump rules don't
accumulate in iptables -v -t mangle -L POSTROUTING.

Change-Id: I9438eb0d97ccd3540ca2cc822352e24992e9cc97
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2586460
Tested-by: Hugo Benichi <hugobenichi@google.com>
Commit-Queue: Hugo Benichi <hugobenichi@google.com>
Reviewed-by: Jie Jiang <jiejiang@chromium.org>
diff --git a/patchpanel/counters_service_test.cc b/patchpanel/counters_service_test.cc
index 8ece81e..795d0f1 100644
--- a/patchpanel/counters_service_test.cc
+++ b/patchpanel/counters_service_test.cc
@@ -469,6 +469,21 @@
   counters_svc_->OnVpnDeviceAdded("tun0");
 }
 
+TEST_F(CountersServiceTest, OnVpnDeviceRemoved) {
+  const std::vector<std::vector<std::string>> expected_calls{
+      {"-D", "FORWARD", "-i", "ppp0", "-j", "rx_vpn", "-w"},
+      {"-D", "INPUT", "-i", "ppp0", "-j", "rx_vpn", "-w"},
+      {"-D", "POSTROUTING", "-o", "ppp0", "-j", "tx_vpn", "-w"},
+  };
+
+  for (const auto& rule : expected_calls) {
+    EXPECT_CALL(runner_, iptables("mangle", ElementsAreArray(rule), _, _));
+    EXPECT_CALL(runner_, ip6tables("mangle", ElementsAreArray(rule), _, _));
+  }
+
+  counters_svc_->OnVpnDeviceRemoved("ppp0");
+}
+
 TEST_F(CountersServiceTest, OnSameDeviceAppearAgain) {
   // Makes the chain creation commands return false (we already have these
   // rules).