Cleanup: Minor style fixes.
(cherry picked from commit 49d905456fd6cf730abdddb49df84d6032b0a419)
Change-Id: I199447f03ce33d79007e62e23ccf683ed4249f97
diff --git a/CommandListener.cpp b/CommandListener.cpp
index 4cb165c..122589a 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -1634,7 +1634,7 @@
if (argc < 4) {
return syntaxError(client, "Missing argument");
}
- // strtoul() returns 0 on errors, which is fine because 0 is an invalid NetId.
+ // strtoul() returns 0 on errors, which is fine because 0 is an invalid netId.
unsigned netId = strtoul(argv[2], NULL, 0);
if (!sNetCtrl->isNetIdValid(netId)) {
return paramError(client, "Invalid netId");
@@ -1657,12 +1657,12 @@
// network destroy <netId>
if (!strcmp(argv[1], "destroy")) {
if (argc < 3) {
- return syntaxError(client, "Missing argument");
+ return syntaxError(client, "Missing netId");
}
- // strtoul() returns 0 on errors, which is fine because 0 is an invalid NetId.
+ // strtoul() returns 0 on errors, which is fine because 0 is an invalid netId.
unsigned netId = strtoul(argv[2], NULL, 0);
if (!sNetCtrl->isNetIdValid(netId)) {
- return paramError(client, "Invalid NetId");
+ return paramError(client, "Invalid netId");
}
if (!sNetCtrl->destroyNetwork(netId)) {
return operationError(client, "destroyNetwork() failed");
@@ -1673,12 +1673,10 @@
// network dns <add|remove> <netId> <num-resolvers> <resolver1> .. <resolverN> [searchDomain1] .. [searchDomainM]
// network route <add|remove> <other-route-params>
// network legacy <uid> route <add|remove> <other-route-params>
- // network default set <netId> [kill-old-default's-sockets]
- // -- "kill-old-default's-sockets" is a bool
+ // network default set <netId>
// network default clear
- // -- when no interfaces are active (e.g.: airplane mode)
- // network permission set [CI] [CNS] <uid1> .. <uidN>
- // network permission clear <uid1> .. <uidN>
+ // network permission user|network set [CI] [CNS] <id1> .. <idN>
+ // network permission user|network clear <id1> .. <idN>
// network vpn create <netId> [owner_uid]
// network vpn destroy <netId>
// network <bind|unbind> <netId> <uid1> .. <uidN>
diff --git a/InterfaceController.cpp b/InterfaceController.cpp
index 0321337..e55114f 100644
--- a/InterfaceController.cpp
+++ b/InterfaceController.cpp
@@ -169,15 +169,15 @@
setOnAllInterfaces("accept_ra", value);
}
-// |table_or_offset| is interpreted as:
+// |tableOrOffset| is interpreted as:
// If == 0: default. Routes go into RT6_TABLE_MAIN.
// If > 0: user set. Routes go into the specified table.
// If < 0: automatic. The absolute value is intepreted as an offset and added to the interface
// ID to get the table. If it's set to -1000, routes from interface ID 5 will go into
// table 1005, etc.
-void InterfaceController::setAcceptRARouteTable(int table_or_offset) {
+void InterfaceController::setAcceptRARouteTable(int tableOrOffset) {
char* value;
- asprintf(&value, "%d", table_or_offset);
+ asprintf(&value, "%d", tableOrOffset);
setOnAllInterfaces("accept_ra_rt_table", value);
free(value);
}
diff --git a/InterfaceController.h b/InterfaceController.h
index 2b327fb..72ff1b6 100644
--- a/InterfaceController.h
+++ b/InterfaceController.h
@@ -48,7 +48,7 @@
int isInterfaceName(const char *name);
void setOnAllInterfaces(const char* filename, const char* value);
void setAcceptRA(const char* value);
- void setAcceptRARouteTable(int table_or_offset);
+ void setAcceptRARouteTable(int tableOrOffset);
};
#endif
diff --git a/NetworkController.h b/NetworkController.h
index c51fc3d..d0d8569 100644
--- a/NetworkController.h
+++ b/NetworkController.h
@@ -45,8 +45,8 @@
static bool isNetIdValid(unsigned netId);
- NetworkController(PermissionsController* permCtrl,
- RouteController* routeCtrl);
+ NetworkController(PermissionsController* permissionsController,
+ RouteController* routeController);
void clearNetworkPreference();
unsigned getDefaultNetwork() const;
diff --git a/RouteController.cpp b/RouteController.cpp
index 4c56226..fbd1b00 100644
--- a/RouteController.cpp
+++ b/RouteController.cpp
@@ -74,10 +74,10 @@
return false;
}
- char table_string[sizeof("0x12345678")];
- snprintf(table_string, sizeof(table_string), "0x%x", table);
+ char tableString[sizeof("0x12345678")];
+ snprintf(tableString, sizeof(tableString), "0x%x", table);
- char mark_string[sizeof("0x12345678/0x12345678")];
+ char markString[sizeof("0x12345678/0x12345678")];
const char* action = add ? ADD : DEL;
// A rule to route traffic based on an explicitly chosen network.
@@ -89,8 +89,8 @@
uint32_t fwmark = getFwmark(netId, FWMARK_USE_EXPLICIT, !FWMARK_USE_PROTECT, permission);
uint32_t mask = getFwmarkMask(FWMARK_USE_NET_ID, FWMARK_USE_EXPLICIT, !FWMARK_USE_PROTECT,
permission);
- snprintf(mark_string, sizeof(mark_string), "0x%x/0x%x", fwmark, mask);
- if (!runIpRuleCommand(action, RULE_PRIORITY_PER_NETWORK_EXPLICIT, table_string, mark_string,
+ snprintf(markString, sizeof(markString), "0x%x/0x%x", fwmark, mask);
+ if (!runIpRuleCommand(action, RULE_PRIORITY_PER_NETWORK_EXPLICIT, tableString, markString,
NULL)) {
return false;
}
@@ -101,8 +101,8 @@
// knows the outgoing interface (typically for link-local communications).
fwmark = getFwmark(0, !FWMARK_USE_EXPLICIT, !FWMARK_USE_PROTECT, permission);
mask = getFwmark(!FWMARK_USE_NET_ID, !FWMARK_USE_EXPLICIT, !FWMARK_USE_PROTECT, permission);
- snprintf(mark_string, sizeof(mark_string), "0x%x/0x%x", fwmark, mask);
- if (!runIpRuleCommand(action, RULE_PRIORITY_PER_NETWORK_OIF, table_string, mark_string,
+ snprintf(markString, sizeof(markString), "0x%x/0x%x", fwmark, mask);
+ if (!runIpRuleCommand(action, RULE_PRIORITY_PER_NETWORK_OIF, tableString, markString,
interface)) {
return false;
}
@@ -114,8 +114,8 @@
// network stay on that network even if the default network changes.
fwmark = getFwmark(netId, !FWMARK_USE_EXPLICIT, !FWMARK_USE_PROTECT, permission);
mask = getFwmarkMask(FWMARK_USE_NET_ID, !FWMARK_USE_EXPLICIT, !FWMARK_USE_PROTECT, permission);
- snprintf(mark_string, sizeof(mark_string), "0x%x/0x%x", fwmark, mask);
- if (!runIpRuleCommand(action, RULE_PRIORITY_PER_NETWORK_NORMAL, table_string, mark_string,
+ snprintf(markString, sizeof(markString), "0x%x/0x%x", fwmark, mask);
+ if (!runIpRuleCommand(action, RULE_PRIORITY_PER_NETWORK_NORMAL, tableString, markString,
NULL)) {
return false;
}
@@ -128,9 +128,9 @@
// + Mark sockets that accept connections from this interface so that the connection stays on
// the same interface.
action = add ? "-A" : "-D";
- snprintf(mark_string, sizeof(mark_string), "0x%x", netId);
+ snprintf(markString, sizeof(markString), "0x%x", netId);
if (execIptables(V4V6, "-t", "mangle", action, "INPUT", "-i", interface, "-j", "MARK",
- "--set-mark", mark_string, NULL)) {
+ "--set-mark", markString, NULL)) {
return false;
}