2018-12-03 03:28 AM
I'm trying to create a project on the Nucleo-STM32H743ZI, in which I want to implement the ICMP protocol on remote hosts. I took the example of LWIP contrib-2.0.1. The problem is that when creating a RAW SOCKET, it always returns -1.
socket = lwip_socket (AF_INET, SOCK_RAW, IPPROTO_ICMP);
In this case, if you create a SOCK_DGRAM or SOCK_STREAM, then everything is successfully created.
What am I doing wrong?
2019-05-13 09:41 PM
I have a similar situation!
2019-12-26 01:04 AM
I have a same problem. TAlex.1, did you find some solution?
2019-12-26 01:30 AM
You need to rebuild LWIP with LWIP_RAW defined in lwipopts.h in order to include RAW socket support. It seems it is not defined by default.
Regards,
Alexander
2019-12-26 01:56 AM
LWIP_RAW is defined in my code. It's looks like thread freezing, diagnostic messages and Socket Debug messages are not displaying in this case. Howewer, if type of socket are SOCK_DGRAM or SOCK_STREAM, everything is OK
if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0) {
puts("PING socket error");
return;
}
printf("Socket No %u created\r\n", s);
2019-12-28 01:56 AM
You can't expect higher layers and APIs (especially thread-safe ones) to work, while lower layers are flawed and blatantly violating multithreading and other requirements.