patchpanel: Move wwan masquerade from script
BUG=b:156200410
TEST=units
Change-Id: I7397b98c1cbed74eea0debaff1ad2c918e7be318
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2214844
Tested-by: Garrick Evans <garrick@chromium.org>
Commit-Queue: Garrick Evans <garrick@chromium.org>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
diff --git a/patchpanel/manager.cc b/patchpanel/manager.cc
index ff64967..c77cf03 100644
--- a/patchpanel/manager.cc
+++ b/patchpanel/manager.cc
@@ -254,6 +254,13 @@
<< " connections.";
}
+ // TODO(chromium:898210): Move interface-specific masquerading setup to shill;
+ // such that we can better set up the masquerade rules based on connection
+ // type rather than interface names.
+ if (!datapath_->AddInterfaceSNAT("wwan+")) {
+ LOG(ERROR) << "Failed to set up wifi masquerade";
+ }
+
routing_svc_ = std::make_unique<RoutingService>();
nd_proxy_->RegisterDeviceMessageHandler(base::Bind(
@@ -285,6 +292,7 @@
for (const int fdkey : connected_namespaces_fdkeys)
DisconnectNamespace(fdkey);
+ datapath_->RemoveInterfaceSNAT("wwan+");
datapath_->RemoveForwardEstablishedRule();
datapath_->RemoveSNATMarkRules();