IIRC the problem is because your router is not closing those TCP connections correctly so as far as bitcoin is concerned those connections are still open.
If that was the case, the Bitcoin client wouldn't go down from say 100+ connections to 8 open connections (as shown in the GUI status row) after IP address change, right?
I had linux client 0.4.0 running overnight for several times and never noticed a decrease in connections (Also getting new IP every 24hours). So indeed this looks more like a problem on your side, not a general issue.
Interesting, how many connections did the Bitcoin client report to have open when you tested this?
Might be worth noting that other software I use for mining (poclbm.py), irc, usenet and bittorrent does handle the IP address change without a problem.
I could easily write a script which kills and restart the Bitcoin client whenever the IP address changes, but that would be more of a workaround than actual fix.
UPDATE:
I've been checking the source code here:
https://github.com/bitcoin/bitcoin/blob/master/src/net.cpp#L405The functions ThreadGetMyExternalIP() and GetMyExternalIP() specifically. I guess the problem is related to how the IP address is cached when received from either
IRC (Server IP: 92.243.23.21), or when the backup services dyndns.org and showmyip.com are used (Yes, to my surprise the Bitcoin client actually
rely on these services hardcoded).
It seems these functions aren't called properly when my router get new IP address via DHCP, so no incoming connections can reach the host because the old IP address is used, only the 8 connections which are outgoing still reconnects ok after timing out.