Problem writing a packet to the network.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Amith wrote:

Amith wrote:

hi all,
i tried to write a packet (for fun) in ARP format (which i build) to the network - i wrote this code below with help looking at the man pages for "packet". I could read ARP packets but when i tried to write one - the code fails - i get an error message printed by perror which says
" Write failed :No such device or address"
Could somebody point out what i have missed out . The arp.h header file is mine and have pasted its contents below.
Thank you.
-Amith


A correction : i had sent the code as follows - the array index seem to be not proper - i had changed it to 0,1,2...5 later on... Sorry for the error.


before:

pkt->ether.source_addr[0] = 0x00;
pkt->ether.source_addr[1] = 0x50;
pkt->ether.source_addr[0] = 0xBA;   /* my MAC Address */
pkt->ether.source_addr[0] = 0x88;
pkt->ether.source_addr[0] = 0x15;
pkt->ether.source_addr[0] = 0xF9;

Now:

pkt->ether.source_addr[0] = 0x00;
pkt->ether.source_addr[1] = 0x50;
pkt->ether.source_addr[2] = 0xBA;   /* my MAC Address */
pkt->ether.source_addr[3] = 0x88;
pkt->ether.source_addr[4] = 0x15;
pkt->ether.source_addr[5] = 0xF9;

even after the changes - the code doesn't work - it gives me the same error - someone please let me know what's wrong with the code .

thank you. -amith



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/





--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux