writing to raw sockets
hi i am new to linux socket programming and was studying about raw sockets.
i was able to read icmp packets through packet sockets=socket(PF_PACKET,SOCK_RAW,htons(ETH_P_ALL) );
The recvfrom functions returns bytes read as 98.
The total lenght field in ip header is 84.
Now i copy the same read packet , interchange the source and destination mac addresses as well as the source and destination ip addresses and send it using struct sockaddr_ll with sll_ifindex field set to 2(eth0 index on my comp).
but i am not able to send any packets.
its showing error=EINVAL.
i went throught the man pages and found that i need to add the physical layer headers myself. so i did first 7 bytes containg 0xaa and 8th byte as 0xab for standard 802.3 frames but i am still not able to send packets.
i will be grateful for any of yours help.
Thank you in advance.
maybe this is not the right place to post a programming query .
can anybody plz tell me a place where i can find help.
thanks in advance.