udp test
udp test
Hello,
I have a situation:
My system is able to send UDP packet to remote IP. I'm using windump (it shows network traffic), so i'm 100 % sure, that these packets i'm sending, are definitly UDP, and their's local and remote IPs and ports are correct. To test if it really works, i have connected some other computer to my 'host' machine (this is the machine on which bochs with my system is running), on both computers is windump up and running. Then i have written a pretty simple UDP server, that can detect incoming connection, notice me about this fact, and then it will just print the incoming data on the screen.
I have tried it with UDP netcat, and it works perfectly. But when i try to send UDP packet from my system, server does nothing.
I can see (according to windump) how the packet left the host machine (bochs is configured to use real netcard) with correct source and destination IPs and ports - and then i can see that very packet coming to that other computer (again, according to windump), but the server (that crappy app i have written for testing purposes) does nothing.
So again: the packet get properly received by the other computer, but it does not go futher (to my app).
Any ideas, what could be wrong?
I have a situation:
My system is able to send UDP packet to remote IP. I'm using windump (it shows network traffic), so i'm 100 % sure, that these packets i'm sending, are definitly UDP, and their's local and remote IPs and ports are correct. To test if it really works, i have connected some other computer to my 'host' machine (this is the machine on which bochs with my system is running), on both computers is windump up and running. Then i have written a pretty simple UDP server, that can detect incoming connection, notice me about this fact, and then it will just print the incoming data on the screen.
I have tried it with UDP netcat, and it works perfectly. But when i try to send UDP packet from my system, server does nothing.
I can see (according to windump) how the packet left the host machine (bochs is configured to use real netcard) with correct source and destination IPs and ports - and then i can see that very packet coming to that other computer (again, according to windump), but the server (that crappy app i have written for testing purposes) does nothing.
So again: the packet get properly received by the other computer, but it does not go futher (to my app).
Any ideas, what could be wrong?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: udp test
Are you using the correct destination MAC address? Is your server listening on the correct interface (i.e. not from localhost only)?
Re: udp test
whoups, MACs are set to fake values...i'll try to set them right.
Re: udp test
So really no idea what can be wrong? I noticed that checksum field is zeroed, it could be it? But according to what i have read about udp - when ipv4 is used, no checksum have to be provided. Source MAC is also faked, but that does not matter i guess..am i right? Destination MAC is correct.
Any guesses? Seriously, anything.
Any guesses? Seriously, anything.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: udp test
"Then i have written a pretty simple UDP server, that can detect incoming connection"
...UDP doesn't have connections...
...UDP doesn't have connections...
Re: udp test
..... I know that .. I guess that you know how i ment it, but ok, correction: 'it is able to detect if incoming data are available' ..
Re: udp test
Actually there are 2 checksum fields. One for IP header and another one for UDP. UDP's checksum is optional and can use all-zeros value. But what about IP's one?
If something looks overcomplicated, most likely it is.
Re: udp test
I'm not sure, if IP checksum is mandatory or not. I'll try to cumpute that checksum and see if it helps.
Re: udp test
IP checksum corrected, no effect.
Re: udp test
Solved. For those that are interrested: for proper receive of UDP packet (from netcard memory to software layer) you must have correct IP's and UDP's checksumes (even if ipv4 is used - datasheet is wrong about this..), IP and UDP length field must also be correct.
Source ip/port and MAC can be any value i guess, but you have to always calculate checksumes properly - altough the netcard will receive it, but OS software layer will discard it. (which was subject of this topic).
You may lock this topic.
Source ip/port and MAC can be any value i guess, but you have to always calculate checksumes properly - altough the netcard will receive it, but OS software layer will discard it. (which was subject of this topic).
You may lock this topic.