IP_MSFILTER(2const)
β¨ IP_MSFILTER π β multicast source filtering
okay bestie, this is a page from the IP_MSFILTER(2const) manual β a Linux man-pages thing, totally standard, no cap. And before you ask: it's giving advanced. Let's get into it π«Ά
πΈ NAME πΈ
IP_MSFILTER β multicast source filtering. yes literally, it's the filter-y one π
π LIBRARY π
Standard C library (libc, -lc). the classic π
π SYNOPSIS π
#include <netinet/in.h> /* Definition of IP* constants */
#include <sys/socket.h>
int setsockopt(int sockfd, IPPROTO_IP, IP_MSFILTER,
const struct ip_msfilter *val,
sizeof(struct ip_msfilter));
struct ip_msfilter {
struct in_addr imsf_multiaddr; // IP multicast group address
struct in_addr imsf_interface; // IP address of local interface
uint32_t imsf_fmode; // Filter-mode
uint32_t imsf_numsrc; // Number of elements in .imsf_slist
struct in_addr imsf_slist[1]; // Array of source addresses
};
look at that struct. it's gorgeous. the way imsf_slist has exactly [1] in it and you just over-allocate past it π that's the whole bit.
π DESCRIPTION π
okay so this option hands you access to the advanced full-state filtering API. full-state! not a vibe check, an actual state dump, fr fr.
There are two macros, MCAST_INCLUDE and MCAST_EXCLUDE, which you use to say what filtering mode you want. pick one, they're the two moods β¨
Also, the IP_MSFILTER_SIZE(n) macro exists so you can figure out how much memory you need to store an ip_msfilter structure with n sources in the source list. yes bestie, budget your malloc, that's the responsible main character move π
For the full description of multicast source filtering, go read RFC 3376. i know. homework. but it's the real one π₯
π ERRORS π
See IPRROTO_IP(2const). See setsockopt(2). See ip(7). (yes, that's exactly how it's spelled up there β IPRROTO_IP. not me fixing it. i don't edit the ancestors π)
β STANDARDS β
Linux. that's it. linux only, babe π§
π¦ HISTORY π¦
- Linux 2.4.22
- Linux 2.5.68
ancient lore. these constants have been serving looks since the early 2000s π
π SEE ALSO π
so yeah π«Ά that's the whole page. this one came straight out of the Linux man-pages 6.20 collection, dated 2025-11-25 β go slay some multicast, and remember: MCAST_INCLUDE and MCAST_EXCLUDE, pick your fighter. periodt π
β¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms