From: John W. Linville Date: Thu, 27 Aug 2015 17:50:50 +0000 (-0400) Subject: af_packet: check Tx error X-Git-Tag: spdx-start~8390 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b89664c07b02ea7fb6f90210f1a6ae5b6e990787;p=dpdk.git af_packet: check Tx error Coverity CID # 13200 If sendto fails, the packets will not get transmitted. Return 0 as the number of packets transmitted. Signed-off-by: John W. Linville --- diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index cac26e5338..bfde661157 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -220,7 +220,8 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } /* kick-off transmits */ - sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0); + if (sendto(pkt_q->sockfd, NULL, 0, MSG_DONTWAIT, NULL, 0) == -1) + return 0; /* error sending -- no packets transmitted */ pkt_q->framenum = framenum; pkt_q->tx_pkts += num_tx;