summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0c61f2a)
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>
#include <linux/can/isotp.h>
#define NO_CAN_ID 0xFFFFFFFFU
#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)
{
void print_usage(char *prg)
{
__u32 force_rx_stmin = 0;
int loop = 0;
__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;
int nbytes;
addr.can_addr.tp.tx_id = addr.can_addr.tp.rx_id = NO_CAN_ID;
- 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");
for (i=0; i < nbytes; i++)
printf("%02X ", msg[i]);
printf("\n");
#include <linux/can/isotp.h>
#define NO_CAN_ID 0xFFFFFFFFU
#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)
{
void print_usage(char *prg)
{
int opt;
extern int optind, opterr, optopt;
__u32 force_tx_stmin = 0;
int opt;
extern int optind, opterr, optopt;
__u32 force_tx_stmin = 0;
- unsigned char buf[4096];
+ unsigned char buf[BUFSIZE];
addr.can_addr.tp.tx_id = addr.can_addr.tp.rx_id = NO_CAN_ID;
addr.can_addr.tp.tx_id = addr.can_addr.tp.rx_id = NO_CAN_ID;
- while (buflen < 4096 && scanf("%hhx", &buf[buflen]) == 1)
+ while (buflen < BUFSIZE && scanf("%hhx", &buf[buflen]) == 1)
+ retval = write(s, buf, buflen);
+ if (retval < 0) {
+ perror("write");
+ return retval;
+ }
+
+ if (retval != buflen)
+ fprintf(stderr, "wrote only %d from %d byte\n", retval, buflen);
/*
* due to a Kernel internal wait queue the PDU is sent completely
/*
* due to a Kernel internal wait queue the PDU is sent completely