WinPCap and Bochs?

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.
pcmattman
Member
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:

WinPCap and Bochs?

Post by pcmattman »

I'm trying to test networking in my OS but it doesn't work too well.

ARP requests are picked up without any problems at all. However, any other type of packet addressed directly to my OS does not reach my OS. Any network-wide broadcast (MAC FF:FF:FF:FF:FF:FF) reaches my OS.

Is this a problem with WinPCap or is it a problem with the config?
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Do you reply to the ARP requests? Do you send out some other packets? If you send packets, can you see those from the other side of the network?

I mean, it could be that if you are simply listening, at some point of the chain some piece of code thinks there's nothing within Bochs to receive the packets. Just speculating though.

The other thing that could theoretically go wrong would be a firewall on your host that blocks your packets.. had this happen to me a few times.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
pcmattman
Member
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:

Post by pcmattman »

Firewall is disabled.

The ARP requests are replied to, I check Window's ARP cache afterwards and the MAC and IP are there.

My OS picks up packets that are broadcasted to the whole network (ARP requests are sent to everyone).

Any packets sent from Windows don't work at all. I can point you to code if you need it.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

It might actually be.. worth "testing" your bochs networking setup with another OS just so you know you've configured everything correctly.. instead of.. testing while developing your OS. :wink:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
pcmattman
Member
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:

Post by pcmattman »

You know, that's actually a really good idea.

Either way, my OS won't receive any packets that are addressed directly to it.

I'll have to find a disk image of an OS that supports networking :?
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Pickup some firewall linux or some such. Some of them come on floppies (or on small ISOs at least).
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
pcmattman
Member
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:

Post by pcmattman »

I'll just test with my Ubuntu live CD.

Fingers crossed :D
pcmattman
Member
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:

Post by pcmattman »

Just a small note: packets sent from my OS work properly (as long as they are also sent to the entire subnet).

IMHO it's something to do with Bochs and WinPCap or my connection settings. Has anyone else been able to setup WinPCap on their system?

WinDump lines:

Code: Select all

14:12:27.957378 arp who-has 192.168.1.109 tell Matthew
14:12:27.978649 arp reply 192.168.1.109 is-at b0:c4:20:00:00:00 (oui Unknown)
...
14:13:20.888136 IP Matthew > 192.168.1.109: ICMP echo request, id 512, seq 38144, length 40
And then nothing. My OS doesn't receive the ICMP packets (doesn't recieve any).

OS output:

Code: Select all

                                                             14:28: 8 13/ 4/ 7 M

NE2K Comapatible NIC, iobase=0xc100, irq 11, [b0:c4:20:0:0:0]
Ethernet: New network adapter, index 0
Becoming 192.168.1.109: OK
NE2000: Packet Recieved
ARP Packet
ARP: who has 192.168.1.109 - tell 192.168.1.110 (0:f:ea:a0:15:af), sending reply
NE2000: Packet Transmitted
NE2000: Packet Recieved
IP Packet
UDP Packet
NE2000: Packet Recieved
NE2000: Packet Recieved
IP Packet
UDP Packet
NE2000: Packet Recieved
IP Packet
UDP Packet
The UDP packets are network-wide broadcasts (hence the reason why they arrive).

Edit: more testing... same thing every time. Although this time something very interesting happened - the IRQ changed from 11 to 0 meaning something overwrote the memory.
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Did Linux work?
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
pcmattman
Member
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:

Post by pcmattman »

Couldn't detect the network hardware.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

pcmattman wrote:Couldn't detect the network hardware.
Does Bochs only emulate ne2k ISA? QEMU supports both ISA/PCI models.. and a few other net cards.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
pcmattman
Member
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:

Post by pcmattman »

I'm using Bochs, ne2k on PCI. I don't know how to use networking in QEMU, but I'll look into it.
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Have you tried putting your card into promiscuous mode to let it receive all packets? I mean it could be an issue with the ethernet addresses...
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
pcmattman
Member
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:

Post by pcmattman »

How do I do that in Windows?
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Well normally sniffers do that automatically. But I ment the Ne2k inside Bochs. Seems to be bit 4 in RCR..
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Post Reply