Android-x86
Fork
Spenden

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-netd: Commit

system/netd


Commit MetaInfo

Revision058d949f4020e0244ed4c6aeb1bb7c3890c085b7 (tree)
Zeit2019-10-22 15:52:34
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86

Ändern Zusammenfassung

Diff

--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -303,6 +303,7 @@ int BandwidthController::enableBandwidthControl(bool force) {
303303 sharedQuotaBytes = sharedAlertBytes = 0;
304304
305305 restrictAppUidsOnData.clear();
306+ restrictAppUidsOnVpn.clear();
306307 restrictAppUidsOnWlan.clear();
307308
308309 flushCleanTables(false);
@@ -399,6 +400,11 @@ int BandwidthController::manipulateRestrictAppsOnWlan(const char *iface, int num
399400 return manipulateRestrictAppsInOut(iface, numUids, appUids, appOp, restrictAppUidsOnWlan);
400401 }
401402
403+int BandwidthController::manipulateRestrictAppsOnVpn(const char *iface, int numUids, char *appUids[],
404+ RestrictAppOp appOp) {
405+ return manipulateRestrictAppsInOut(iface, numUids, appUids, appOp, restrictAppUidsOnVpn);
406+}
407+
402408 int BandwidthController::manipulateRestrictAppsInOut(const char *iface, int numUids, char *appUids[],
403409 RestrictAppOp appOp, std::list<int /*appUid*/> &restrictAppUids) {
404410 char *chain;
@@ -436,6 +442,14 @@ int BandwidthController::removeRestrictAppsOnWlan(const char *iface,int numUids,
436442 return manipulateRestrictAppsOnWlan(iface, numUids, appUids, RestrictAppOpRemove);
437443 }
438444
445+int BandwidthController::addRestrictAppsOnVpn(const char *iface, int numUids, char *appUids[]) {
446+ return manipulateRestrictAppsOnVpn(iface, numUids, appUids, RestrictAppOpAdd);
447+}
448+
449+int BandwidthController::removeRestrictAppsOnVpn(const char *iface,int numUids, char *appUids[]) {
450+ return manipulateRestrictAppsOnVpn(iface, numUids, appUids, RestrictAppOpRemove);
451+}
452+
439453
440454 int BandwidthController::manipulateRestrictApps(int numUids, char *appStrUids[],
441455 const char *chain,
--- a/server/BandwidthController.h
+++ b/server/BandwidthController.h
@@ -104,6 +104,9 @@ public:
104104 int addRestrictAppsOnWlan(const char *iface, int numUids, char *appUids[]);
105105 int removeRestrictAppsOnWlan(const char *iface, int numUids, char *appUids[]);
106106
107+ int addRestrictAppsOnVpn(const char *iface, int numUids, char *appUids[]);
108+ int removeRestrictAppsOnVpn(const char *iface, int numUids, char *appUids[]);
109+
107110 /*
108111 * For single pair of ifaces, stats should have ifaceIn and ifaceOut initialized.
109112 * For all pairs, stats should have ifaceIn=ifaceOut="".
@@ -153,6 +156,8 @@ protected:
153156 RestrictAppOp appOp);
154157 int manipulateRestrictAppsOnWlan(const char *iface, int numUids, char* appStrUids[],
155158 RestrictAppOp appOp);
159+ int manipulateRestrictAppsOnVpn(const char *iface, int numUids, char* appStrUids[],
160+ RestrictAppOp appOp);
156161 int manipulateRestrictAppsInOut(const char *iface, int numUids, char *appUids[],
157162 RestrictAppOp appOp,
158163 std::list<int /*appUid*/> &restrictAppUids);
@@ -250,6 +255,7 @@ protected:
250255
251256 std::list<int /*appUid*/> restrictAppUidsOnData;
252257 std::list<int /*appUid*/> restrictAppUidsOnWlan;
258+ std::list<int /*appUid*/> restrictAppUidsOnVpn;
253259 };
254260
255261 #endif
--- a/server/CommandListener.cpp
+++ b/server/CommandListener.cpp
@@ -1298,6 +1298,24 @@ int CommandListener::BandwidthControlCmd::runCommand(SocketClient *cli, int argc
12981298 sendGenericOkFail(cli, rc);
12991299 return 0;
13001300 }
1301+ if (!strcmp(argv[1], "addrestrictappsonvpn")) {
1302+ if (argc < 4) {
1303+ sendGenericSyntaxError(cli, "addrestrictappsonvpn <interface> <appUid> ...");
1304+ return 0;
1305+ }
1306+ int rc = gCtls->bandwidthCtrl.addRestrictAppsOnVpn(argv[2], argc - 3, argv + 3);
1307+ sendGenericOkFail(cli, rc);
1308+ return 0;
1309+ }
1310+ if (!strcmp(argv[1], "removerestrictappsonvpn")) {
1311+ if (argc < 4) {
1312+ sendGenericSyntaxError(cli, "removerestrictappsonvpn <inteface> <appUid> ...");
1313+ return 0;
1314+ }
1315+ int rc = gCtls->bandwidthCtrl.removeRestrictAppsOnVpn(argv[2], argc - 3, argv + 3);
1316+ sendGenericOkFail(cli, rc);
1317+ return 0;
1318+ }
13011319 if (!strcmp(argv[1], "addrestrictappsonwlan")) {
13021320 if (argc < 4) {
13031321 sendGenericSyntaxError(cli, "addrestrictappsonwlan <interface> <appUid> ...");
Show on old repository browser