ip_mreqn(2type)

๐Ÿ“ฆ
version 6.20 ยท 4 versions
, in arch rolling, nixpkgs unstable

๐Ÿ’– ip_mreqn โ€” the manual page, but make it make sense ๐Ÿ’–

okay so bestie, welcome to the โœจ ip_mreqn โœจ show. this is a page from section 2type, which is basically the corner of the manual where struct definitions live. we got two structs here โ€” ip_mreqn and its slightly older sibling ip_mreq โ€” and they're both about telling the kernel "hey. i want in on this multicast group. here's where i'm standing and which door i'm using." ๐Ÿ“ฌ no cap.

and it lives in the Standard C library (libc), so you don't even gotta go hunting for it. it's right there. ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

grab this header first, she's the one who brings all the IP* constants to the party:

#include <netinet/in.h>  /* Definition of IP* constants */

then here's the big one, the newer girl, ip_mreqn:

struct ip_mreqn {
    struct in_addr  imr_multiaddr;  /* IP multicast group address */
    struct in_addr  imr_address;    /* IP address of local interface */
    int             imr_ifindex;    /* interface index */
};

and here's the classic, ip_mreq โ€” shorter, no imr_ifindex, still iconic:

struct ip_mreq {
    struct in_addr  imr_multiaddr;  /* IP multicast group address */
    struct in_addr  imr_address;    /* IP address of local interface */
};

โœจ DESCRIPTION โœจ

okay so let's go field by field, because each one is doing its own lil job and you gotta know which one is which ๐Ÿ’…

  • .imr_multiaddr โ€” this is the address of the multicast group your app wants to join or leave. and listen, it must be a valid multicast address. like, that's not optional. the kernel will not be playing games w you on this one. ๐Ÿšซ๐ŸŽฎ
  • .imr_address โ€” the address of the local interface that the system should use to join the multicast group. and here's the cute part: if it's equal to INADDR_ANY, then the system just picks an appropriate interface for you. it's giving "you choose, i trust you." ๐Ÿ˜Œ๐ŸŒท
  • .imr_ifindex โ€” the interface index of the interface that should join/leave the .imr_multiaddr group. orrrr you set it to 0 to indicate any interface. yes bestie, 0 means "any", that's not a typo, that's the vibe. ๐ŸŽ€

๐Ÿฆ‹ HISTORY ๐Ÿฆ‹

  • ip_mreqn โ€” Linux 2.2. the newer era. the glow-up. โœจ
  • ip_mreq โ€” Linux 1.2. the og. respect her. ๐Ÿ‘‘

๐ŸŽ€ SEE ALSO ๐ŸŽ€

go read these next, they're the whole friend group fr fr:


quick recap bestie: valid multicast addr in .imr_multiaddr, local interface addr in .imr_address (or INADDR_ANY and let the system cook ๐Ÿณ), and .imr_ifindex for the interface โ€” or 0 for any. that's the whole assignment. you got this. ๐ŸŒˆ

and that's the page!! ๐Ÿซถ this lil slice of documentation came from Linux man-pages 6.20, dated 2025-11-25 โ€” so yeah, she's recent, she's fresh, she ate. ๐Ÿ’…๐ŸŒŸ now go join a multicast group, main character. ๐Ÿ’–๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ 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