diff options
author | Maciej Żenczykowski <maze@google.com> | 2022-06-14 16:49:58 -0700 |
---|---|---|
committer | Maciej Żenczykowski <maze@google.com> | 2022-06-14 16:50:38 -0700 |
commit | 38e049f7f434ace9f977a7a72e939558e5f373a9 (patch) | |
tree | 3209bd2a2a4ca8abc7235953b2b3da9d35bb5d8c /server | |
parent | 1d353c0695d63e0015826f0232c5984a9f3b40a3 (diff) | |
download | netd-38e049f7f434ace9f977a7a72e939558e5f373a9.tar.gz |
netd: make BandwidthController startup failures terminal
Bug: 235778483
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic6ddf0ca1cda26c27be3bbdbebfde64b02dc2c83
Diffstat (limited to 'server')
-rw-r--r-- | server/Controllers.cpp | 10 |
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)) { |