Merge "Minimal support for IPv6 upstreams in IpServer tests."

This commit is contained in:
Lorenzo Colitti
2020-02-19 13:38:00 +00:00
committed by Gerrit Code Review

View File

@@ -158,7 +158,9 @@ public class IpServerTest {
initStateMachine(interfaceType, usingLegacyDhcp); initStateMachine(interfaceType, usingLegacyDhcp);
dispatchCommand(IpServer.CMD_TETHER_REQUESTED, STATE_TETHERED); dispatchCommand(IpServer.CMD_TETHER_REQUESTED, STATE_TETHERED);
if (upstreamIface != null) { if (upstreamIface != null) {
dispatchTetherConnectionChanged(upstreamIface); LinkProperties lp = new LinkProperties();
lp.setInterfaceName(upstreamIface);
dispatchTetherConnectionChanged(upstreamIface, lp);
} }
reset(mNetd, mCallback); reset(mNetd, mCallback);
} }
@@ -508,13 +510,21 @@ public class IpServerTest {
* *
* @see #dispatchCommand(int) * @see #dispatchCommand(int)
* @param upstreamIface String name of upstream interface (or null) * @param upstreamIface String name of upstream interface (or null)
* @param v6lp IPv6 LinkProperties of the upstream interface, or null for an IPv4-only upstream.
*/ */
private void dispatchTetherConnectionChanged(String upstreamIface) { private void dispatchTetherConnectionChanged(String upstreamIface, LinkProperties v6lp) {
mIpServer.sendMessage(IpServer.CMD_TETHER_CONNECTION_CHANGED, mIpServer.sendMessage(IpServer.CMD_TETHER_CONNECTION_CHANGED,
new InterfaceSet(upstreamIface)); new InterfaceSet(upstreamIface));
if (v6lp != null) {
mIpServer.sendMessage(IpServer.CMD_IPV6_TETHER_UPDATE, v6lp);
}
mLooper.dispatchAll(); mLooper.dispatchAll();
} }
private void dispatchTetherConnectionChanged(String upstreamIface) {
dispatchTetherConnectionChanged(upstreamIface, null);
}
private void assertIPv4AddressAndDirectlyConnectedRoute(LinkProperties lp) { private void assertIPv4AddressAndDirectlyConnectedRoute(LinkProperties lp) {
// Find the first IPv4 LinkAddress. // Find the first IPv4 LinkAddress.
LinkAddress addr4 = null; LinkAddress addr4 = null;