Bug? IP changes and persistant connections.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Suppose a process has an open TCP connection to e.g. a newsserver
somewhere across the 'net. Suppose that the interface through which
this connection is made has its IP address changed. Then the process
can try to send all the data it wants without getting anywhere, but in
linux-2.4.0, at least, no errors from send(2) are returned.

This is probably an annoying FAQ, but shouldn't EPIPE or EBADF be
returned?

FWIW, this happens to me a lot. I keep getting programs stuck (no
errors returned or anything) because my ISP disconnected my after 5
minutes of inactivity or 120 minutes online, and when I reconnected
(pppd demand) I got a different IP address.

For example,

ppp1      Link encap:Point-to-Point Protocol  
          inet addr:213.104.76.251  P-t-P:10.112.112.113  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:3822 errors:3 dropped:0 overruns:0 frame:0
          TX packets:4084 errors:0 dropped:65 overruns:0 carrier:0
          collisions:0 txqueuelen:3 

But this connection is still on an old IP address -

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0     72 213.104.68.125:1328     62.253.162.107:119      ESTABLISHED

And here is the strace from the process (telnet) on this connection
when I force it to send some stuff:

send(3, "return an error you cheesy os\r\n", 31, 0) = 31
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL

Fooling around in the source, I saw that I most probably want to catch
NETDEV_CHANGEADDR and NETDEV_DOWN as thrown by
linux/net/ipv4/devinet.c and scan the list of active connections
somehow or other and kill (tcp_write_err?) the ones that have the old
local address. Is there any reason not to do this - i.e. should it be
a sysctl?
-- 

	http://www.penguinpowered.com/~vii
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux