[CLATJ#15] ClatCoordinator: add socket filter to packet socket
Update our packet socket filter to reflect the new 464xlat IP address Bug: 212345928 Test: flash and boot Run "atest ClatCoordinatorTest" in a followup commit Change-Id: Ic50dc122731f311ad00ab8bff5472cb3bc41f5f1
This commit is contained in:
@@ -154,6 +154,14 @@ public class ClatCoordinator {
|
||||
throws IOException {
|
||||
addAnycastSetsockopt(sock, v6, ifindex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure packet socket.
|
||||
*/
|
||||
public void jniConfigurePacketSocket(@NonNull FileDescriptor sock, String v6, int ifindex)
|
||||
throws IOException {
|
||||
configurePacketSocket(sock, v6, ifindex);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -289,6 +297,13 @@ public class ClatCoordinator {
|
||||
throw new IOException("add anycast sockopt failed: " + e);
|
||||
}
|
||||
|
||||
// Update our packet socket filter to reflect the new 464xlat IP address.
|
||||
try {
|
||||
mDeps.jniConfigurePacketSocket(readSock6.getFileDescriptor(), v6, ifaceIndex);
|
||||
} catch (IOException e) {
|
||||
throw new IOException("configure packet socket failed: " + e);
|
||||
}
|
||||
|
||||
// TODO: start clatd and returns local xlat464 v6 address.
|
||||
return null;
|
||||
}
|
||||
@@ -304,4 +319,6 @@ public class ClatCoordinator {
|
||||
private static native int openRawSocket6(int mark) throws IOException;
|
||||
private static native void addAnycastSetsockopt(FileDescriptor sock, String v6, int ifindex)
|
||||
throws IOException;
|
||||
private static native void configurePacketSocket(FileDescriptor sock, String v6, int ifindex)
|
||||
throws IOException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user