Post by R.WieserPost by Mateusz VisteHow come your router needs to send 4 ARP packets to you? It should
stop after the first one that you answer to.
It doesn't. It sends it to the broadcast IP, with a zero MAC. And
as such there is, I think, nothing I should be answering to (but do
correct me if I'm wrong here).
I really don't know why your router would send a frame with a zeroed
MAC. Can you perform a tcpdump capture of the actual traffic? This would
help to clear out what it is that this router actually does, without
relying on assumptions.
Post by R.WieserPost by Mateusz VisteAnd why is the targeted machine only sending a single ARP
requests?
I can only guess to that I'm afraid. Maybe because it thinks the
router serves as a kind of server in this regard ?
Sounds quite esoteric to me. Again, I traffic dump would be helpful to
understand what's going on exactly.
Post by R.WieserThat would also explain why the router is responding to a broadcast
to a port it shouldn't have open.
TCP/UDP stacks respond to requests on ports that are closed. TCP sends
back a TCP/RST segment, while UDP usually answers with an ICMP "port
unreachable" message. In both cases, the machine needs to resolve
the MAC of the peer first, through an ARP query.
Post by R.WieserSure, if you don't mind looking at Assembly. Which parts do you want
to see ? And I hope you don't mind looking at a lot of experimental
code ... (some code added to the bottom)
I glanced through it, here are some thoughts:
You are returning from the callback routine with an IRET - why? This is
not an interrupt routine... The (commented out) retf would seem to be
the proper thing to do.
You are also overwriting CX with either 0 (when pkt rejected) or the
size of your buffer. I don't think you are supposed to do that, and I
wonder what kind of side effect it could lead to. CX is not for you to
fiddle with.
You are also trashing AH, which may or may not be a problem for the
packet driver. Simply said, your callback should not modify any
registers other than ES and DI.
The BIOS int 15h call for waiting might not do what you expect - while
it almost certainly will wait some 1ms or so, it might not do that in a
'power efficient' way. I did observe, at least on some BIOS
implementations, that this was implemented as a dumb busy loop.
Your code also gets stuck as soon as you receive a non-ARP frame, since
it jumps to SockUDPGetBlk2 without resetting gRcvSiz. You probably
meant to write "jmp @@SockUDPGetBlk1 ; Try again" instead.
HandleARP is not included, so I can't tell whether or not it is
resetting gRcvSiz properly.
Post by R.WieserBut, as mentioned, I think the basic problem is that my polling (for
the buffer to be filled) is simply too slow.
This would mean that you consistently receive multiple packets at the
very exactly same time. It is possible, but I doubt that is is what
happens.
Post by R.WieserThe whould "trouble" is that a system (the router) is responding to a
request not ment for it. Unplugging the hub (which connects the DOS
to the XP 'puter) from the router makes all of it go away.
A tcpdump traffic capture would tell us more. Is it *truly* a hub that
you use (as opposed to a switch)? If yes, then you could hook up some
extra Linux machine to it, and run:
tcpdump -ni eth0 -s0 -w capture.pcap
It would be interesting to look at capture.pcap then.
If it's a switch however, then the above won't work, as a switch is not
duplicating frames over all its ports. A wireshark dump from the XP
machine might tell us something, but best would be to place a
transparent bridge between the DOS PC and the switch, and do the
capture there.
Post by R.WieserPost by Mateusz VisteI use single-packet buffers in both EtherDFS and ethflop, along
with some crude retransmission code. Works as expected (ie. well).
In other words, it wouldn't be a bad idea to take a peek at it. :-)
Well, you can take a look of course, but I did not want to imply that
my code is by any measure a good example or the "right" way of doing
things. It works for me, though.
Post by R.WieserPost by Mateusz Visteexecuting an int 28h when no packet is found in the queue.
I could try that I suppose.
Until you have the true problem debugged, I'd rather recommend using a
stupid busy loop. You don't want adding new problems to the mix.
Post by R.WieserBut ... now you've mentioned it (and I'm stuck anyway :-) ) the time
has come to try it. Looking in RBIL I see SS:SP mentioned as having
to(?) point to the "top of MS-DOS stack for I/O functions". Any
remarks to that, or can I just keep it inside my program ?
To be honest I never bothered with that (and did not have any
related troubles). If you're unsure, you could use the alternative
INT 2F/AX=1680h instead. But in any case, as said previously, I think
it would be best to stick to a simple busy loop for now. Once it works,
then you may think about ways of making it eco-friendly.
Mateusz