Packets not arriving
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Packets not arriving
I've finally been able to send IP packets from my OS without any problems. The sniffer I have setup detects them coming out.
The problem is, Windows still doesn't recognize them. Pinging my OS still times out, even though it is clear that the packet makes it to my PC.
Any ideas?
The problem is, Windows still doesn't recognize them. Pinging my OS still times out, even though it is clear that the packet makes it to my PC.
Any ideas?
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
No... I still receive packets with promiscuous mode on. Without it it doesn't work.
I have forgotten the offsets from the io address of PAR0-PAR5 (which makes my life very difficult).
Edit: Code to get the physical address:
Without promiscuous mode, it just plain doesn't work...
I have forgotten the offsets from the io address of PAR0-PAR5 (which makes my life very difficult).
Edit: Code to get the physical address:
Code: Select all
// useful variables
int wordlen = 2;
int i;
uint8_t buffer[32];
outportb(data->ioAddress + REMOTEBYTECOUNT0, 0x20);
outportb(data->ioAddress + REMOTEBYTECOUNT1, 0x00);
outportb(data->ioAddress + REMOTESTARTADDRESS0, 0x00);
outportb(data->ioAddress + REMOTESTARTADDRESS1, 0x00);
outportb(data->ioAddress + COMMAND, E8390_START | E8390_NODMA | E8390_PAGE0);
for(i=0; i<32; i+=2)
{
buffer[i] = inportb(data->ioAddress + IOPORT);
buffer[i+1] = inportb(data->ioAddress + IOPORT);
if(buffer[i] != buffer[i+1])
wordlen = 1;
}
if(wordlen == 2)
{
data->wordMode = 1;
for(i=0; i<16; i++)
data->saprom[i] = buffer[i*2];
outportb(data->ioAddress + DATACONFIGURATION, 0x48 );
return;
}
else
{
data->wordMode = 0;
}
Our Wiki links to http://www.national.com/pf/DP/DP8390D.html for data.
Maybe it helps.
Anyway, my theory is that you either have the MAC wrong, or you are sending it in wrong order (either in network packets, or in ARP packets).
Maybe it helps.
Anyway, my theory is that you either have the MAC wrong, or you are sending it in wrong order (either in network packets, or in ARP packets).
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Which order should it be?
ARP packets work, the handler just swaps the destination and source address fields.
Edit: the OS gets the correct MAC and sends it correctly (I looked at the ARP cache).
ARP packets work, the handler just swaps the destination and source address fields.
Edit: the OS gets the correct MAC and sends it correctly (I looked at the ARP cache).
Last edited by pcmattman on Sat Apr 14, 2007 9:46 pm, edited 1 time in total.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Packets sent are OK... ATM it's receiving them. Disabling promiscuous mode basically stopped my OS from receiving any packets, apart from ARP requests because they are a broadcast.
How exactly am I meant to get a MAC address out of the PAR0-PAR5 registers? I tried it but it didn't work (I got 0:0:0:0:0:0).
Edit: I'd prefer to fix the receive problem first, then when I get around to sending data I can send you an image.
I believe that the problem is with my MAC address that I have retrieved - when Windows receives the ICMP packet and finds that it's come from the wrong address it gets confused.
Edit 2: This is the ethernet layer of sending, which isn't used for ARP packets:
It could be a problem here that causes the problem.
How exactly am I meant to get a MAC address out of the PAR0-PAR5 registers? I tried it but it didn't work (I got 0:0:0:0:0:0).
Edit: I'd prefer to fix the receive problem first, then when I get around to sending data I can send you an image.
I believe that the problem is with my MAC address that I have retrieved - when Windows receives the ICMP packet and finds that it's come from the wrong address it gets confused.
Edit 2: This is the ethernet layer of sending, which isn't used for ARP packets:
Code: Select all
int sendPacketEthernet(struct ethernet_t *eth, packet_t *p)
{
struct ethHeader_t *ethPkt;
packet_t *pkt;
pkt = packetAddHeader(sizeof(struct ethHeader_t), p);
if(!pkt || !pkt->data)
{
return 0;
}
// the real length
int packlen = pkt->len;
ethPkt = (struct ethHeader_t *)pkt->data;
int i = 0;
/** at the moment the destination is hard-coded, so we don't have to keep an ARP cache **/
ethPkt->dest[i++] = 0x00;
ethPkt->dest[i++] = 0x0F;
ethPkt->dest[i++] = 0xEA;
ethPkt->dest[i++] = 0xA0;
ethPkt->dest[i++] = 0x15;
ethPkt->dest[i] = 0xAF;
memcpy(ethPkt->src, eth->macAddr, 6);
ethPkt->type = htons(ETHER_FRAME_IP);
// send the packet
eth->send(eth, pkt);
return 1;
}
Last edited by pcmattman on Sat Apr 14, 2007 9:59 pm, edited 1 time in total.
Hehe, I know exactly as much as the datasheets say. I've never tried to program a ne2k driver (that's on TODO list ofcourse, but I've not started with that yet) so no idea.. well other than what the datasheets tell... which I don't feel like reading right now...
But I still offer to try to sniff packets sent by your current driver, to see if they can offer any insight into what is going on..
But I still offer to try to sniff packets sent by your current driver, to see if they can offer any insight into what is going on..
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Oh well, I'll just have to keep working at it
IMHO Windows is sending the packet, all well and good, then when it receives the reply it checks that the addresses and such match, in this case they probably don't...
The image is online now - ne2k_testing.img (CVS)... You just have to ping 192.168.1.109 and it should come up with the ARP request receive. Then nothing. If you want one which replies (ie. promiscuous mode) ask.
Edit: this is what the sniffer gets in promiscuous mode:
Should work... but doesn't, raw packet display:
Any ideas?
IMHO Windows is sending the packet, all well and good, then when it receives the reply it checks that the addresses and such match, in this case they probably don't...
The image is online now - ne2k_testing.img (CVS)... You just have to ping 192.168.1.109 and it should come up with the ARP request receive. Then nothing. If you want one which replies (ie. promiscuous mode) ask.
Edit: this is what the sniffer gets in promiscuous mode:
Code: Select all
14:22:52.504254 IP Matthew > 192.168.1.109: ICMP echo request, id 512, seq 257, length 40
14:22:52.516217 IP 192.168.1.109 > Matthew: ICMP echo reply, id 512, seq 257, length 40
Code: Select all
14:24:18.004407 IP Matthew > 192.168.1.109: ICMP echo request, id 512, seq 1537, length 40
E..<I)....ml...n...m..E[....abcdefghijklmnopqrstuvwabcdefghi
14:24:18.010338 IP 192.168.1.109 > Matthew: ICMP echo reply, id 512, seq 1281, length 40
E..<[email protected]
Code: Select all
<07:27:11|root@wall:~># arp
Address HWtype HWaddress Flags Mask Iface
192.168.1.109 ether B0:C4:20:00:00:00 C eth1
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
I told you that ARP requests work... try pinging it.mystran wrote:Seems fine... let's see if I can dig something else out of the thing..Code: Select all
<07:27:11|root@wall:~># arp Address HWtype HWaddress Flags Mask Iface 192.168.1.109 ether B0:C4:20:00:00:00 C eth1
Edit: I decoded the raw packet for the ICMP ping, the MAC addresses are:
Code: Select all
Sent packet:
From: 00 0F EA A0 15 AF
To: 00 B0 C4 20 FF A1
Reply:
From: 00 B0 C4 20 FF A1
To: 00 0F EA A0 15 AF
Edit 2: I dissected the raw packets and everything is right. I'm seriously stuck now. BTW, did I give you the promiscuous mode one, or the non-promiscuous mode one? And have you tried to ping it?
Edit 3: I'm uploading a promiscuous mode image so you have a point of comparison.
Hmmh.. for ARP packets, the MAC it prints for the sender is indeed what it should be...
But the image you gave me doesn't seem to be able to receive anything... I'd need the promiscuous version.
B0:C0:20:00:00:00 is what Bochs defaults to... or have you changed your Bochs to use 00:B0:C4:20:FF:A1 instead?
hmmh..
But the image you gave me doesn't seem to be able to receive anything... I'd need the promiscuous version.
Hmh... how does that sound right to you?Code: Select all
Sent packet: From: 00 0F EA A0 15 AF To: 00 B0 C4 20 FF A1 Reply: From: 00 B0 C4 20 FF A1 To: 00 0F EA A0 15 AF
B0:C0:20:00:00:00 is what Bochs defaults to... or have you changed your Bochs to use 00:B0:C4:20:FF:A1 instead?
hmmh..
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.