anyone has any idea on how to fill the sendto() when sending data trough a packet socket in linux? i can recvfrom() though.
---------------(soc)
char pkt[]="...blah..."; // my packet w/ 802.3 header and w/ LLC header
struct sockaddr_ll remote_host;
sd=socket(AF_PACKET,SOCK_RAW,htons(ETH_P_ALL));
bzero(&remote_host, sizeof(struct sockaddr_ll));
remote_host.sll_family = AF_PACKET;
remote_host.sll_ifindex = 2; // eth0
remote_host.sll_halen = ETH_ALEN; // 6 bytes
strcpy(remote_host.sll_addr,"\x00\x50\x56\xc0\x00\x01"); // destination host's mac
// "man packet" says filling only this 4 fields is enough for sending
sendto(sd, pkt, sizeof(pkt), 0, (struct sockaddr*)&remote_host, sizeof(struct sockaddr));
// returns -1 errno = Invalid argument
-------------(eoc)
pkt[] is a stp(spanning tree protocol) packet captured w/ ethereal(copy'ed/paste'd) so
it must be valid. but anyway, does sendto() refuse to send if pkt is ivalid?
i also tryed SOCK_DGRAM and still no luck
thank you in advance.