Kris
Kris

Reputation: 11

Linux Kernel TCP Socket modification

Is there is any easy way to modify tcp socket parameters? For example: Server_program is using eth0 with 10.0.0.1, it can't be restarted and I need to recreate socket on the eth1 with 192.168.0.1. I know there is some other not trival problems but all I'm looking now is possibility to modify socket "on-the-fly" inside the kernel. Thank you for any advices.

Upvotes: 1

Views: 1151

Answers (1)

puetzk
puetzk

Reputation: 10814

Open the new socket, do whatever steps are needed to get it connected and into the same state, and then use dup2() to turn the old file descriptor into a clone of the new one.

Upvotes: 2

Related Questions