I want to send packets using packet_mmap for getting high packet transmission rate. I managed to send packets using packet socket in raw mode, which for that purpose I created L2, L3, and etc in buffer and send it using
sendto(fd_socket, NULL, 0, 0, NULL, sizeof(struct sockaddr_ll));
However, I don't want to bother with destination mac address. So I turned into using Dgram instead. If I want to employ sendto there is an argument for destination MAC Address. Even though this is not what I wished for in terms of not being concerned with arp cache and specifying destination's MAC address:
sendto(fd_socket, NULL, 0, 0, (struct sockaddr *) ps_sockaddr, sizeof(struct sockaddr_ll));
However I found that send is also allowed to be used with packet socket. http://man7.org/linux/man-pages/man7/packet.7.html Therefore, I filled the buffer with ip header and so on. In this case send returns zero as nothing is found to be sent, which I expect to be something other than zero, if there is an error with transmission of packet.
Is there a way to use packet_mmap without being concerned about L2 address?