Auto-killing connections when changing IP?




I almost always have SSH sessions open when I'm using my laptop, and they
tend to suffer from the following problem: if I suspend the laptop and wake
it up elsewhere, those sessions are still up but unusable: they freeze
because the TCP connection can't be used anymore since the machine has
a different IP number.

The fact that the TCP connections are preserved is good occasionally
(typically when I don't move the laptop so I reconnect to the same DHCP
server which gives me the same IP so the TCP connections can keep on working
(tho if the router does NAT it may have forgotten about that TCP
connection and it still freezes)).
But usually, it's annoying more than anything else, because I have to go and
kill the processes explicitly/manually.

Is there some way to kill all TCP connections that go over the network
interface `foo' whenever this interface is brought up with an IP address
different from the one it had before?


Stefan
.