net/packet: add PACKET_<ADD|DROP>_MEMBERSHIP support

Some third-party network libraries use PACKET_ADD_MEMBERSHIP to add MAC
addresses to devices, and this patch can add support for this.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2025-06-09 11:10:58 +08:00
committed by Donny(董九柱)
parent f03e4774a4
commit 1fd47357f7
5 changed files with 90 additions and 4 deletions
+15
View File
@@ -44,6 +44,13 @@
#define PACKET_LOOPBACK 5
#define PACKET_FASTROUTE 6
/* Packet socket options */
#define PACKET_ADD_MEMBERSHIP 1 /* Add a multicast address to the interface */
#define PACKET_DROP_MEMBERSHIP 2 /* Drop a multicast address from the interface */
#define PACKET_MR_MULTICAST 0 /* Multicast address */
/****************************************************************************
* Public Types
****************************************************************************/
@@ -59,4 +66,12 @@ struct sockaddr_ll
unsigned char sll_addr[8];
};
struct packet_mreq
{
int mr_ifindex;
unsigned short mr_type;
unsigned short mr_alen;
unsigned char mr_address[8];
};
#endif /* __INCLUDE_NETPACKET_PACKET_H */