.\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .TH IP_MULTICAST_IF 2const 2025-11-25 "Linux man-pages 6.17" .SH NAME IP_MULTICAST_IF \- local device for a multicast socket .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#include " " /* Definition of " IP* " constants */" .B #include .P .BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_IF, .BI " const\~void\~" val [ size ],\~size_t\~ size ); .BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_MULTICAST_IF, .BI " struct\~in_addr\~*" val ,\~sizeof(struct\~in_addr)); .fi .SH DESCRIPTION Set the local device for a multicast socket. .P The argument for .BR setsockopt (2) is an .BR ip_mreqn (2type) or .\" net: IP_MULTICAST_IF setsockopt now recognizes struct mreq .\" Commit: 3a084ddb4bf299a6e898a9a07c89f3917f0713f7 (since Linux 3.5) .BR ip_mreq (2type) structure, or an .BR in_addr (2type) structure. (The kernel determines which structure is being passed based on the size passed in .IR size .) .SH ERRORS See .BR IPPROTO_IP (2const). See .BR setsockopt (2). See .BR ip (7). .SH HISTORY Linux 1.2. .SH SEE ALSO .BR IPPROTO_IP (2const), .BR in_addr (2type), .BR ip_mreqn (2type), .BR setsockopt (2), .BR ip (7)