Don't complain when deleting non-existent tethering rules.
clearTetheringRules ignores errors when deleting rules,
because tethering rules don't exist unless tethering was
enabled on the interface. sendNetlinkRequest shouldn't log an
error in this case, since the caller is ignoring that error.
Bug: 34873832
Test: bullhead builds, boots, spurious error messages gone
Change-Id: Ib327e8a3aecd3a38d624baa8bf320da87e6c4f7c
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index 19907eb..87b0043 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -312,8 +312,12 @@
for (size_t i = 0; i < ARRAY_SIZE(AF_FAMILIES); ++i) {
rule.family = AF_FAMILIES[i];
if (int ret = sendNetlinkRequest(action, flags, iov, ARRAY_SIZE(iov))) {
- ALOGE("Error %s %s rule: %s", actionName(action), familyName(rule.family),
- strerror(-ret));
+ if (!(action == RTM_DELRULE && ret == -ENOENT && priority == RULE_PRIORITY_TETHERING)) {
+ // Don't log when deleting a tethering rule that's not there. This matches the
+ // behaviour of clearTetheringRules, which ignores ENOENT in this case.
+ ALOGE("Error %s %s rule: %s", actionName(action), familyName(rule.family),
+ strerror(-ret));
+ }
return ret;
}
}