---
name: "nfq_ip6_mangle"
section: "3"
platform: "linux"
package: "libnetfilter-queue-doc"
version: "1.0.5-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nfq_ip6_get_hdr"
---

# nfq\_ip6\_mangle(3)

IPv6 helper functions

Part of [nfq\_ip6\_get\_hdr(3)](/nfq_ip6_get_hdr/3.md).

## NAME

ipv6 - IPv6 helper functions

## SYNOPSIS

### Functions

struct ip6\_hdr \* **nfq\_ip6\_get\_hdr** (struct pkt\_buff \*pktb)\
 int **nfq\_ip6\_set\_transport\_header** (struct pkt\_buff \*pktb, struct ip6\_hdr \*ip6h, uint8\_t target)\
 int **nfq\_ip6\_mangle** (struct pkt\_buff \*pktb, unsigned int dataoff, unsigned int match\_offset, unsigned int match\_len, const char \*rep\_buffer, unsigned int rep\_len)\
 int **nfq\_ip6\_snprintf** (char \*buf, size\_t size, const struct ip6\_hdr \*ip6h)\

## Detailed Description

## Function Documentation

### struct ip6\_hdr \* nfq\_ip6\_get\_hdr (struct pkt\_buff \* pktb)

nfq\_ip6\_get\_hdr - get IPv6 header

**Parameters**

*pktb* Pointer to user-space network packet buffer

**Returns**

pointer to IPv6 header if a valid header found, else NULL.

Definition at line **36** of file **ipv6.c**.

### int nfq\_ip6\_mangle (struct pkt\_buff \* pktb, unsigned int dataoff, unsigned int match\_offset, unsigned int match\_len, const char \* rep\_buffer, unsigned int rep\_len)

nfq\_ip6\_mangle - mangle IPv6 packet buffer

**Parameters**

*pktb* Pointer to user-space network packet buffer \
 *dataoff* Offset to layer 4 header \
 *match\_offset* Offset to content that you want to mangle \
 *match\_len* Length of the existing content you want to mangle \
 *rep\_buffer* Pointer to data you want to use to replace current content \
 *rep\_len* Length of data you want to use to replace current content

**Returns**

1 for success and 0 for failure. See **pktb\_mangle()** for failure case

**Note**

This function updates the IPv6 length (if necessary)

Definition at line **131** of file **ipv6.c**.

### int nfq\_ip6\_set\_transport\_header (struct pkt\_buff \* pktb, struct ip6\_hdr \* ip6h, uint8\_t target)

nfq\_ip6\_set\_transport\_header - set transport header pointer for IPv6 packet

**Parameters**

*pktb* Pointer to user-space network packet buffer \
 *ip6h* Pointer to IPv6 header \
 *target* Protocol number to find transport header (ie. IPPROTO\_\*)

**Returns**

1 if the protocol has been found and the transport header has been set, else 0.

Definition at line **64** of file **ipv6.c**.

### int nfq\_ip6\_snprintf (char \* buf, size\_t size, const struct ip6\_hdr \* ip6h)

nfq\_ip6\_snprintf - print IPv6 header into one buffer in iptables LOG format

**Parameters**

*buf* Pointer to buffer that is used to print the object \
 *size* Size of the buffer (or remaining room in it). \
 *ip6h* Pointer to a valid IPv6 header.

**Returns**

same as snprintf

**See also**

[**snprintf**(3)](/snprintf/3.md)

Definition at line **158** of file **ipv6.c**.

## Author

Generated automatically by Doxygen for libnetfilter\_queue from the source code.
