Loading src/android/net/apf/ApfFilter.java +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ public class ApfFilter { socket = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IPV6); SocketAddress addr = makePacketSocketAddress( (short) ETH_P_IPV6, mInterfaceParams.index); SocketUtils.bindSocket(socket, addr); Os.bind(socket, addr); SocketUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat); } catch(SocketException|ErrnoException e) { Log.e(TAG, "Error starting filter", e); Loading src/android/net/dhcp/DhcpClient.java +2 −3 Original line number Diff line number Diff line Loading @@ -317,7 +317,7 @@ public class DhcpClient extends StateMachine { try { mPacketSock = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IP); SocketAddress addr = makePacketSocketAddress((short) ETH_P_IP, mIface.index); SocketUtils.bindSocket(mPacketSock, addr); Os.bind(mPacketSock, addr); SocketUtils.attachDhcpFilter(mPacketSock); } catch(SocketException|ErrnoException e) { Log.e(TAG, "Error creating packet socket", e); Loading Loading @@ -412,8 +412,7 @@ public class DhcpClient extends StateMachine { try { if (encap == DhcpPacket.ENCAP_L2) { if (DBG) Log.d(TAG, "Broadcasting " + description); SocketUtils.sendTo( mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr); Os.sendto(mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr); } else if (encap == DhcpPacket.ENCAP_BOOTP && to.equals(INADDR_BROADCAST)) { if (DBG) Log.d(TAG, "Broadcasting " + description); // We only send L3-encapped broadcasts in DhcpRebindingState, Loading src/android/net/ip/ConnectivityPacketTracker.java +1 −2 Original line number Diff line number Diff line Loading @@ -104,8 +104,7 @@ public class ConnectivityPacketTracker { try { s = Os.socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, 0); SocketUtils.attachControlPacketFilter(s, ARPHRD_ETHER); SocketUtils.bindSocket( s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index)); Os.bind(s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index)); } catch (ErrnoException | IOException e) { logError("Failed to create packet tracking socket: ", e); closeFd(s); Loading src/android/net/ip/IpNeighborMonitor.java +1 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.net.netlink.StructNdMsg; import android.net.util.NetworkStackUtils; import android.net.util.PacketReader; import android.net.util.SharedLog; import android.net.util.SocketUtils; import android.os.Handler; import android.os.SystemClock; import android.system.ErrnoException; Loading Loading @@ -150,7 +149,7 @@ public class IpNeighborMonitor extends PacketReader { try { fd = Os.socket(AF_NETLINK, SOCK_DGRAM | SOCK_NONBLOCK, NETLINK_ROUTE); SocketUtils.bindSocket(fd, makeNetlinkSocketAddress(0, OsConstants.RTMGRP_NEIGH)); Os.bind(fd, makeNetlinkSocketAddress(0, OsConstants.RTMGRP_NEIGH)); NetlinkSocket.connectToKernel(fd); if (VDBG) { Loading Loading
src/android/net/apf/ApfFilter.java +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ public class ApfFilter { socket = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IPV6); SocketAddress addr = makePacketSocketAddress( (short) ETH_P_IPV6, mInterfaceParams.index); SocketUtils.bindSocket(socket, addr); Os.bind(socket, addr); SocketUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat); } catch(SocketException|ErrnoException e) { Log.e(TAG, "Error starting filter", e); Loading
src/android/net/dhcp/DhcpClient.java +2 −3 Original line number Diff line number Diff line Loading @@ -317,7 +317,7 @@ public class DhcpClient extends StateMachine { try { mPacketSock = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IP); SocketAddress addr = makePacketSocketAddress((short) ETH_P_IP, mIface.index); SocketUtils.bindSocket(mPacketSock, addr); Os.bind(mPacketSock, addr); SocketUtils.attachDhcpFilter(mPacketSock); } catch(SocketException|ErrnoException e) { Log.e(TAG, "Error creating packet socket", e); Loading Loading @@ -412,8 +412,7 @@ public class DhcpClient extends StateMachine { try { if (encap == DhcpPacket.ENCAP_L2) { if (DBG) Log.d(TAG, "Broadcasting " + description); SocketUtils.sendTo( mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr); Os.sendto(mPacketSock, buf.array(), 0, buf.limit(), 0, mInterfaceBroadcastAddr); } else if (encap == DhcpPacket.ENCAP_BOOTP && to.equals(INADDR_BROADCAST)) { if (DBG) Log.d(TAG, "Broadcasting " + description); // We only send L3-encapped broadcasts in DhcpRebindingState, Loading
src/android/net/ip/ConnectivityPacketTracker.java +1 −2 Original line number Diff line number Diff line Loading @@ -104,8 +104,7 @@ public class ConnectivityPacketTracker { try { s = Os.socket(AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, 0); SocketUtils.attachControlPacketFilter(s, ARPHRD_ETHER); SocketUtils.bindSocket( s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index)); Os.bind(s, makePacketSocketAddress((short) ETH_P_ALL, mInterface.index)); } catch (ErrnoException | IOException e) { logError("Failed to create packet tracking socket: ", e); closeFd(s); Loading
src/android/net/ip/IpNeighborMonitor.java +1 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.net.netlink.StructNdMsg; import android.net.util.NetworkStackUtils; import android.net.util.PacketReader; import android.net.util.SharedLog; import android.net.util.SocketUtils; import android.os.Handler; import android.os.SystemClock; import android.system.ErrnoException; Loading Loading @@ -150,7 +149,7 @@ public class IpNeighborMonitor extends PacketReader { try { fd = Os.socket(AF_NETLINK, SOCK_DGRAM | SOCK_NONBLOCK, NETLINK_ROUTE); SocketUtils.bindSocket(fd, makeNetlinkSocketAddress(0, OsConstants.RTMGRP_NEIGH)); Os.bind(fd, makeNetlinkSocketAddress(0, OsConstants.RTMGRP_NEIGH)); NetlinkSocket.connectToKernel(fd); if (VDBG) { Loading