IPv6 extension headers.

Implementation of IPv6 extension headers. More...

Detailed Description

Implementation of IPv6 extension headers.

See also
RFC 8200, section 4

Modules

 Support for IPv6 routing header extension
 GNRC implementation of IPv6 routing header extension.
 

Files

file  gnrc/ipv6/ext.h
 Definititions for IPv6 extension headers.
 

Functions

gnrc_pktsnip_tgnrc_ipv6_ext_build (gnrc_pktsnip_t *ipv6, gnrc_pktsnip_t *next, uint8_t nh, size_t size)
 Builds an extension header for sending. More...
 
gnrc_pktsnip_tgnrc_ipv6_ext_process_hopopt (gnrc_pktsnip_t *pkt, uint8_t *protnum)
 Processes a packet's payload as hop-by-hop option if protnum is pointing to a value equal to PROTNUM_IPV6_EXT_HOPOPT. More...
 
gnrc_pktsnip_tgnrc_ipv6_ext_process_all (gnrc_pktsnip_t *pkt, uint8_t *protnum)
 Processes a packet's extension headers after a potential initial hop-by-hop header. More...
 

Function Documentation

◆ gnrc_ipv6_ext_build()

gnrc_pktsnip_t* gnrc_ipv6_ext_build ( gnrc_pktsnip_t ipv6,
gnrc_pktsnip_t next,
uint8_t  nh,
size_t  size 
)

Builds an extension header for sending.

Parameters
[in]ipv6The IPv6 header. Can be NULL.
[in]nextThe next header. Must be a successor to ipv6 if it is not NULL.
[in]nhProtocol Numbers of the next header.
[in]sizeSize of the extension header.
Returns
The extension header on success.
NULL, on error.

◆ gnrc_ipv6_ext_process_all()

gnrc_pktsnip_t* gnrc_ipv6_ext_process_all ( gnrc_pktsnip_t pkt,
uint8_t *  protnum 
)

Processes a packet's extension headers after a potential initial hop-by-hop header.

Note
Should be called by IPv6 after gnrc_ipv6_ext_process_hopopt(), i.e. the (first) hop-by-hop option should already be marked in pkt. If a hop-by-hop option is found in gnrc_pktsnip_t::data of pkt, the function will return an error.
Parameters
[in]pktAn IPv6 packet in receive order.
[in,out]protnumIn: The Protocol Numbers of gnrc_pktsnip_t::data of pkt (i.e. the first extension header to be processed).
Out: The Protocol Numbers of header in gnrc_pktsnip_t::data of pkt. The extension headers are now marked, so their data can be found in gnrc_pktsnip_t::next of pkt and the following.
If the return value is NULL, the value of protnum is undefined.
Returns
pkt with all extension headers marked until the first non-extension header.
NULL, if packet was consumed by the extension header handling.
NULL, on error (including if one of the extension headers was a hop-by-hop option). pkt is released with EINVAL in that case.

◆ gnrc_ipv6_ext_process_hopopt()

gnrc_pktsnip_t* gnrc_ipv6_ext_process_hopopt ( gnrc_pktsnip_t pkt,
uint8_t *  protnum 
)

Processes a packet's payload as hop-by-hop option if protnum is pointing to a value equal to PROTNUM_IPV6_EXT_HOPOPT.

Note
Should be called by IPv6 before any further processing (even forwarding-related) is done to pkt.
Parameters
[in]pktAn IPv6 packet in receive order. It assumed that gnrc_pktsnip_t::data points to a hop-by-hop option when protnum points to value equal to PROTNUM_IPV6_EXT_HOPOPT.
[in,out]protnumIn: The Protocol Numbers of gnrc_pktsnip_t::data of pkt.
Out: If protnum was PROTNUM_IPV6_EXT_HOPOPT on in and the return value is not NULL it points to the value of the next header field of the processed hop-by-hop option header. Since the hop-by-hop option header is now marked, gnrc_pktsnip_t::data of pkt will then be identified by protnum.
If protnum was PROTNUM_IPV6_EXT_HOPOPT on in and the return value is NULL the value protnum is pointing to is undefined.
If protnum unequal to PROTNUM_IPV6_EXT_HOPOPT on in the value protnum is pointing to remains unchanged.
Returns
pkt with the hop-by-hop option marked on success.
NULL, if the packet was consumed by the option handling.
NULL, on error. pkt is released with EINVAL in that case.