---
name: "IP_MSFILTER"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/IP_MSFILTER"
---

# IP\_MSFILTER(2const)

multicast source filtering

## NAME

IP\_MSFILTER - multicast source filtering

## LIBRARY

Standard C library (*libc*, *-lc*)

## 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
};
```

## DESCRIPTION

This option provides access to the advanced full-state filtering API.

There are two macros, **MCAST\_INCLUDE** and **MCAST\_EXCLUDE**, which can be used to specify the filtering mode.

Additionally, the **IP\_MSFILTER\_SIZE**(n) macro exists to determine how much memory is needed to store *ip\_msfilter* structure with *n* sources in the source list.

For the full description of multicast source filtering refer to RFC 3376.

## ERRORS

See **IPRROTO\_IP**(2const). See [**setsockopt**(2)](/setsockopt/2.md). See [**ip**(7)](/ip/7.md).

## STANDARDS

Linux.

## HISTORY

Linux 2.4.22, Linux 2.5.68.

## SEE ALSO

[**IPPROTO\_IP**(2const)](/IPPROTO_IP/2const.md), [**setsockopt**(2)](/setsockopt/2.md), [**ip**(7)](/ip/7.md)
