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

Commit cb37ff93 authored by Devi Sandeep Endluri V V's avatar Devi Sandeep Endluri V V Committed by Linux Build Service Account
Browse files

server: implement NatStarted and NatStopped in NetPluginDelegate

use natStarted and natStopped hooks in NetworkManagementService
to start V6 tethering.

Change-Id: I8293507f96cdfac28959a7bff622df1596727ab3
CRs-Fixed: 1024593
parent 29db56b5
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -77,6 +77,32 @@ public class NetPluginDelegate {
        return ret_val;
    }

    public static void natStarted(String intIface, String extIface) {
        if (LOGV) Slog.v(TAG, "natStarted() E");
        if(!loadTetherExtJar()) return;
        try {
            tetherExtensionClass.getMethod("natStarted", String.class, String.class).invoke(
                    tetherExtensionObj, intIface, extIface);
        } catch (Exception e) {
            e.printStackTrace();
            Log.w(TAG, "Error calling natStarted Method on extension jar");
        }
        if (LOGV) Slog.v(TAG, "natStarted() X");
    }

    public static void natStopped(String intIface, String extIface) {
        if (LOGV) Slog.v(TAG, "natStopped() E");
        if(!loadTetherExtJar()) return;
        try {
            tetherExtensionClass.getMethod("natStopped", String.class, String.class).invoke(
                    tetherExtensionObj, intIface, extIface);
        } catch (Exception e) {
            e.printStackTrace();
            Log.w(TAG, "Error calling natStopped Method on extension jar");
        }
        if (LOGV) Slog.v(TAG, "natStopped() X");
    }

    public static void setQuota(String iface, long quota) {
        if (LOGV) Slog.v(TAG, "setQuota(" + iface + ", " + quota + ") E");
        if(!loadTetherExtJar()) return;
+3 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import com.android.internal.util.HexDump;
import com.android.internal.util.Preconditions;
import com.android.server.NativeDaemonConnector.Command;
import com.android.server.NativeDaemonConnector.SensitiveArg;
import com.android.server.NetPluginDelegate;
import com.android.server.net.LockdownVpnTracker;
import com.google.android.collect.Maps;

@@ -1410,6 +1411,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
        } catch (SocketException e) {
            throw new IllegalStateException(e);
        }
        NetPluginDelegate.natStarted(internalInterface,externalInterface);
    }

    @Override
@@ -1420,6 +1422,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
        } catch (SocketException e) {
            throw new IllegalStateException(e);
        }
        NetPluginDelegate.natStopped(internalInterface,externalInterface);
    }

    @Override