Problem with ARP

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Problem with ARP

Post by Klakap »

Good day!

I am started with developing network communication. I wrote driver for RTL8139 https://github.com/Klaykap/LightningOS/ ... /rtl8139.c, but I now have problem with my test with sending ARP. Wireshark didnt see any packet. Please what I am doing wrong?

Code: Select all

//ETHERNET PACKET II
	//preamble
	ic_buffer[0]=0x5555;
	ic_buffer[1]=0x5555;
	ic_buffer[2]=0x5555;
	ic_buffer[3]=0x55D5;

	//this packet is for this MAC
	ic_buffer[4]=0xFFFF;
	ic_buffer[5]=0xFFFF;
	ic_buffer[6]=0xFFFF;

	//this packet is from this MAC
	ic_buffer[7]=0x1111;
	ic_buffer[8]=0x1111;
	ic_buffer[9]=0x1111;

	//type
	ic_buffer[10]=0x0806;

	//DATA
	ic_buffer[11]=0x0001;
	ic_buffer[12]=0x0800;
	ic_buffer[13]=0x0406;
	ic_buffer[14]=0x0001; //request

	ic_buffer[15]=0x1111; //"my MAC"
	ic_buffer[16]=0x1111; //"my MAC"
	ic_buffer[17]=0x1111; //"my MAC"
	ic_buffer[18]=0x0000;
	ic_buffer[19]=0x0000;

	ic_buffer[20]=0xFFFF; //for all
	ic_buffer[21]=0xFFFF; //for all
	ic_buffer[22]=0xFFFF; //for all
	ic_buffer[23]=0x0000;
	ic_buffer[24]=0x0000;

	//PAD
	ic_buffer[25]=0x0000;
	ic_buffer[26]=0x0000;
	ic_buffer[27]=0x0000;
	ic_buffer[28]=0x0000;
	ic_buffer[29]=0x0000;
	ic_buffer[30]=0x0000;
	ic_buffer[31]=0x0000;
	ic_buffer[32]=0x0000;
	ic_buffer[33]=0x0000;

	//checksume(wrong)
	ic_buffer[34]=0x1111;
	ic_buffer[35]=0x1111;

	send_packet_rtl8139(70);
Thank for all answers!
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Problem with ARP

Post by iansjack »

One thing that does occur to me is that network packets are big-endian, whereas the X86 is little-endian. You should write functions to convert any multi=byte fields to the correct order.
Klakap
Member
Member
Posts: 297
Joined: Sat Mar 10, 2018 10:16 am

Re: Problem with ARP

Post by Klakap »

Thank, it was problem with my code, but it doesnt solve problem that wireshark doesnt see any packet.
Post Reply