Re: [PATCH] can: isotp: return -ECOMM on FC timeout on TX path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28.04.2021 12:24:32, Oliver Hartkopp wrote:
> > Maybe the way to trigger the sk_error_report(sk) we might return '-1'
> > while the error is then propagated inside errno.
> 
> I added some debug print in isotpsend:
> 
> diff --git a/isotpsend.c b/isotpsend.c
> index 3ea574c..c2937fa 100644
> --- a/isotpsend.c
> +++ b/isotpsend.c
> @@ -45,10 +45,11 @@
>  #include <libgen.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> +#include <errno.h>
> 
>  #include <net/if.h>
>  #include <sys/ioctl.h>
>  #include <sys/socket.h>
>  #include <sys/types.h>
> @@ -252,10 +253,11 @@ int main(int argc, char **argv)
>                     buf[buflen] = ((buflen % 0xFF) + 1) & 0xFF;
>      }
> 
> 
>      retval = write(s, buf, buflen);
> +    printf("retval %d errno %d\n", retval, errno);

Note: in user space errno is only valid if retval is "-1"...

>      if (retval < 0) {
>             perror("write");
>             return retval;
>      }
> 
> 
> $ date +%S.%N && ./isotpsend vcan0 -s 123 -d 321 -D 44 -b && date +%S.%N
> 43.269173590
> retval 44 errno 0
> 44.271162277
> 
> So it waits for the timeout as required by the '-b' option - but the errno
> is not set :-/

I'm not sure what we have to return in the kernel...

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux