Skip to content

Commit bbe8f58

Browse files
authored
osd/netdev/pcap.cpp: Fix inverted success/failure return from send() (#15874)
* osd/netdev/pcap.cpp: Fix inverted success/failure return from send(). pcap_sendpacket() returns 0 on success and PCAP_ERROR on failure, but netdev_pcap::send() was returning the byte count only when the call failed and 0 on success. * osd/netdev/pcap.cpp: Remove orphaned dead comment in send().
1 parent ed697c3 commit bbe8f58

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/osd/modules/netdev/pcap.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ int pcap_module::netdev_pcap::send(void const *buf, int len)
231231
}
232232
int ret = (*m_module.pcap_sendpacket_dl)(m_p, reinterpret_cast<const u_char *>(buf), len);
233233
printf("sent packet length %d, returned %d\n", len, ret);
234-
return ret ? len : 0;
235-
//return (!pcap_sendpacket_dl(m_p, reinterpret_cast<const u_char *>(buf), len)) ? len : 0;
234+
return !ret ? len : 0;
236235
}
237236

238237
int pcap_module::netdev_pcap::recv_dev(uint8_t **buf)

0 commit comments

Comments
 (0)