use of android.system.PacketSocketAddress in project platform_frameworks_base by android.
the class ApfFilter method maybeStartFilter.
/**
* Attempt to start listening for RAs and, if RAs are received, generating and installing
* filters to ignore useless RAs.
*/
@VisibleForTesting
void maybeStartFilter() {
FileDescriptor socket;
try {
mHardwareAddress = mNetworkInterface.getHardwareAddress();
synchronized (this) {
// Install basic filters
installNewProgramLocked();
}
socket = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IPV6);
PacketSocketAddress addr = new PacketSocketAddress((short) ETH_P_IPV6, mNetworkInterface.getIndex());
Os.bind(socket, addr);
NetworkUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat);
} catch (SocketException | ErrnoException e) {
Log.e(TAG, "Error starting filter", e);
return;
}
mReceiveThread = new ReceiveThread(socket);
mReceiveThread.start();
}
use of android.system.PacketSocketAddress in project android_frameworks_base by DirtyUnicorns.
the class DhcpClient method initPacketSocket.
private boolean initPacketSocket() {
try {
mPacketSock = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IP);
PacketSocketAddress addr = new PacketSocketAddress((short) ETH_P_IP, mIface.getIndex());
Os.bind(mPacketSock, addr);
NetworkUtils.attachDhcpFilter(mPacketSock);
} catch (SocketException | ErrnoException e) {
Log.e(TAG, "Error creating packet socket", e);
return false;
}
return true;
}
use of android.system.PacketSocketAddress in project android_frameworks_base by ResurrectionRemix.
the class ApfFilter method maybeStartFilter.
/**
* Attempt to start listening for RAs and, if RAs are received, generating and installing
* filters to ignore useless RAs.
*/
@VisibleForTesting
void maybeStartFilter() {
FileDescriptor socket;
try {
mHardwareAddress = mNetworkInterface.getHardwareAddress();
synchronized (this) {
// Install basic filters
installNewProgramLocked();
}
socket = Os.socket(AF_PACKET, SOCK_RAW, ETH_P_IPV6);
PacketSocketAddress addr = new PacketSocketAddress((short) ETH_P_IPV6, mNetworkInterface.getIndex());
Os.bind(socket, addr);
NetworkUtils.attachRaFilter(socket, mApfCapabilities.apfPacketFormat);
} catch (SocketException | ErrnoException e) {
Log.e(TAG, "Error starting filter", e);
return;
}
mReceiveThread = new ReceiveThread(socket);
mReceiveThread.start();
}
use of android.system.PacketSocketAddress in project android_frameworks_base by ResurrectionRemix.
the class DhcpClient method initInterface.
private boolean initInterface() {
try {
mIface = NetworkInterface.getByName(mIfaceName);
mHwAddr = mIface.getHardwareAddress();
mInterfaceBroadcastAddr = new PacketSocketAddress(mIface.getIndex(), DhcpPacket.ETHER_BROADCAST);
return true;
} catch (SocketException | NullPointerException e) {
Log.e(TAG, "Can't determine ifindex or MAC address for " + mIfaceName, e);
return false;
}
}
use of android.system.PacketSocketAddress in project platform_frameworks_base by android.
the class DhcpClient method initInterface.
private boolean initInterface() {
try {
mIface = NetworkInterface.getByName(mIfaceName);
mHwAddr = mIface.getHardwareAddress();
mInterfaceBroadcastAddr = new PacketSocketAddress(mIface.getIndex(), DhcpPacket.ETHER_BROADCAST);
return true;
} catch (SocketException | NullPointerException e) {
Log.e(TAG, "Can't determine ifindex or MAC address for " + mIfaceName, e);
return false;
}
}
Aggregations