Replaced a memory comparison in the PCap handling code with an equivalent integer comparison.
This commit is contained in:
11
src/ne2000.c
11
src/ne2000.c
@@ -1515,6 +1515,8 @@ void ne2000_poller(void *p)
|
|||||||
struct queuepacket *qp;
|
struct queuepacket *qp;
|
||||||
const unsigned char *data;
|
const unsigned char *data;
|
||||||
struct pcap_pkthdr h;
|
struct pcap_pkthdr h;
|
||||||
|
uint32_t mac_cmp32[2];
|
||||||
|
uint16_t mac_cmp16[2];
|
||||||
|
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
@@ -1538,7 +1540,14 @@ if(net_is_pcap && net_pcap!=NULL)
|
|||||||
{
|
{
|
||||||
data=_pcap_next(net_pcap,&h);
|
data=_pcap_next(net_pcap,&h);
|
||||||
if(data==0x0){goto WTF;}
|
if(data==0x0){goto WTF;}
|
||||||
if((memcmp(data+6,maclocal,6))==0)
|
/* Received. */
|
||||||
|
mac_cmp32[0] = *(uint32_t *) (data+6);
|
||||||
|
mac_cmp16[0] = *(uint16_t *) (data+10);
|
||||||
|
/* Local. */
|
||||||
|
mac_cmp32[1] = *(uint32_t *) (maclocal);
|
||||||
|
mac_cmp16[1] = *(uint16_t *) (maclocal+4);
|
||||||
|
// if((memcmp(data+6,maclocal,6))==0)
|
||||||
|
if ((mac_cmp32[0] == mac_cmp32[1]) && (mac_cmp16[0] == mac_cmp16[1]))
|
||||||
ne2000_log("ne2000 we just saw ourselves\n");
|
ne2000_log("ne2000 we just saw ourselves\n");
|
||||||
else {
|
else {
|
||||||
if((ne2000->DCR.loop == 0) || (ne2000->TCR.loop_cntl != 0))
|
if((ne2000->DCR.loop == 0) || (ne2000->TCR.loop_cntl != 0))
|
||||||
|
Reference in New Issue
Block a user