HAL: linux: Set socket protocol only for receive sockets

When creating raw sockets the protocol must be set to 0.

In case for receive sockets this means we will receive no packets until
we "bind" the socket with a non-zero protocol.

In case for only transmit sockets this avoids an expensive call packet
receiving function in kernel thats overflow internal receive socket
buffer.
pull/526/head
Denis Lazarev 11 months ago
parent 0593f348ea
commit bb7c77b900

@ -174,7 +174,7 @@ Ethernet_createSocket(const char* interfaceId, uint8_t* destAddress)
if (self) if (self)
{ {
self->rawSocket = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); self->rawSocket = socket(AF_PACKET, SOCK_RAW, 0);
if (self->rawSocket == -1) if (self->rawSocket == -1)
{ {

Loading…
Cancel
Save