Well we're arguing on an empty stomach here, neither of us knows too much yet without the logs but at the danger of seeming to be bickering

I'm going to reply because there seems to be a lot of misunderstandings we might as well clear up (don't reply before you've read it all, things fall somewhat into place).
z-man wrote:Next step:
In absolutely no way should the server be able to change the local port the client uses. ... I somewhat get the impression that you're saying the server tries to "blindly search" (what sending 0.0.0.0:2809 would be) when it looses a connection.
The server never changes the port of the client, and it does not search blindly. But the client sometimes, very rarely, changes its source port all on its own, either when
1) the client socket breaks and it has to create a new one with a new port
Ok I don't see how this would result in a request from the server to open a new port... what you are describing here is the opposite and in this scenario my client would be initiating the switch not the server. If that was the case then it would already have been approved by my firewall on the first outgoing (from me to server) connection using the new port. The client should open the connection to the server and not the opposite. Now if it is programmed to happen the other way around we've found a bug there imo (but I doubt you've specifically programmed it so that the server should start connections).
z-man wrote:2) the client is behind a NAT router and the router decides, since UDP is connectionless totally within specification, to change the source port it is maping AA packets to.
What makes you think this happened? Some info:
- NAT doesn't treat TCP and UDP differently
- NAT doesn't randomly decide on its own to change it's existing NAT table content this way (it would wreak havock on absolutely everything if it did).
- from the inside going out NAT will use the destination header to the server as supplied from the inside, it will only change the IP:port of the senders address to the address of it's outside interface. Now here is the crucial part: if it got a packet from the inside (client) to the server with the address - censored - port 2809 that would mean that the client used this destination address which in turn would mean that it was already seen and approved by the firewall because it was an outgoing connection from a running program approved to make any outgoing connections... this in turn means that there would never be a problem in the first place. This is how it works. Oh and btw - censored - port 2809 would be a new NAT table entry, it wouldn't automatically delete or replace the old one.
What actually had to happen to produce the warning message in the first place (there's no way around this):
- A packet with my ISP-provided IP arrived at my router << without doubt
- NAT translates the packets destination address (my ISP-provided IP) to a valid "inside" destination address (for example my local machine IP but in this case it used 0.0.0.0). << without doubt
- either way (wheter it was directly addressed to my local machine IP or using 0.0.0.0) my firewall (which intercepts all packets to my nic of course) recognised the packet as being a new incoming connection (i.e. unestablished/not a reply to an outgoing one) to a running program. << sorry to say it but this is without doubt as well
The packet that set of the warning was received through NAT in a perfectly normal way although I understand perfectly well why you though differently from your reply.
z-man wrote:The packets sent by the client will still reach the server in case of such an incident, but unless something is done, packets from the server will not reach the client.
Why? This is not how networking works

Any packets reaching the server will always contain the clients ISP-provided sender address and as long as the server uses this address when replying it will always be correctly (and transparently) translated by NAT to whatever it should be.
Now: if the server does not realize it has gotten a new connection (that the clients address port changed) then it will have trouble but I have difficulty seeing this as a likely scenario to happen as it should be no different from the server recognising an initial connection in the first place because the client changing port makes the whole thing a new seperate/additional connection. (How does it happen in the first place? Answered in RFC 768
http://www.faqs.org/rfcs/rfc768.html and RFC 760)
z-man wrote:Instead of terminating the connection, the server will modify the clients connection information so that the server's packets will reach the client: it changes the port it's sending to. It does not do portscans or even send to 0.0.0.0, simply because packets send to 0.0.0.0 don't get anywhere at all.
First of all packets with 0.0.0.0 do get somewhere: it's the default "generic" network address. But yes it is true 0.0.0.0 would not be the destination address used to reach my client from the server as that indeed would not work (improper use). The destination address the server used would obviously be my ISP-provided IP. But since the sender of the packet (whether it was the server or somebody else) doesn't have my internal IP, and because this was an incoming connection request, and because my NAT allows it, and because the NAT did not find an existing "translation" for this request in its table, it used 0.0.0.0 as the local "destination".
Now for a small surprise: we actually have an explanation of the whole incident if what you say about the server "modifying the clients connection information" by "changing the port it is sending to" is true (and also something to fix imo).
Because what would happen if the server did this? It would end up with me getting a request from - censored - port 4534 to 0.0.0.0 port whatever
This is bad! This is the server trying to change the port of the client (contrary to what you said earlier). It should just disconnect me instead...
Now even if this is the case I think we should have confirmation of it from the logs or else it's not the reason imo.
z-man wrote:Sorry for not being clear, I was simply saying that the following does not work ( i.e. for exactly the reason you state ): Both server and client bind their socket to port 4535. Both server and client explicitly only send packets to port 4535. I was under the false impression that you thought the port 2809 from your firewall message should read 4535, which it would only if the client explicitly bound its socket to that port.
Ah good

No need to say sorry: it's always very easy to misunderstand each other when discussing details, and remember that I'm in kind of a "reduced state" so not only does my replies take forever to finish but also they're not perfectly formulated (it's been years since I taught networking).
z-man wrote:It's simpler: you haven't fully understood NAT

There are many forms of NAT. The one I ran across most of the time is called Masquerading by the linux kernel, Internet Connection Sharing by Microsoft and Overloading by Cisco (
see here ). The software solutions will usually handle packages not finding a match in the address translation table on the router PC itself. All standalone boxes I saw will drop unmappable packets.
Yes, or rather: there are many implementations of NAT. One thing that is important to realize is that NAT is environment specific and configurable (in some situations you would never allow NAT to use 0.0.0.0, 255.255.255.255 or similar but in others you would).
z-man wrote:I was just assuming your box does the same, but obviously it does not. It seems to forward unmappable packets to the LAN anyway and just broadcast them there. Probably perfectly valid behaviour, but I've never seen it before.
0.0.0.0 is not a broadcast (that would be 255.255.255.255) even though the effect is similar they differ in use. Anyway, yes it can be valid: a small consumer (as opposed to business) router (and NAT) does not know or remember what is going on and so if it get's a packet inbound that it doesn't find where should go in it's NAT table or routing table then it will try it's best at delivering the packet as it can't decide on its own wheter it is a valid connection or not (as long as it is validly formed IPs and unless the router, NAT or any packet filter is configured not to allow it of course).
z-man wrote:Cisco wrote:When a packet comes back from the destination computer, the router checks the destination address on the packet. It then looks in the address translation table to see which computer on the stub domain the packet belongs to. It changes the destination address to the one saved in the address translation table and sends it to that computer. If it doesn't find a match in the table, it drops the packet.
That's from the dynamic NAT section of the linked document, which is a bit different from overlapping NAT, because it multiplexes to many global IPs and does not multiplex ports. They don't say anything about packages not found in the ATT in Overloading NAT.
This is NAT in the context of large business environments imo (large stub networks if you like) and in these situations it would be insane to not drop the packet, anyway this cleared a lot of stuff up: we've been talking about slightly different things
z-man wrote:n54 wrote:A router using NAT does not stop or ignore any packet with an address not found in it's NAT memory/table/db, unless it is a packet without a correct local destination or local sender address.
Sorry, but how can a packet coming from the Internet have a correct local destination? To the outside internet, all that is visible is the IP given to your router by your ISP. If my understanding is only a bit correct, then all packages coming to you from the outside should just have this IP as their destination. ( I'm aware of the existence of source routing where this assumption is not true, but think it is irrelevant here. )
Ah blarg lol I totally messed up trying to include mentioning the need for validly formed IPs in an incredibly cumbersome and confusing manner lol

mea culpa

I thought I was tired now but I must obviously have been worse writing that
It will be interesting to see wheter the logs indicate a server attempt at a new connection to the client or not. If it is we have some UDP fixing to do and although I'm no programmer there are meant to be transparent port switching abilities in UDP we could try to implement in a way that doesn't set off all the alarms
Edit: reading through my next last reply makes me shudder, you'ld think I was drunk writing it there are so many imprecise-to-the-point-of-becoming-wrong uses of words and sentences (and no I wasn't drunk)

really sorry about that: I've got to take most of the blame for any misunderstandings