IP_MSFILTER(2const)

πŸ“¦
version 6.20 Β· 4 versions
, in arch rolling, nixpkgs unstable

✨ 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