mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 01:53:51 +01:00
gnrc_ipv6: dispatch ext. headers to external interested parties
This way e.g. a raw socket listening for an extension headers protocol number also get's it.
This commit is contained in:
parent
e4fa14370f
commit
0580fa5852
@ -41,6 +41,9 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Demultiplex an extension header according to @p nh.
|
* @brief Demultiplex an extension header according to @p nh.
|
||||||
*
|
*
|
||||||
|
* This includes dispatching it to interested parties in the
|
||||||
|
* @ref net_gnrc_netreg.
|
||||||
|
*
|
||||||
* @param[in] pkt A packet with the first snip pointing to the extension
|
* @param[in] pkt A packet with the first snip pointing to the extension
|
||||||
* header to process.
|
* header to process.
|
||||||
* @param[in] nh Protocol number of @p pkt.
|
* @param[in] nh Protocol number of @p pkt.
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "utlist.h"
|
#include "utlist.h"
|
||||||
#include "net/gnrc/netif.h"
|
#include "net/gnrc/netif.h"
|
||||||
|
#include "net/gnrc/netreg.h"
|
||||||
#include "net/gnrc/pktbuf.h"
|
#include "net/gnrc/pktbuf.h"
|
||||||
#include "net/gnrc/icmpv6/error.h"
|
#include "net/gnrc/icmpv6/error.h"
|
||||||
#include "net/gnrc/ipv6.h"
|
#include "net/gnrc/ipv6.h"
|
||||||
@ -258,6 +259,24 @@ gnrc_pktsnip_t *gnrc_ipv6_ext_demux(gnrc_pktsnip_t *pkt, unsigned nh)
|
|||||||
gnrc_pktbuf_release(pkt);
|
gnrc_pktbuf_release(pkt);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (gnrc_netreg_num(GNRC_NETTYPE_IPV6, nh) > 0) {
|
||||||
|
gnrc_pktsnip_t *sub_pkt;
|
||||||
|
|
||||||
|
/* enforce duplication so we can dispatch packet to subscriber(s) and
|
||||||
|
* handle the packet */
|
||||||
|
gnrc_pktbuf_hold(pkt, 1);
|
||||||
|
sub_pkt = gnrc_pktbuf_start_write(pkt);
|
||||||
|
if (sub_pkt != NULL) {
|
||||||
|
/* check in case subscriber unregistered in the meantime */
|
||||||
|
if (gnrc_netapi_dispatch_receive(GNRC_NETTYPE_IPV6, nh, sub_pkt) == 0) {
|
||||||
|
gnrc_pktbuf_release(sub_pkt);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gnrc_pktbuf_release(pkt);
|
||||||
|
/* try to keep handling, the sockets aren't *that* important anyway :-P */
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (nh) {
|
switch (nh) {
|
||||||
case PROTNUM_IPV6_EXT_RH:
|
case PROTNUM_IPV6_EXT_RH:
|
||||||
#ifdef MODULE_GNRC_RPL_SRH
|
#ifdef MODULE_GNRC_RPL_SRH
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user