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

# in\_pktinfo(2type)

information about the incoming packet

## NAME

in\_pktinfo - information about the incoming packet

## LIBRARY

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

## SYNOPSIS

```
#include <netinet/in.h>
```

```
struct in_pktinfo {
    unsigned int    ipi_ifindex;   /* Interface index */
    struct in_addr  ipi_spec_dst;  /* Local address */
    struct in_addr  ipi_addr;      /* Header Destination address */
};
```

## DESCRIPTION

### recvmsg(2)

When returned by [**recvmsg**(2)](/recvmsg/2.md)**,** *.ipi\_ifindex* is the unique index of the interface the packet was received on.

*.ipi\_spec\_dst* is the preferred source address for replies to the given packet.

*.ipi\_addr* is the destination address in the packet header.

These addresses are usually the same, but can differ for broadcast or multicast packets. Depending on the configured routes, *.ipi\_spec\_dst* might belong to a different interface from the one that received the packet.

### sendmsg(2)

If **IP\_PKTINFO** is passed to [**sendmsg**(2)](/sendmsg/2.md) and *.ipi\_spec\_dst* is not zero, then it is used as the local source address, for the routing table lookup, and for setting up IP source route options.

When *.ipi\_ifindex* is not zero, the primary local address of the interface specified by the index overwrites *.ipi\_spec\_dst* for the routing table lookup.

*.ipi\_addr* is ignored.

## STANDARDS

Linux.

## HISTORY

Linux 2.2.

## SEE ALSO

[**IP\_PKTINFO**(2const)](/IP_PKTINFO/2const.md), [**setsockopt**(2)](/setsockopt/2.md), [**ip**(7)](/ip/7.md)
