- EthIntf: automatically discard packets if link is down
This commit is contained in:
parent
7af522335d
commit
2e11cc00e9
@ -138,7 +138,14 @@ void ethinf_receive(EthInterface *intf, const RawPckt *rawPckt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ethinf_transmit(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
|
ethinf_push_notification(intf, ETH_IIE_TRANSMIT_NOTIFY, 0); // notify processing thread of the peding transmit
|
||||||
} else {
|
} else {
|
||||||
ERROR("Interface TRANSMIT queue full, packet dropped!\n");
|
ERROR("Interface TRANSMIT queue full, packet dropped!\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user