1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_ipv6: do not forward link-local packets

This commit is contained in:
Oleg Hahm 2015-08-21 23:40:41 +02:00
parent 8977cc1175
commit 0c14734a02

View File

@ -687,8 +687,18 @@ static void _receive(gnrc_pktsnip_t *pkt)
/* redirect to next hop */
DEBUG("ipv6: decrement hop limit to %" PRIu8 "\n", hdr->hl - 1);
/* RFC 4291, section 2.5.6 states: "Routers must not forward any
* packets with Link-Local source or destination addresses to other
* links."
*/
if ((ipv6_addr_is_link_local(&(hdr->src))) || (ipv6_addr_is_link_local(&(hdr->dst)))) {
DEBUG("ipv6: do not forward packets with link-local source or"\
" destination address\n");
gnrc_pktbuf_release(pkt);
return;
}
/* TODO: check if receiving interface is router */
if (--(hdr->hl) > 0) { /* drop packets that *reach* Hop Limit 0 */
else if (--(hdr->hl) > 0) { /* drop packets that *reach* Hop Limit 0 */
gnrc_pktsnip_t *tmp = pkt;
DEBUG("ipv6: forward packet to next hop\n");