diff --git a/eth_interface.c b/eth_interface.c index 2883aeb..178c995 100644 --- a/eth_interface.c +++ b/eth_interface.c @@ -138,7 +138,14 @@ void ethinf_receive(EthInterface *intf, const RawPckt *rawPckt) { } void ethinf_transmit(EthInterface *intf, const RawPckt *rawPckt) { - if (mq_push(intf->txQ, rawPckt)) { // push packet onto the message queue + // if link is down, discard packets + if (!ethinf_get_link_state(intf)) { + dynmem_free(rawPckt->payload); + return; + } + + // push packet onto the message queue + if (mq_push(intf->txQ, rawPckt)) { ethinf_push_notification(intf, ETH_IIE_TRANSMIT_NOTIFY, 0); // notify processing thread of the peding transmit } else { ERROR("Interface TRANSMIT queue full, packet dropped!\n");