Search in sources :

Example 6 with ProvisioningChange

use of android.net.LinkProperties.ProvisioningChange in project android_frameworks_base by DirtyUnicorns.

the class IpReachabilityMonitor method handleNeighborLost.

private void handleNeighborLost(String msg) {
    InetAddress ip = null;
    final ProvisioningChange delta;
    synchronized (mLock) {
        LinkProperties whatIfLp = new LinkProperties(mLinkProperties);
        for (Map.Entry<InetAddress, Short> entry : mIpWatchList.entrySet()) {
            if (entry.getValue() != StructNdMsg.NUD_FAILED) {
                continue;
            }
            ip = entry.getKey();
            for (RouteInfo route : mLinkProperties.getRoutes()) {
                if (ip.equals(route.getGateway())) {
                    whatIfLp.removeRoute(route);
                }
            }
            if (avoidingBadLinks() || !(ip instanceof Inet6Address)) {
                // We should do this unconditionally, but alas we cannot: b/31827713.
                whatIfLp.removeDnsServer(ip);
            }
        }
        delta = LinkProperties.compareProvisioning(mLinkProperties, whatIfLp);
    }
    if (delta == ProvisioningChange.LOST_PROVISIONING) {
        final String logMsg = "FAILURE: LOST_PROVISIONING, " + msg;
        Log.w(TAG, logMsg);
        if (mCallback != null) {
            // TODO: remove |ip| when the callback signature no longer has
            // an InetAddress argument.
            mCallback.notifyLost(ip, logMsg);
        }
    }
    logNudFailed(delta);
}
Also used : Inet6Address(java.net.Inet6Address) ProvisioningChange(android.net.LinkProperties.ProvisioningChange) RouteInfo(android.net.RouteInfo) InetAddress(java.net.InetAddress) LinkProperties(android.net.LinkProperties) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with ProvisioningChange

use of android.net.LinkProperties.ProvisioningChange in project android_frameworks_base by DirtyUnicorns.

the class IpManager method handleLinkPropertiesUpdate.

// Returns false if we have lost provisioning, true otherwise.
private boolean handleLinkPropertiesUpdate(boolean sendCallbacks) {
    final LinkProperties newLp = assembleLinkProperties();
    if (linkPropertiesUnchanged(newLp)) {
        return true;
    }
    final ProvisioningChange delta = setLinkProperties(newLp);
    if (sendCallbacks) {
        dispatchCallback(delta, newLp);
    }
    return (delta != ProvisioningChange.LOST_PROVISIONING);
}
Also used : ProvisioningChange(android.net.LinkProperties.ProvisioningChange) LinkProperties(android.net.LinkProperties)

Example 8 with ProvisioningChange

use of android.net.LinkProperties.ProvisioningChange in project android_frameworks_base by ResurrectionRemix.

the class IpReachabilityMonitor method handleNeighborLost.

private void handleNeighborLost(String msg) {
    InetAddress ip = null;
    final ProvisioningChange delta;
    synchronized (mLock) {
        LinkProperties whatIfLp = new LinkProperties(mLinkProperties);
        for (Map.Entry<InetAddress, Short> entry : mIpWatchList.entrySet()) {
            if (entry.getValue() != StructNdMsg.NUD_FAILED) {
                continue;
            }
            ip = entry.getKey();
            for (RouteInfo route : mLinkProperties.getRoutes()) {
                if (ip.equals(route.getGateway())) {
                    whatIfLp.removeRoute(route);
                }
            }
            if (avoidingBadLinks() || !(ip instanceof Inet6Address)) {
                // We should do this unconditionally, but alas we cannot: b/31827713.
                whatIfLp.removeDnsServer(ip);
            }
        }
        delta = LinkProperties.compareProvisioning(mLinkProperties, whatIfLp);
    }
    if (delta == ProvisioningChange.LOST_PROVISIONING) {
        final String logMsg = "FAILURE: LOST_PROVISIONING, " + msg;
        Log.w(TAG, logMsg);
        if (mCallback != null) {
            // TODO: remove |ip| when the callback signature no longer has
            // an InetAddress argument.
            mCallback.notifyLost(ip, logMsg);
        }
    }
    logNudFailed(delta);
}
Also used : Inet6Address(java.net.Inet6Address) ProvisioningChange(android.net.LinkProperties.ProvisioningChange) RouteInfo(android.net.RouteInfo) InetAddress(java.net.InetAddress) LinkProperties(android.net.LinkProperties) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with ProvisioningChange

use of android.net.LinkProperties.ProvisioningChange in project android_frameworks_base by ResurrectionRemix.

the class IpManager method handleProvisioningFailure.

private void handleProvisioningFailure() {
    final LinkProperties newLp = assembleLinkProperties();
    ProvisioningChange delta = setLinkProperties(newLp);
    // Regardless: GAME OVER.
    if (delta == ProvisioningChange.STILL_NOT_PROVISIONED) {
        delta = ProvisioningChange.LOST_PROVISIONING;
    }
    dispatchCallback(delta, newLp);
    if (delta == ProvisioningChange.LOST_PROVISIONING) {
        transitionTo(mStoppingState);
    }
}
Also used : ProvisioningChange(android.net.LinkProperties.ProvisioningChange) LinkProperties(android.net.LinkProperties)

Example 10 with ProvisioningChange

use of android.net.LinkProperties.ProvisioningChange in project android_frameworks_base by ResurrectionRemix.

the class IpManager method setLinkProperties.

// Updates all IpManager-related state concerned with LinkProperties.
// Returns a ProvisioningChange for possibly notifying other interested
// parties that are not fronted by IpManager.
private ProvisioningChange setLinkProperties(LinkProperties newLp) {
    if (mApfFilter != null) {
        mApfFilter.setLinkProperties(newLp);
    }
    if (mIpReachabilityMonitor != null) {
        mIpReachabilityMonitor.updateLinkProperties(newLp);
    }
    ProvisioningChange delta = compareProvisioning(mLinkProperties, newLp);
    mLinkProperties = new LinkProperties(newLp);
    if (delta == ProvisioningChange.GAINED_PROVISIONING) {
        // TODO: Add a proper ProvisionedState and cancel the alarm in
        // its enter() method.
        mProvisioningTimeoutAlarm.cancel();
    }
    return delta;
}
Also used : ProvisioningChange(android.net.LinkProperties.ProvisioningChange) LinkProperties(android.net.LinkProperties)

Aggregations

ProvisioningChange (android.net.LinkProperties.ProvisioningChange)24 LinkProperties (android.net.LinkProperties)20 DhcpResults (android.net.DhcpResults)4 RouteInfo (android.net.RouteInfo)4 Inet6Address (java.net.Inet6Address)4 InetAddress (java.net.InetAddress)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4