1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #10562 from miri64/gnrc_ipv6/fix/hl0

gnrc_ipv6: fix hop-limit == 0 case
This commit is contained in:
Martine Lenders 2018-12-06 18:54:53 +01:00 committed by GitHub
commit be7e42a888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -811,6 +811,16 @@ static void _receive(gnrc_pktsnip_t *pkt)
/* extract header */
hdr = (ipv6_hdr_t *)ipv6->data;
if (hdr->hl == 0) {
/* This is an illegal value in any case, not just in case of a
* forwarding step, so *do not* check it together with ((--hdr->hl) > 0)
* in forwarding code below */
DEBUG("ipv6: packet was received with hop-limit 0\n");
gnrc_icmpv6_error_time_exc_send(ICMPV6_ERROR_TIME_EXC_HL, pkt);
gnrc_pktbuf_release_error(pkt, ETIMEDOUT);
return;
}
uint16_t ipv6_len = byteorder_ntohs(hdr->len);
if ((ipv6_len == 0) && (hdr->nh != PROTNUM_IPV6_NONXT)) {