Commit Graph

335 Commits

Author SHA1 Message Date
Lorenzo Colitti
c6e953bbbe [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 -s ours am: a33bf42216 -s ours am: 83eb974bed -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ieba7b5f26d5d260a771aa68adc6d836f72f36416
2020-03-27 15:04:20 +00:00
Lorenzo Colitti
ac2d52bf46 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours am: 54e8d7400a -s ours am: 2ed1da60c0 -s ours am: 74d5e47013 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: I2635edf03e157c0c139e7539c72fd80d41292767
2020-03-27 15:03:18 +00:00
Lorenzo Colitti
83eb974bed [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 -s ours am: a33bf42216 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ia5bd44f2cd6688e39545a25e9ec243d618c9b5f8
2020-03-27 14:46:08 +00:00
Lorenzo Colitti
74d5e47013 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours am: 54e8d7400a -s ours am: 2ed1da60c0 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: Ibf33a1079bab67b51f51d68584e5236b7164361b
2020-03-27 14:45:45 +00:00
Lorenzo Colitti
a33bf42216 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f am: 6b4862dfc8 -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 bc7ff5d89f is in history

Change-Id: Ib0e588434a8dd04280ef0df1f8f2d3abdfeff7a3
2020-03-27 14:35:52 +00:00
Lorenzo Colitti
2ed1da60c0 [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours am: 54e8d7400a -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: I535ef517fd18b84e1b4f1823c656ac14bc798f00
2020-03-27 14:35:09 +00:00
Lorenzo Colitti
54e8d7400a [automerger skipped] Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f -s ours
am skip reason: Change-Id Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25 with SHA-1 dd397f58c7 is in history

Change-Id: I551191401ef145f60ce43992dc1130cda0d62838
2020-03-27 14:17:55 +00:00
Lorenzo Colitti
6b4862dfc8 Fix querying Ethernet availability for unprivileged callers. am: bc7ff5d89f
Change-Id: I7b670de0724e00ee48fe234b2bd193501c7c783c
2020-03-27 14:17:36 +00:00
Lorenzo Colitti
bc7ff5d89f Fix querying Ethernet availability for unprivileged callers.
Both EthernetManager#getAvailableInterfaces() and the no-arg
version of EthernetManager#isAvailable() end up calling
EthernetServiceImpl#getAvailableInterfaces. This method attempts
to filter out restricted interfaces if the caller does not have
the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission.

Unfortunately EthernetNetworkFactory's notion of a restricted
interface is the opposite of what it should be. This means that
while privileged callers can see all interfaces, unprivileged
callers can only see restricted interfaces which they cannot use.

Fix this by correcting NetworkInterfaceState#isRestricted(), so
that unprivileged callers can see only unrestricted interfaces.
Privileged callers are unaffected.

This bug probably went unnoticed because restricted Ethernet
interfaces are rare (likely used only on auto devices) and
because the callers that care about those restricted interfaces
are generally privileged.

Bug: 148824036
Test: atest android.net.EthernetTetheringTest#testPhysicalEthernet
Merged-In: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
Change-Id: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
2020-03-27 11:38:33 +00:00
Lorenzo Colitti
d9057192f9 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da am: 6b41e255c6 am: 1ba2a5d379 am: 8114585265
Change-Id: I6482151348ef71c63babbcb42fac4c70e37df457
2020-03-27 09:54:58 +00:00
Lorenzo Colitti
8114585265 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da am: 6b41e255c6 am: 1ba2a5d379
Change-Id: If1deb6bb0050c01046aa2b3f951a0f7f518c31bc
2020-03-27 09:36:54 +00:00
Lorenzo Colitti
1ba2a5d379 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da am: 6b41e255c6
Change-Id: Ib4491ccd852bdb0fa8ad93e031239714239c1a4a
2020-03-27 09:18:12 +00:00
Lorenzo Colitti
6b41e255c6 Fix querying Ethernet availability for unprivileged callers. am: dd397f58c7 am: 4ff97e70da
Change-Id: I125e0f6c3ed7005cba55cefc0872d55262fcd596
2020-03-27 09:06:27 +00:00
Lorenzo Colitti
dd397f58c7 Fix querying Ethernet availability for unprivileged callers.
Both EthernetManager#getAvailableInterfaces() and the no-arg
version of EthernetManager#isAvailable() end up calling
EthernetServiceImpl#getAvailableInterfaces. This method attempts
to filter out restricted interfaces if the caller does not have
the CONNECTIVITY_USE_RESTRICTED_NETWORKS permission.

Unfortunately EthernetNetworkFactory's notion of a restricted
interface is the opposite of what it should be. This means that
while privileged callers can see all interfaces, unprivileged
callers can only see restricted interfaces which they cannot use.

Fix this by correcting NetworkInterfaceState#isRestricted(), so
that unprivileged callers can see only unrestricted interfaces.
Privileged callers are unaffected.

This bug probably went unnoticed because restricted Ethernet
interfaces are rare (likely used only on auto devices) and
because the callers that care about those restricted interfaces
are generally privileged.

Bug: 148824036
Test: atest android.net.EthernetTetheringTest#testPhysicalEthernet
Change-Id: Idff3b05a193a80c581d80d0e4fe9c2d3fc0d8a25
2020-03-26 22:53:10 +09:00
Lorenzo Colitti
06837245b4 Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a am: b8327f43aa am: cbbac4940d am: 56355a75c2
Change-Id: I061dd55de0bd71a30bc57efa50e4bf235ab8a715
2020-03-26 10:48:22 +00:00
Lorenzo Colitti
56355a75c2 Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a am: b8327f43aa am: cbbac4940d
Change-Id: I21e3c0cc4bc64c540fc0e19590b4b143bce8215a
2020-03-26 10:35:33 +00:00
Lorenzo Colitti
cbbac4940d Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a am: b8327f43aa
Change-Id: Id4e2753b445edd6fe719441b501337ff2df8f23f
2020-03-26 10:24:20 +00:00
Lorenzo Colitti
b8327f43aa Don't call maybeTrackInterface on the wrong thread. am: bd66333a24 am: fbe05a3c1a
Change-Id: Ib032004882f40dcdb8f1614a2b1f0ec97dd153e4
2020-03-26 09:58:55 +00:00
Lorenzo Colitti
bd66333a24 Don't call maybeTrackInterface on the wrong thread.
Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Change-Id: Ia2cb265f8d4de96210f1462339c10ad2947eec65
2020-03-26 17:02:27 +09:00
Lorenzo Colitti
bd102e3b6f [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c am: 87c64dc6b3 am: c9fb72bbe0 -s ours am: d0b200b5b0 -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 0c30d949df is in history

Change-Id: Icceed0b6b2054b28d8e3ad07728fcbb53b31262d
2020-03-20 02:39:54 +00:00
Lorenzo Colitti
a7bfa6d070 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d am: ac350dddc6 am: 4d5310692c -s ours am: b284c51425 -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 876e5e16a9 is in history

Change-Id: I2193378052b1309503b77023da14917810e48e41
2020-03-20 02:39:47 +00:00
Lorenzo Colitti
f9d5f19a7f [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df -s ours am: b6c727b208 -s ours am: 0f0c14b99b -s ours am: 6b6c525b6e -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 0c30d949df is in history

Change-Id: Idfd895c4ffb29b3caa15b5a7f86f9ff9758c30de
2020-03-20 02:39:40 +00:00
Lorenzo Colitti
8394764577 [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c -s ours am: 84fea4258b -s ours am: 41451e4503 -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 165b456d92 is in history

Change-Id: Ifadbf3a7cc72bc3dd0067519571e80e669b010d1
2020-03-20 02:39:34 +00:00
Lorenzo Colitti
c542442fd4 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d -s ours am: 4c80e73bfa -s ours am: 7f312a0274 -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 876e5e16a9 is in history

Change-Id: If9d19fa5ad7ea5a49c5c0fc8d2fb53ef90283d7b
2020-03-20 02:39:21 +00:00
Lorenzo Colitti
0ec7789542 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 -s ours am: 6fb426f10a -s ours am: f7bc865d2c -s ours am: b7e2baaee0 -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 e81f99d532 is in history

Change-Id: I47dbc0ccdf9357ef85f2d9e389e0fe47a774b1bd
2020-03-20 02:39:05 +00:00
Lorenzo Colitti
d0b200b5b0 [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c am: 87c64dc6b3 am: c9fb72bbe0 -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 0c30d949df is in history

Change-Id: Ia636dce7ecaba574d55352391d99f88224221a49
2020-03-20 02:39:02 +00:00
Lorenzo Colitti
b284c51425 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d am: ac350dddc6 am: 4d5310692c -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 876e5e16a9 is in history

Change-Id: I7f7417ccca7c9cfac332954a6f6dea5a58a54239
2020-03-20 02:38:56 +00:00
Lorenzo Colitti
6b6c525b6e [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df -s ours am: b6c727b208 -s ours am: 0f0c14b99b -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 0c30d949df is in history

Change-Id: I1b6127eb68cb3986726ea460c84352c8b23e1e2e
2020-03-20 02:16:28 +00:00
Lorenzo Colitti
41451e4503 [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c -s ours am: 84fea4258b -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 165b456d92 is in history

Change-Id: I9760fbf2fb0612ed6403c12c7cba213a2f460c74
2020-03-20 02:16:18 +00:00
Lorenzo Colitti
7f312a0274 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d -s ours am: 4c80e73bfa -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 876e5e16a9 is in history

Change-Id: I53d8a9896257920d4a3db462a7f3a1c8974361fa
2020-03-20 02:16:13 +00:00
Lorenzo Colitti
b7e2baaee0 [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 -s ours am: 6fb426f10a -s ours am: f7bc865d2c -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 e81f99d532 is in history

Change-Id: I9cea9b849fff6b292d81b6bd2a1c8338d3d271a1
2020-03-20 02:16:02 +00:00
Lorenzo Colitti
c9fb72bbe0 Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c am: 87c64dc6b3
Change-Id: Ide34e6cff966a9cd01948a4cb030f4d256cf1782
2020-03-20 02:15:58 +00:00
Lorenzo Colitti
4d5310692c Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d am: ac350dddc6
Change-Id: Ifad7deba00f8e40a50014ec5922ecb9fae465188
2020-03-20 02:15:35 +00:00
Lorenzo Colitti
0f0c14b99b [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df -s ours am: b6c727b208 -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 0c30d949df is in history

Change-Id: I799d401c9dbb64031ee0601bfbb869588c2843dc
2020-03-20 01:17:22 +00:00
Lorenzo Colitti
84fea4258b [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 165b456d92 is in history

Change-Id: I36f91fca0d679a9673b743be953f191e16440330
2020-03-20 01:17:04 +00:00
Lorenzo Colitti
87c64dc6b3 Send tethered interface callbacks based on interface existence. am: 0c30d949df am: 32a1f9a35c
Change-Id: I4ff59ff4ff51b312ff66afa42fae660775dda987
2020-03-20 01:17:01 +00:00
Lorenzo Colitti
4c80e73bfa [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 876e5e16a9 is in history

Change-Id: Ie8adbc5239fdf8343a9b0e4cd30eddc28e96caaa
2020-03-20 01:16:55 +00:00
Lorenzo Colitti
ac350dddc6 Support setting the default interface to null again. am: 876e5e16a9 am: 65c1bc7c5d
Change-Id: I957babd740b0cef5f437467af7ebcac5fb373350
2020-03-20 01:16:54 +00:00
Lorenzo Colitti
f7bc865d2c [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 -s ours am: 6fb426f10a -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 e81f99d532 is in history

Change-Id: I53102631b3030ba3307c2ffe04d340c9421fc50b
2020-03-20 01:09:43 +00:00
Lorenzo Colitti
b6c727b208 [automerger skipped] Send tethered interface callbacks based on interface existence. am: 0c30d949df -s ours
am skip reason: Change-Id I015219cbd03626c38fb5156d0cb2991ba7d7def7 with SHA-1 165b456d92 is in history

Change-Id: I798052af6ff6704c9088c3e0f2952b1ccc41d94b
2020-03-20 00:45:05 +00:00
Lorenzo Colitti
32a1f9a35c Send tethered interface callbacks based on interface existence. am: 0c30d949df
Change-Id: I34e7e1ee8e1cbceb8f3941543dac9299e96a7e27
2020-03-20 00:44:59 +00:00
Lorenzo Colitti
6fb426f10a [automerger skipped] Support setting the default interface to null again. am: 876e5e16a9 -s ours
am skip reason: Change-Id I5109d8da3aeb6c1f6523291d9e2ec92c64b5ad2d with SHA-1 e81f99d532 is in history

Change-Id: I3adadae13ef96c50e4083b8d826730e0fb4990fd
2020-03-20 00:44:57 +00:00
Lorenzo Colitti
65c1bc7c5d Support setting the default interface to null again. am: 876e5e16a9
Change-Id: I88a98acb57b48fb9eedf104ed783a7d27b12e47f
2020-03-20 00:44:42 +00:00
Lorenzo Colitti
5290db53dc Send tethered interface callbacks based on interface existence. am: 165b456d92 am: cad2e49acb am: 3449a34474 am: 4615bbe667 am: fc26b8e236
Change-Id: I9d9cef3df3e7968d67214d586f32f9fe822c1d17
2020-03-19 16:47:03 +00:00
Lorenzo Colitti
46f4fd131b Support setting the default interface to null again. am: e81f99d532 am: e19d6a8764 am: 4b10eea44f am: a79245c7f0 am: 32db6f52cb
Change-Id: I940246a177a7ebe51ebea4e33f12257ba7846fbc
2020-03-19 16:46:53 +00:00
Lorenzo Colitti
fc26b8e236 Send tethered interface callbacks based on interface existence. am: 165b456d92 am: cad2e49acb am: 3449a34474 am: 4615bbe667
Change-Id: I3303d8506a0d715a60843f9073cfd104b286372a
2020-03-19 16:27:47 +00:00
Lorenzo Colitti
32db6f52cb Support setting the default interface to null again. am: e81f99d532 am: e19d6a8764 am: 4b10eea44f am: a79245c7f0
Change-Id: Ie4bd5ae4c939a19dd95e3a51ebb67b4833d0a8ba
2020-03-19 16:27:43 +00:00
Lorenzo Colitti
4615bbe667 Send tethered interface callbacks based on interface existence. am: 165b456d92 am: cad2e49acb am: 3449a34474
Change-Id: Iac66c95f07fe81d5c9e1b5dfcd42fe676ea2bc70
2020-03-19 16:16:22 +00:00
Lorenzo Colitti
a79245c7f0 Support setting the default interface to null again. am: e81f99d532 am: e19d6a8764 am: 4b10eea44f
Change-Id: I0633a83170f9e9cda8113fe1ccf7b6225f16e794
2020-03-19 16:16:14 +00:00
Lorenzo Colitti
0c30d949df Send tethered interface callbacks based on interface existence.
Currently, callbacks for tethered interface availability are sent
based on interface link state. This is incorrect:

- It is acceptable and expected to be able to enable tethering on
  an interface that does not yet have link up.
- It doesn't seem useful to disable Ethernet tethering if link
  temporarily goes down.

Instead, only base the callbacks on whether an interface exists
or not.

Bug: 150644681
Test: WIP tests in aosp/1260100 pass
Change-Id: I015219cbd03626c38fb5156d0cb2991ba7d7def7
Merged-In: I015219cbd03626c38fb5156d0cb2991ba7d7def7
(cherry picked from commit 64d12ea20ce3cd822518e0f15ed7483a2fb91a50)
2020-03-19 15:54:05 +00:00