Search in sources :

Example 1 with RaParams

use of android.net.ip.RouterAdvertisementDaemon.RaParams in project android_frameworks_base by DirtyUnicorns.

the class IPv6TetheringInterfaceServices method updateUpstreamIPv6LinkProperties.

// IPv6TetheringCoordinator sends updates with carefully curated IPv6-only
// LinkProperties. These have extraneous data filtered out and only the
// necessary prefixes included (per its prefix distribution policy).
//
// TODO: Evaluate using a data structure than is more directly suited to
// communicating only the relevant information.
public void updateUpstreamIPv6LinkProperties(LinkProperties v6only) {
    if (mRaDaemon == null)
        return;
    // Avoid unnecessary work on spurious updates.
    if (Objects.equals(mLastIPv6LinkProperties, v6only)) {
        return;
    }
    RaParams params = null;
    if (v6only != null) {
        params = new RaParams();
        params.mtu = v6only.getMtu();
        params.hasDefaultRoute = v6only.hasIPv6DefaultRoute();
        for (LinkAddress linkAddr : v6only.getLinkAddresses()) {
            if (linkAddr.getPrefixLength() != RFC7421_IP_PREFIX_LENGTH)
                continue;
            final IpPrefix prefix = new IpPrefix(linkAddr.getAddress(), linkAddr.getPrefixLength());
            params.prefixes.add(prefix);
            final Inet6Address dnsServer = getLocalDnsIpFor(prefix);
            if (dnsServer != null) {
                params.dnses.add(dnsServer);
            }
        }
    }
    // If v6only is null, we pass in null to setRaParams(), which handles
    // deprecation of any existing RA data.
    setRaParams(params);
    mLastIPv6LinkProperties = v6only;
}
Also used : LinkAddress(android.net.LinkAddress) IpPrefix(android.net.IpPrefix) RaParams(android.net.ip.RouterAdvertisementDaemon.RaParams) Inet6Address(java.net.Inet6Address)

Example 2 with RaParams

use of android.net.ip.RouterAdvertisementDaemon.RaParams in project android_frameworks_base by DirtyUnicorns.

the class IPv6TetheringInterfaceServices method setRaParams.

private void setRaParams(RaParams newParams) {
    if (mRaDaemon != null) {
        final RaParams deprecatedParams = RaParams.getDeprecatedRaParams(mLastRaParams, newParams);
        configureLocalRoutes(deprecatedParams.prefixes, (newParams != null) ? newParams.prefixes : null);
        configureLocalDns(deprecatedParams.dnses, (newParams != null) ? newParams.dnses : null);
        mRaDaemon.buildNewRa(deprecatedParams, newParams);
    }
    mLastRaParams = newParams;
}
Also used : RaParams(android.net.ip.RouterAdvertisementDaemon.RaParams)

Example 3 with RaParams

use of android.net.ip.RouterAdvertisementDaemon.RaParams in project android_frameworks_base by crdroidandroid.

the class IPv6TetheringInterfaceServices method updateUpstreamIPv6LinkProperties.

// IPv6TetheringCoordinator sends updates with carefully curated IPv6-only
// LinkProperties. These have extraneous data filtered out and only the
// necessary prefixes included (per its prefix distribution policy).
//
// TODO: Evaluate using a data structure than is more directly suited to
// communicating only the relevant information.
public void updateUpstreamIPv6LinkProperties(LinkProperties v6only) {
    if (mRaDaemon == null)
        return;
    // Avoid unnecessary work on spurious updates.
    if (Objects.equals(mLastIPv6LinkProperties, v6only)) {
        return;
    }
    RaParams params = null;
    if (v6only != null) {
        params = new RaParams();
        params.mtu = v6only.getMtu();
        params.hasDefaultRoute = v6only.hasIPv6DefaultRoute();
        for (LinkAddress linkAddr : v6only.getLinkAddresses()) {
            if (linkAddr.getPrefixLength() != RFC7421_IP_PREFIX_LENGTH)
                continue;
            final IpPrefix prefix = new IpPrefix(linkAddr.getAddress(), linkAddr.getPrefixLength());
            params.prefixes.add(prefix);
            final Inet6Address dnsServer = getLocalDnsIpFor(prefix);
            if (dnsServer != null) {
                params.dnses.add(dnsServer);
            }
        }
    }
    // If v6only is null, we pass in null to setRaParams(), which handles
    // deprecation of any existing RA data.
    setRaParams(params);
    mLastIPv6LinkProperties = v6only;
}
Also used : LinkAddress(android.net.LinkAddress) IpPrefix(android.net.IpPrefix) RaParams(android.net.ip.RouterAdvertisementDaemon.RaParams) Inet6Address(java.net.Inet6Address)

Example 4 with RaParams

use of android.net.ip.RouterAdvertisementDaemon.RaParams in project android_frameworks_base by AOSPA.

the class IPv6TetheringInterfaceServices method updateUpstreamIPv6LinkProperties.

// IPv6TetheringCoordinator sends updates with carefully curated IPv6-only
// LinkProperties. These have extraneous data filtered out and only the
// necessary prefixes included (per its prefix distribution policy).
//
// TODO: Evaluate using a data structure than is more directly suited to
// communicating only the relevant information.
public void updateUpstreamIPv6LinkProperties(LinkProperties v6only) {
    if (mRaDaemon == null)
        return;
    // Avoid unnecessary work on spurious updates.
    if (Objects.equals(mLastIPv6LinkProperties, v6only)) {
        return;
    }
    RaParams params = null;
    if (v6only != null) {
        params = new RaParams();
        params.mtu = v6only.getMtu();
        params.hasDefaultRoute = v6only.hasIPv6DefaultRoute();
        for (LinkAddress linkAddr : v6only.getLinkAddresses()) {
            if (linkAddr.getPrefixLength() != RFC7421_IP_PREFIX_LENGTH)
                continue;
            final IpPrefix prefix = new IpPrefix(linkAddr.getAddress(), linkAddr.getPrefixLength());
            params.prefixes.add(prefix);
            final Inet6Address dnsServer = getLocalDnsIpFor(prefix);
            if (dnsServer != null) {
                params.dnses.add(dnsServer);
            }
        }
    }
    // If v6only is null, we pass in null to setRaParams(), which handles
    // deprecation of any existing RA data.
    setRaParams(params);
    mLastIPv6LinkProperties = v6only;
}
Also used : LinkAddress(android.net.LinkAddress) IpPrefix(android.net.IpPrefix) RaParams(android.net.ip.RouterAdvertisementDaemon.RaParams) Inet6Address(java.net.Inet6Address)

Example 5 with RaParams

use of android.net.ip.RouterAdvertisementDaemon.RaParams in project android_frameworks_base by AOSPA.

the class IPv6TetheringInterfaceServices method setRaParams.

private void setRaParams(RaParams newParams) {
    if (mRaDaemon != null) {
        final RaParams deprecatedParams = RaParams.getDeprecatedRaParams(mLastRaParams, newParams);
        configureLocalRoutes(deprecatedParams.prefixes, (newParams != null) ? newParams.prefixes : null);
        configureLocalDns(deprecatedParams.dnses, (newParams != null) ? newParams.dnses : null);
        mRaDaemon.buildNewRa(deprecatedParams, newParams);
    }
    mLastRaParams = newParams;
}
Also used : RaParams(android.net.ip.RouterAdvertisementDaemon.RaParams)

Aggregations

RaParams (android.net.ip.RouterAdvertisementDaemon.RaParams)10 IpPrefix (android.net.IpPrefix)5 LinkAddress (android.net.LinkAddress)5 Inet6Address (java.net.Inet6Address)5