Line 3:
Line 3:
Currently we support Unix socket of all kinds, UDP both IPv4 and IPv6 and TCP in Listen and (!) [[TCP connection|Established states]].
Currently we support Unix socket of all kinds, UDP both IPv4 and IPv6 and TCP in Listen and (!) [[TCP connection|Established states]].
−
The cpt part uses the sock_diag engine that was merged to Dave recently to
+
The cpt part uses the sock_diag engine to collect extended information about socket. Then it drains sockets from the target tasks using SCM_RIGHTS sending.
−
collect sockets. Then it dumps sockets by checking the filesystem ID of a
−
failed-to-open through /proc/pid/fd descriptors (sockets do not allow for
−
such tricks with opens through proc) against SOCKFS_TYPE.
−
The restore part is more tricky. Listen sockets are just restored, this is simple.
+
The restore part of Unix sockets is the most tricky part. Listen sockets are just restored, this is simple.
Connected sockets are restored like this:
Connected sockets are restored like this:
Line 16:
Line 13:
# ... all listening sockets call accept() and ... dup2 the new fd into the accepting end.
# ... all listening sockets call accept() and ... dup2 the new fd into the accepting end.
−
There's a problem with this approach -- socket names are not preserved, but
+
There's a problem with this approach -- socket names are not preserved, but looking into our OpenVZ implementation I think this is OK for existing apps.
−
looking into our OpenVZ implementation I think this is OK for existing apps.
−
−
=== What should be done next ===
−
−
* socket filter (SK_ATTACH_FILTER)
−
* various (ip/tcp level) sockoptions
[[Category:Under the hood]]
[[Category:Under the hood]]