isotp[send|recv]: support PDU sizes greater than 4095

Allow PDU sizes greater than 4095 to be able to check the correct
implementation of the kernel socket API error handlings.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
Oliver Hartkopp
2014-10-24 20:41:11 +02:00
parent 0c61f2ac4c
commit 2fa9b0005b
2 changed files with 16 additions and 6 deletions
+4 -3
View File
@@ -56,6 +56,7 @@
#include <linux/can/isotp.h>
#define NO_CAN_ID 0xFFFFFFFFU
#define BUFSIZE 5000 /* size > 4095 to check socket API internal checks */
void print_usage(char *prg)
{
@@ -87,7 +88,7 @@ int main(int argc, char **argv)
__u32 force_rx_stmin = 0;
int loop = 0;
unsigned char msg[4096];
unsigned char msg[BUFSIZE];
int nbytes;
addr.can_addr.tp.tx_id = addr.can_addr.tp.rx_id = NO_CAN_ID;
@@ -194,8 +195,8 @@ int main(int argc, char **argv)
}
do {
nbytes = read(s, msg, 4096);
if (nbytes > 0 && nbytes < 4096)
nbytes = read(s, msg, BUFSIZE);
if (nbytes > 0 && nbytes < BUFSIZE)
for (i=0; i < nbytes; i++)
printf("%02X ", msg[i]);
printf("\n");