corrected data link receive of large packets that were reporting a actual PDU length but not loading the PDU.
This commit is contained in:
@@ -6,8 +6,8 @@ BASEDIR = .
|
||||
#CFLAGS = -Wall -I. -O2 -g
|
||||
# Note: you can strip out symbols using the strip command
|
||||
# to get an idea of how big the compile really is.
|
||||
#CFLAGS = -Wall -I. -g -DBACDL_ETHERNET=1
|
||||
CFLAGS = -Wall -I. -Iports/linux -g -DBACDL_BIP=1
|
||||
CFLAGS = -Wall -I. -g -DBACDL_ETHERNET=1
|
||||
#CFLAGS = -Wall -I. -Iports/linux -g -DBACDL_BIP=1
|
||||
|
||||
SRCS = ports/linux/main.c \
|
||||
ports/linux/ethernet.c \
|
||||
|
||||
@@ -357,6 +357,10 @@ uint16_t ethernet_receive(
|
||||
// copy the buffer into the PDU
|
||||
if (pdu_len < max_pdu)
|
||||
memmove(&pdu[0],&buf[17],pdu_len);
|
||||
// ignore packets that are too large
|
||||
else
|
||||
pdu_len = 0;
|
||||
|
||||
|
||||
return pdu_len;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
// buffers used for receiving
|
||||
static uint8_t Rx_Buf[MAX_MPDU] = {0};
|
||||
|
||||
#ifdef BACDL_BIP
|
||||
static int get_local_ifr_ioctl(char *ifname, struct ifreq *ifr, int request)
|
||||
{
|
||||
int fd;
|
||||
@@ -106,12 +107,11 @@ static void Init_Network(char *ifname)
|
||||
/* setup local address */
|
||||
get_local_address_ioctl(ifname, &local_address, SIOCGIFADDR);
|
||||
decode_network_address(&local_address, &octet1, &octet2, &octet3, &octet4);
|
||||
#ifdef BACDL_BIP
|
||||
bip_set_address(octet1, octet2, octet3, octet4);
|
||||
#endif
|
||||
fprintf(stderr,"IP Address: %d.%d.%d.%d\n",
|
||||
(int)octet1, (int)octet2, (int)octet3, (int)octet4);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Init_Device_Parameters(void)
|
||||
{
|
||||
|
||||
@@ -284,6 +284,8 @@ uint16_t bip_receive(
|
||||
pdu_len -= 4; /* BVLC header */
|
||||
if (pdu_len < max_pdu)
|
||||
memmove(&pdu[0],&buf[4],pdu_len);
|
||||
// ignore packets that are too large
|
||||
// clients should check my max-apdu first
|
||||
else
|
||||
pdu_len = 0;
|
||||
}
|
||||
|
||||
@@ -257,6 +257,10 @@ uint16_t ethernet_receive(
|
||||
// copy the buffer into the PDU
|
||||
if (pdu_len < max_pdu)
|
||||
memmove(&pdu[0],&buf[17],pdu_len);
|
||||
// ignore packets that are too large
|
||||
// client should check my max apdu first
|
||||
else
|
||||
pdu_len = 0;
|
||||
|
||||
return pdu_len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user