net: Handle IPv6 packet reception

When read from the Rx FIFO, pass the network buffer to the uIP IPv6
stack using the tcpip_input() function. As the event is handled, not
all cases where the buffer is to be discarded can be detected.
Thus, if ICMPv6 errors will not be sent, indicate that the packet is
to be dropped by setting its length to zero.

Change-Id: I49f69011685e39759ba25ebb07670308382a5ca8
Signed-off-by: Patrik Flykt <patrik.flykt@linux.intel.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Patrik Flykt 2015-05-26 13:45:40 +03:00 committed by Anas Nashif
commit 586f3adf6e
3 changed files with 3 additions and 10 deletions

View file

@ -535,12 +535,7 @@ eventhandler(process_event_t ev, process_data_t data, struct net_buf *buf)
#endif /* UIP_UDP */
case PACKET_INPUT:
if (!packet_input(buf)) {
/* failure, discard the net_buf here because the
* return value cannot be passed to driver any longer
*/
net_buf_put(buf);
}
packet_input(buf);
break;
};
}

View file

@ -1545,6 +1545,7 @@ uip_process(struct net_buf *buf, uint8_t flag)
uip_icmp6_error_output(buf, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
goto send;
#else
uip_len(buf) = 0;
goto drop;
#endif

View file

@ -347,15 +347,12 @@ static void net_rx_fiber(void)
NET_DBG("Starting RX fiber\n");
while (1) {
/* Wait next packet from network */
buf = nano_fifo_get_wait(&netdev.rx_queue);
/* Check stack usage (no-op if not enabled) */
analyze_stacks(buf, &buf);
/* TBD: Pass it to IP stack */
net_buf_put(buf);
tcpip_input(buf);
}
}