Loading core/java/android/net/RouteInfo.java +15 −3 Original line number Original line Diff line number Diff line Loading @@ -47,13 +47,25 @@ public class RouteInfo implements Parcelable { public RouteInfo(LinkAddress destination, InetAddress gateway) { public RouteInfo(LinkAddress destination, InetAddress gateway) { if (destination == null) { if (destination == null) { try { try { if ((gateway != null) || (gateway instanceof Inet4Address)) { if (gateway != null) { if (gateway instanceof Inet4Address) { destination = new LinkAddress(Inet4Address.ANY, 0); destination = new LinkAddress(Inet4Address.ANY, 0); } else { } else { destination = new LinkAddress(Inet6Address.ANY, 0); destination = new LinkAddress(Inet6Address.ANY, 0); } } } else { // no destination, no gateway. invalid. throw new RuntimeException("Invalid arguments passed in."); } } catch (Exception e) {} } catch (Exception e) {} } } if (gateway == null) { if (destination.getAddress() instanceof Inet4Address) { gateway = Inet4Address.ANY; } else { gateway = Inet6Address.ANY; } } mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(), mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(), destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength()); destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength()); mGateway = gateway; mGateway = gateway; Loading Loading
core/java/android/net/RouteInfo.java +15 −3 Original line number Original line Diff line number Diff line Loading @@ -47,13 +47,25 @@ public class RouteInfo implements Parcelable { public RouteInfo(LinkAddress destination, InetAddress gateway) { public RouteInfo(LinkAddress destination, InetAddress gateway) { if (destination == null) { if (destination == null) { try { try { if ((gateway != null) || (gateway instanceof Inet4Address)) { if (gateway != null) { if (gateway instanceof Inet4Address) { destination = new LinkAddress(Inet4Address.ANY, 0); destination = new LinkAddress(Inet4Address.ANY, 0); } else { } else { destination = new LinkAddress(Inet6Address.ANY, 0); destination = new LinkAddress(Inet6Address.ANY, 0); } } } else { // no destination, no gateway. invalid. throw new RuntimeException("Invalid arguments passed in."); } } catch (Exception e) {} } catch (Exception e) {} } } if (gateway == null) { if (destination.getAddress() instanceof Inet4Address) { gateway = Inet4Address.ANY; } else { gateway = Inet6Address.ANY; } } mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(), mDestination = new LinkAddress(NetworkUtils.getNetworkPart(destination.getAddress(), destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength()); destination.getNetworkPrefixLength()), destination.getNetworkPrefixLength()); mGateway = gateway; mGateway = gateway; Loading