From d9d3f7b6b5a3117ccb30b9523fd509e4eac75845 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 5 Apr 2010 21:05:56 +0000 Subject: [PATCH] Bugfix: don't send packets if they are shorter than the link layer header length --- tools/sky/uip6-bridge/sicslow_ethernet.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/sky/uip6-bridge/sicslow_ethernet.c b/tools/sky/uip6-bridge/sicslow_ethernet.c index 15ffbd63b..ef6e746b7 100644 --- a/tools/sky/uip6-bridge/sicslow_ethernet.c +++ b/tools/sky/uip6-bridge/sicslow_ethernet.c @@ -279,18 +279,20 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) } //Remove header from length before passing onward - uip_len -= UIP_LLH_LEN; - - //Some IP packets have link layer in them, need to change them around! - if (usbstick_mode.translate) { -/* uint8_t transReturn = */ + if(uip_len > UIP_LLH_LEN) { + uip_len -= UIP_LLH_LEN; + + //Some IP packets have link layer in them, need to change them around! + if (usbstick_mode.translate) { + /* uint8_t transReturn = */ mac_translateIPLinkLayer(ll_802154_type); - PRINTF("IPTranslation: returns %d\n", transReturn); - } + PRINTF("IPTranslation: returns %d\n", transReturn); + } - if (usbstick_mode.sendToRf){ - tcpip_output(destAddrPtr); -/* rndis_stat.txok++; */ + if (usbstick_mode.sendToRf){ + tcpip_output(destAddrPtr); + /* rndis_stat.txok++; */ + } } uip_len = 0;