Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecd0db5a authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Setting MTU size for specific network." into klp-dev

parents 1aa3202b 9d9b74a9
Loading
Loading
Loading
Loading
+31 −4
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class LinkProperties implements Parcelable {
    private String mDomains;
    private Collection<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
    private ProxyProperties mHttpProxy;
    private int mMtu;

    // Stores the properties of links that are "stacked" above this link.
    // Indexed by interface name to allow modification and to prevent duplicates being added.
@@ -104,6 +105,7 @@ public class LinkProperties implements Parcelable {
            for (LinkProperties l: source.mStackedLinks.values()) {
                addStackedLink(l);
            }
            setMtu(source.getMtu());
        }
    }

@@ -223,6 +225,14 @@ public class LinkProperties implements Parcelable {
        mDomains = domains;
    }

    public void setMtu(int mtu) {
        mMtu = mtu;
    }

    public int getMtu() {
        return mMtu;
    }

    private RouteInfo routeWithInterface(RouteInfo route) {
        return new RouteInfo(
            route.getDestination(),
@@ -322,6 +332,7 @@ public class LinkProperties implements Parcelable {
        mRoutes.clear();
        mHttpProxy = null;
        mStackedLinks.clear();
        mMtu = 0;
    }

    /**
@@ -346,6 +357,8 @@ public class LinkProperties implements Parcelable {

        String domainName = "Domains: " + mDomains;

        String mtu = "MTU: " + mMtu;

        String routes = " Routes: [";
        for (RouteInfo route : mRoutes) routes += route.toString() + ",";
        routes += "] ";
@@ -359,7 +372,8 @@ public class LinkProperties implements Parcelable {
            }
            stacked += "] ";
        }
        return "{" + ifaceName + linkAddresses + routes + dns + domainName + proxy + stacked + "}";
        return "{" + ifaceName + linkAddresses + routes + dns + domainName + mtu
            + proxy + stacked + "}";
    }

    /**
@@ -474,6 +488,16 @@ public class LinkProperties implements Parcelable {
        return true;
    }

    /**
     * Compares this {@code LinkProperties} MTU against the target
     *
     * @@param target LinkProperties to compare.
     * @return {@code true} if both are identical, {@code false} otherwise.
     */
    public boolean isIdenticalMtu(LinkProperties target) {
        return getMtu() == target.getMtu();
    }

    @Override
    /**
     * Compares this {@code LinkProperties} instance against the target
@@ -505,7 +529,8 @@ public class LinkProperties implements Parcelable {
                isIdenticalDnses(target) &&
                isIdenticalRoutes(target) &&
                isIdenticalHttpProxy(target) &&
                isIdenticalStackedLinks(target);
                isIdenticalStackedLinks(target) &&
                isIdenticalMtu(target);
    }

    /**
@@ -607,7 +632,8 @@ public class LinkProperties implements Parcelable {
                + ((null == mDomains) ? 0 : mDomains.hashCode())
                + mRoutes.size() * 41
                + ((null == mHttpProxy) ? 0 : mHttpProxy.hashCode())
                + mStackedLinks.hashCode() * 47);
                + mStackedLinks.hashCode() * 47)
                + mMtu * 51;
    }

    /**
@@ -625,7 +651,7 @@ public class LinkProperties implements Parcelable {
            dest.writeByteArray(d.getAddress());
        }
        dest.writeString(mDomains);

        dest.writeInt(mMtu);
        dest.writeInt(mRoutes.size());
        for(RouteInfo route : mRoutes) {
            dest.writeParcelable(route, flags);
@@ -664,6 +690,7 @@ public class LinkProperties implements Parcelable {
                    } catch (UnknownHostException e) { }
                }
                netProp.setDomains(in.readString());
                netProp.setMtu(in.readInt());
                addressCount = in.readInt();
                for (int i=0; i<addressCount; i++) {
                    netProp.addRoute((RouteInfo)in.readParcelable(null));
+2 −0
Original line number Diff line number Diff line
@@ -198,6 +198,8 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker {
            loge("CONNECTED event did not supply link properties.");
            mLinkProperties = new LinkProperties();
        }
        mLinkProperties.setMtu(mContext.getResources().getInteger(
                com.android.internal.R.integer.config_mobile_mtu));
        mLinkCapabilities = intent.getParcelableExtra(
                PhoneConstants.DATA_LINK_CAPABILITIES_KEY);
        if (mLinkCapabilities == null) {
+5 −0
Original line number Diff line number Diff line
@@ -117,6 +117,11 @@ interface INetworkManagementService
     */
    void removeSecondaryRoute(String iface, in RouteInfo route);

    /**
     * Set the specified MTU size
     */
    void setMtu(String iface, int mtu);

    /**
     * Shuts down the service
     */
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You my obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<!-- These resources are around just to allow their values to be customized
     for different hardware and product builds. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <!-- Configure mobile network MTU. Carrier specific value is set here.
    -->
    <integer name="config_mobile_mtu">1358</integer>

</resources>
+4 −0
Original line number Diff line number Diff line
@@ -36,4 +36,8 @@
         note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" -->
    <string translatable="false" name="config_tether_apndata">Fido LTE Tethering,ltedata.apn,,,,,,,,,302,370,,DUN</string>

    <!-- Configure mobile network MTU. Carrier specific value is set here.
    -->
    <integer name="config_mobile_mtu">1410</integer>

</resources>
Loading