From a20fafa332fe36d47f32d346fb0a54f1fc3271d3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 11 Oct 2013 10:48:00 -0600 Subject: Changed the meaning of the uip_*input functions. They now return success when a packet is dropped; This is needed for the ENCX24J600 driver that must make a decision to return the packet or not: It should not retain dropped packets. From Max Holtzberg --- nuttx/net/uip/uip_input.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'nuttx/net/uip/uip_input.c') diff --git a/nuttx/net/uip/uip_input.c b/nuttx/net/uip/uip_input.c index 73773b0ed..3dffcf062 100644 --- a/nuttx/net/uip/uip_input.c +++ b/nuttx/net/uip/uip_input.c @@ -292,7 +292,11 @@ nullreturn: * Description: * * Returned Value: - * OK if packet could be processed, otherwise ERROR. + * OK The packet was processed (or dropped) and can be discarded. + * ERROR There is a matching connection, but could not dispatch the packet + * yet. Currently useful for UDP when a packet arrives before a recv + * call is in place. + * * * Assumptions: * @@ -431,7 +435,7 @@ int uip_input(struct uip_driver_s *dev) { nlldbg("Possible ping config packet received\n"); uip_icmpinput(dev); - goto done; + goto drop; } else #endif @@ -537,13 +541,16 @@ int uip_input(struct uip_driver_s *dev) goto drop; } - /* Return and let the caller do any actual transmission. */ + /* Return and let the caller do any pending transmission. */ return OK; + /* Drop the packet. NOTE that OK is returned meaning that the + * packet has been processed (although processed unsuccessfully). + */ + drop: dev->d_len = 0; - - return ERROR; + return OK; } #endif /* CONFIG_NET */ -- cgit v1.2.3