Skip to contentSkip to conversation

terminating connections when an interface goes down

DISCUSSION MaXxX 2 participants 2 messages Mar 15, 2004 – Mar 17, 2004 netfilter

lore
Share & tools
lore

MaXxX

author
#0 lore raw

Hello.

Having recently switched to a faster ISP but with dynamically assigned (and forcibly changed every 24h) IP, I'd like netfilter to TERMINATE all active connections when the IP changes. Some programs behave very badly when their connections are left to time out, and some services ban a user for quite a long time when they detect a double login (and that's how a timeout-IPchange-relogin sequence looks to them)... I believe that for many dynamic IP users this might be a great addition to netfilter, and I'd be willing to code it in, abilities permitting.

Terminating a connection on the NAT side seems fairly easy. A FIN packet with seq=0 tricks the NATted machine into sending an ACK with a corrected seq, and a RST in response to it closes the connection. On the Internet side, however, things are much more hairy, as my IP address has just changed and there is no way to receive an ACK response, besides that sending anything out is going to require spoofing the previous IP. It seems to me that I'd have to make netfilter keep an internal table of seq numbers (which I suspect it already has, to NAT properly?) and use it to send a spoofed RST. And all of it before netfilter cleans out ip_conntrack, if it's going to be used at all in this case, that is.

If I were to add such an option to netfilter, given my fair but not excellent C capabilities, what source file should I be mostly looking at? And can I hope for some guidance along the way, if some experienced developer finds my idea worthy of it?

Thanks.

Signature · 14 lines
 |\  /|      \~~~/     \~~~/
 | \/ |  /\   > <  \~/  > <    ICQ# 3146019
 |____| /__\ /___\ /_\ /___\    IQ# 3.14159
"This is Pearl Harbor! Japanese aircraft incom-" NO CARRIER




-- 
 |\  /|      \~~~/     \~~~/
 | \/ |  /\   > <  \~/  > <    ICQ# 3146019
 |____| /__\ /___\ /_\ /___\    IQ# 3.14159
Random church bulletin blooper: This being Easter Sunday, we will ask
Mrs. Lewis to come forward and lay an egg on the altar.
#1 lore raw
Quoted 10 lines · MaXxX

Hello.

Having recently switched to a faster ISP but with dynamically assigned (and forcibly changed every 24h) IP, I'd like netfilter to TERMINATE all active connections when the IP changes. Some programs behave very badly when their connections are left to time out, and some services ban a user for quite a long time when they detect a double login (and that's how a timeout-IPchange-relogin sequence looks to them)... I believe that for many dynamic IP users this might be a great addition to netfilter, and I'd be willing to code it in, abilities permitting.

Something like this has been proposed in the past (like a REJECT target sending packets both ways). However, we agreed that this causes way more complex problems than it solves. What if any of your packets are lost? What should deal with retransmissions inside the kernel? ...

Quoted 1 line

Thanks.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie