Merge "clat: enable PACKET_AUXDATA cmsg reception"

This commit is contained in:
Maciej Żenczykowski 2023-01-30 19:29:47 +00:00 • committed by Gerrit Code Review
commit b5cfb6426c

View file

@ -19,6 +19,7 @@
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <linux/if_packet.h>
#include <linux/if_tun.h>
#include <linux/ioctl.h>
#include <log/log.h>
@ -181,6 +182,12 @@ static jint com_android_server_connectivity_ClatCoordinator_openPacketSocket(JNI
throwIOException(env, "packet socket failed", errno);
return -1;
}
int on = 1;
if (setsockopt(sock, SOL_PACKET, PACKET_AUXDATA, &on, sizeof(on))) {
throwIOException(env, "packet socket auxdata enablement failed", errno);
close(sock);
return -1;
}
return sock;
}