| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH IP_MULTICAST_IF 2const 2025-11-25 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
IP_MULTICAST_IF |
| 8 |
\- |
| 9 |
local device for a multicast socket |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <netinet/in.h>" " /* Definition of " IP* " constants */" |
| 16 |
.B #include <sys/socket.h> |
| 17 |
.P |
| 18 |
.BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_IF, |
| 19 |
.BI " const\~void\~" val [ size ],\~size_t\~ size ); |
| 20 |
.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_IF, |
| 21 |
.BI " struct\~in_addr\~*" val ,\~sizeof(struct\~in_addr)); |
| 22 |
.fi |
| 23 |
.SH DESCRIPTION |
| 24 |
Set the local device for a multicast socket. |
| 25 |
.P |
| 26 |
The argument for |
| 27 |
.BR setsockopt (2) |
| 28 |
is an |
| 29 |
.BR ip_mreqn (2type) |
| 30 |
or |
| 31 |
.\" net: IP_MULTICAST_IF setsockopt now recognizes struct mreq |
| 32 |
.\" Commit: 3a084ddb4bf299a6e898a9a07c89f3917f0713f7 |
| 33 |
(since Linux 3.5) |
| 34 |
.BR ip_mreq (2type) |
| 35 |
structure, |
| 36 |
or an |
| 37 |
.BR in_addr (2type) |
| 38 |
structure. |
| 39 |
(The kernel determines which structure is being passed based |
| 40 |
on the size passed in |
| 41 |
.IR size .) |
| 42 |
.SH ERRORS |
| 43 |
See |
| 44 |
.BR IPPROTO_IP (2const). |
| 45 |
See |
| 46 |
.BR setsockopt (2). |
| 47 |
See |
| 48 |
.BR ip (7). |
| 49 |
.SH HISTORY |
| 50 |
Linux 1.2. |
| 51 |
.SH SEE ALSO |
| 52 |
.BR IPPROTO_IP (2const), |
| 53 |
.BR in_addr (2type), |
| 54 |
.BR ip_mreqn (2type), |
| 55 |
.BR setsockopt (2), |
| 56 |
.BR ip (7) |