From 12d976f7b5c8b644f58bff9af6c2d299c0887f1b Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 6 Jul 2017 19:24:27 +0200 Subject: [PATCH] Emulate loopback: when sending an IP packet to one of our addresses, process it directly as input --- core/net/ip/tcpip.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/net/ip/tcpip.c b/core/net/ip/tcpip.c index bf6d328e4..35600e7c6 100644 --- a/core/net/ip/tcpip.c +++ b/core/net/ip/tcpip.c @@ -672,6 +672,15 @@ tcpip_ipv6_output(void) goto send_packet; } + /* We first check if the destination address is one of ours. There is no + * loopback interface -- instead, process this directly as incoming. */ + if(uip_ds6_is_my_addr(&UIP_IP_BUF->destipaddr)) { + LOG_INFO("output: sending to ourself\n"); + packet_input(); + return; + } + + /* Look for a next hop */ if((nexthop = get_nexthop(&ipaddr)) == NULL) { goto exit; }