From 6fc44359ebdc6bf10eec98cc5828a1d2fa75534d Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Wed, 13 Oct 2021 14:41:58 +0000 Subject: [PATCH] Add IFF_MULTICAST to test interfaces This allows using test interfaces for multicast scenarios, such as testing mDNS behavior. Test: atest CtsNetTestCases Change-Id: Ib5d8a997176f910d499021fdcd12c361aff1233d --- service/jni/com_android_server_TestNetworkService.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/service/jni/com_android_server_TestNetworkService.cpp b/service/jni/com_android_server_TestNetworkService.cpp index e7a40e5ea6..1a0de32ae9 100644 --- a/service/jni/com_android_server_TestNetworkService.cpp +++ b/service/jni/com_android_server_TestNetworkService.cpp @@ -66,6 +66,8 @@ static int createTunTapInterface(JNIEnv* env, bool isTun, const char* iface) { // Activate interface using an unconnected datagram socket. base::unique_fd inet6CtrlSock(socket(AF_INET6, SOCK_DGRAM, 0)); ifr.ifr_flags = IFF_UP; + // Mark TAP interfaces as supporting multicast + if (!isTun) ifr.ifr_flags |= IFF_MULTICAST; if (ioctl(inet6CtrlSock.get(), SIOCSIFFLAGS, &ifr)) { throwException(env, errno, "activating", ifr.ifr_name);