w3ntp has asked for the wisdom of the Perl Monks concerning the following question:

I have a COTS Server Application that runs on a Solaris 9 machine communicating with a COTS client application on another Solaris 9 machine. The COTS Server application is also cloned on another Solaris 9 machine to act as a high availability Server with a shared IP address between the two servers to which the COTS client connects via TCP socket. Between the two Servers only one of the shared IP addresses can be up at a time. I am currently using ifconfig <port> Up/Down to activate/deactivate the IP ports. Unfortunately, when I bring down the hardware interface, the TCP sessions on both the client and server remain in ESTABLISHED state for several minutes before going to Time-wait and then die. Since I do not have access to the COTS code, is there a way in Perl to bind to an existing Socket connection and close it gracefully or fast? The info that is available to me is the IP address at both ends and the port addresses at both ends. Any wisdom would be much appreciated. thanks W3NTP Neil
  • Comment on How to kill a rogue TCP session on Solaris 9

Replies are listed 'Best First'.
Re: How to kill a rogue TCP session on Solaris 9
by matija (Priest) on Apr 12, 2004 at 21:59 UTC
    Bind to an existing socket connection? No, there is no way, in Perl or any other language to do it.

    Well, not any legal means anyway.

    What you would have to do is snoop the packets that come in, learn the source/destination port and the sequence number, then spoof a RST packet. For assembling the packet, it looks like NetPacket::IP might be of use, and for snooping, I think Net::Pcap might be just the ticket.

Re: How to kill a rogue TCP session on Solaris 9
by waswas-fng (Curate) on Apr 12, 2004 at 21:40 UTC
    Try the ifconfig flag unplumb to remove the device and logical device from the system, that should force teardown of the connections.


    -Waswas