summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2022-06-15 10:32:11 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-06-15 10:32:11 +0000
commit3a7ad976a5131cd33c1382074b2476a5c61b0fad (patch)
tree6fe018586663316989ca4d8fec2e5155ff85cb47
parent2bb5a8cd48a94931fcf831f5001c979a2a82d6cf (diff)
parentfbe4c75593f486c4c9307349c7189737876aab40 (diff)
downloadnetd-3a7ad976a5131cd33c1382074b2476a5c61b0fad.tar.gz
netd: make BandwidthController startup failures terminal am: 92d5157c62 am: fbe4c75593
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/netd/+/18906439 Change-Id: I89b39d1b2a19d1a1d13e2e91694125c9e793e596 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--server/Controllers.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/Controllers.cpp b/server/Controllers.cpp
index 0df6b0ee..00ee186d 100644
--- a/server/Controllers.cpp
+++ b/server/Controllers.cpp
@@ -277,7 +277,15 @@ void Controllers::init() {
initIptablesRules();
Stopwatch s;
- bandwidthCtrl.enableBandwidthControl();
+ if (int ret = bandwidthCtrl.enableBandwidthControl()) {
+ gLog.error("Failed to initialize BandwidthController (%s)", strerror(-ret));
+ // A failure to init almost definitely means that iptables failed to load
+ // our static ruleset, which then basically means network accounting will not work.
+ // As such simply exit netd. This may crash loop the system, but by failing
+ // to bootup we will trigger rollback and thus this offers us protection against
+ // a mainline update breaking things.
+ exit(1);
+ }
gLog.info("Enabling bandwidth control: %" PRId64 "us", s.getTimeAndResetUs());
if (int ret = RouteController::Init(NetworkController::LOCAL_NET_ID)) {