Android-x86
Fork
Spenden

  • R/O
  • HTTP
  • SSH
  • HTTPS

system-netd: Commit

system/netd


Commit MetaInfo

Revisiond3e100d44fa61b6377203bab364bc330471da414 (tree)
Zeit2017-08-10 10:48:06
AutorLorenzo Colitti <lorenzo@goog...>
CommiterChih-Wei Huang

Log Message

Use new-style UID routing.

Kernel prebuilts for OC devices have been updated, so the legacy
attributes are not being used. Use the new attributes only. This
will ensure that devices aren't using the old code by mistake, as
any such devices will fail the VPN CTS tests.

(cherry picked from commit 882e467ff7b83de868fa0b9a9beb9036bf14aede)

Cherry-picking this to AOSP now that most external kernels have
been updated as well.

Bug: 16355602
Test: bullhead builds, boots
Test: netd_{unit,integration}_test pass
Test: has been running in internal master for several weeks.
Change-Id: I1c4e8c9281a843417a3a52294a1b7d3e6502bee6

Ändern Zusammenfassung

Diff

--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -73,12 +73,6 @@ const char* const ROUTE_TABLE_NAME_LEGACY_SYSTEM = "legacy_system";
7373 const char* const ROUTE_TABLE_NAME_LOCAL = "local";
7474 const char* const ROUTE_TABLE_NAME_MAIN = "main";
7575
76-// TODO: These values aren't defined by the Linux kernel, because legacy UID routing (as used in N
77-// and below) was not upstreamed. Now that the UID routing code is upstream, we should remove these
78-// and rely on the kernel header values.
79-const uint16_t FRA_UID_START = 18;
80-const uint16_t FRA_UID_END = 19;
81-
8276 // These values are upstream, but not yet in our headers.
8377 // TODO: delete these definitions when updating the headers.
8478 const uint16_t FRA_UID_RANGE = 20;
@@ -121,8 +115,6 @@ rtattr FRATTR_PRIORITY = { U16_RTA_LENGTH(sizeof(uint32_t)), FRA_PRIO
121115 rtattr FRATTR_TABLE = { U16_RTA_LENGTH(sizeof(uint32_t)), FRA_TABLE };
122116 rtattr FRATTR_FWMARK = { U16_RTA_LENGTH(sizeof(uint32_t)), FRA_FWMARK };
123117 rtattr FRATTR_FWMASK = { U16_RTA_LENGTH(sizeof(uint32_t)), FRA_FWMASK };
124-rtattr FRATTR_UID_START = { U16_RTA_LENGTH(sizeof(uid_t)), FRA_UID_START };
125-rtattr FRATTR_UID_END = { U16_RTA_LENGTH(sizeof(uid_t)), FRA_UID_END };
126118 rtattr FRATTR_UID_RANGE = { U16_RTA_LENGTH(sizeof(fib_rule_uid_range)), FRA_UID_RANGE };
127119
128120 rtattr RTATTR_TABLE = { U16_RTA_LENGTH(sizeof(uint32_t)), RTA_TABLE };
@@ -326,18 +318,6 @@ WARN_UNUSED_RESULT int modifyIpRule(uint16_t action, uint32_t priority, uint8_t
326318 { &fwmark, mask ? sizeof(fwmark) : 0 },
327319 { &FRATTR_FWMASK, mask ? sizeof(FRATTR_FWMASK) : 0 },
328320 { &mask, mask ? sizeof(mask) : 0 },
329- // Rules that contain both legacy and new UID routing attributes will work on old kernels,
330- // which will simply ignore the FRA_UID_RANGE attribute since it is larger than their
331- // FRA_MAX. They will also work on kernels that are not too new:
332- // - FRA_UID_START clashes with FRA_PAD in 4.7, but that shouldn't be a problem because
333- // FRA_PAD has no validation.
334- // - FRA_UID_END clashes with FRA_L3MDEV in 4.8 and above, and will cause an error because
335- // FRA_L3MDEV has a maximum length of 1.
336- // TODO: delete the legacy UID routing code before running it on 4.8 or above.
337- { &FRATTR_UID_START, isUidRule ? sizeof(FRATTR_UID_START) : 0 },
338- { &uidStart, isUidRule ? sizeof(uidStart) : 0 },
339- { &FRATTR_UID_END, isUidRule ? sizeof(FRATTR_UID_END) : 0 },
340- { &uidEnd, isUidRule ? sizeof(uidEnd) : 0 },
341321 { &FRATTR_UID_RANGE, isUidRule ? sizeof(FRATTR_UID_RANGE) : 0 },
342322 { &uidRange, isUidRule ? sizeof(uidRange) : 0 },
343323 { &fraIifName, iif != IIF_NONE ? sizeof(fraIifName) : 0 },
Show on old repository browser