criu icon indicating copy to clipboard operation
criu copied to clipboard

Support SCTP protocol

Open xemul opened this issue 7 years ago • 19 comments

xemul avatar Jun 06 '17 11:06 xemul

https://criu.org/TCP_connection

xemul avatar Jun 06 '17 12:06 xemul

@xemul Hi, xemul Although SCTP module in kernel is not easy to be supported by criu, we think about some method to walk around. We tried usrSCTP (https://github.com/sctplab/usrsctp), which implement SCTP in user space. However, since usrSCTP use raw socket as: socket(AF_INET, SOCK_RAW, IPPROTO_SCTP), criu think it could not be dumped. I wonder whether it's possible to support this type of socket in do_dump_one_inet_fd() as:

  1. make it pass the check in can_dump_ipproto() and can_dump_inet_sk()
  2. dump settings with dump_ip_opts() + dump_socket_opts()
  3. just shutdown it following IPPROTO_UDP: sk_encode_shutdown()

Please advize, thanks!

zgtian avatar Sep 06 '17 15:09 zgtian

@zgtian , yes, raw sockets would be much easier to support, from the first glance you've described everything correctly. Don't hesitate to submit a patch and ask for any explanations from now on :)

xemul avatar Sep 07 '17 14:09 xemul

@xemul , we have modified some code on dump/restore. Yes, it seems work now without error, however, the restored client would send illegal packets to server. Please help to check the modification, please always take into consideration that we are newbie for socket/netlink/criu and we do a lot of dirty work to clear errors... :)

diff_criu4sctp.txt

zgtian avatar Sep 12 '17 09:09 zgtian

Two things bother me -- you don't save/restore socket opts for your sockets (you commented out these calls) and you don't save/restore raw-socket options. This may cause misbehavior.

xemul avatar Sep 14 '17 13:09 xemul

@xemul ,thansk actually these commented code may cause error, i have no idea how to treat these errors currently. According to you, what is necessary to be saved and restored for SOCK_RAW of AF_INET? The same as SOCK_STREAM/SOCK_DGRAM or not? I notice you save and restore a lot of opts for AF_PACKET.

zgtian avatar Sep 14 '17 15:09 zgtian

Well, first of all you should save all the opts that are currently saved by CRIU. If any of them fails, this should be analyzed option-by-option.

Next, looking at kernel's function do_ip_setsockopt() I can see a_lot of configuration for AF_INET socket. We don't save all of it currently, since for TCP socket they seem to be not-relevant. But for raw mode it can be crucial.

Here's the list of what I've found: IP_PKTINFO: IP_RECVTTL: IP_RECVOPTS: IP_RECVTOS: IP_RETOPTS: IP_TOS: IP_TTL: IP_HDRINCL: IP_MTU_DISCOVER: IP_RECVERR: IP_ROUTER_ALERT: IP_FREEBIND: IP_PASSSEC: IP_TRANSPARENT: IP_MINTTL: IP_NODEFRAG: IP_BIND_ADDRESS_NO_PORT: IP_UNICAST_IF: IP_MULTICAST_TTL: IP_MULTICAST_ALL: IP_MULTICAST_LOOP: IP_RECVORIGDSTADDR: IP_CHECKSUM: IP_RECVFRAGSIZE: IP_OPTIONS: IP_PKTINFO: IP_RECVTTL: IP_RECVTOS: IP_RECVOPTS: IP_RETOPTS: IP_PASSSEC: IP_RECVORIGDSTADDR: IP_CHECKSUM: IP_RECVFRAGSIZE: IP_TOS: IP_TTL: IP_HDRINCL: IP_NODEFRAG: IP_BIND_ADDRESS_NO_PORT: IP_MTU_DISCOVER: IP_RECVERR: IP_MULTICAST_TTL: IP_MULTICAST_LOOP: IP_UNICAST_IF: IP_MULTICAST_IF: IP_ADD_MEMBERSHIP: IP_DROP_MEMBERSHIP: IP_MSFILTER: IP_BLOCK_SOURCE: IP_UNBLOCK_SOURCE: IP_ADD_SOURCE_MEMBERSHIP: IP_DROP_SOURCE_MEMBERSHIP: MCAST_JOIN_GROUP: MCAST_LEAVE_GROUP: MCAST_JOIN_SOURCE_GROUP: MCAST_LEAVE_SOURCE_GROUP: MCAST_BLOCK_SOURCE: MCAST_UNBLOCK_SOURCE: MCAST_MSFILTER: IP_MULTICAST_ALL: IP_ROUTER_ALERT: IP_FREEBIND: IP_IPSEC_POLICY: IP_XFRM_POLICY: IP_TRANSPARENT: IP_MINTTL:

xemul avatar Sep 15 '17 10:09 xemul

Hi, @xemul

We are working on this functionality right now, we were able to successfully dump and restore an SCTP socket in the listening state, now I want to add support for the established state using TCP_REPAIR like mechanism (SCTP_REPAIR), This why we need some help in that direction (for example which kernel files need to be updated ??)

Thank you in advance.

Oussalvatore avatar Jul 16 '18 20:07 Oussalvatore

@Oussalvatore , that's good news! For any help that you'd need -- feel free to write either here or to criu@ ml or to me directly.

As far as the kernel is concerned -- please, grab the net-next tree (https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git) and make the patches over it. Then you'll need to negotiate them on the netdev@ mailing list.

xemul avatar Jul 17 '18 06:07 xemul

Thank you @xemul , it would be very helpful if you can share the patch file of TCP connection repair with me :).

Oussalvatore avatar Jul 17 '18 08:07 Oussalvatore

@Oussalvatore https://github.com/torvalds/linux/commit/ee9952831cfd0bbe834f4a26489d7dce74582e37

avagin avatar Aug 01 '18 05:08 avagin

thank you @avagin, we have successfully dumped the SCTP connection and we are working on the restore now

Oussalvatore avatar Aug 02 '18 12:08 Oussalvatore

Hi @xemul and @avagin , I'm facing some problems and I would be grateful if you can help me. Actually I'm trying to restore the dumped process and CRIU indicates that the process has been successfully restored but it's not the case, also I can observe the restoration of the SCTP socket in /proc/net/sctp/assocs file. Here is the dump and restore logs. Thank you dump.log restore.log

Oussalvatore avatar Aug 13 '18 09:08 Oussalvatore

I'm having a similar problem (trying to dump SCTP sockets), but even in the latest CRIU release it still seems like a feature that's missing. Any progress on this, or any plans to support this in the future, if at all?

tA-bot-git avatar Sep 04 '19 09:09 tA-bot-git

Hi @xemul and @avagin , I'm facing some problems and I would be grateful if you can help me. Actually I'm trying to restore the dumped process and CRIU indicates that the process has been successfully restored but it's not the case, also I can observe the restoration of the SCTP socket in /proc/net/sctp/assocs file. Here is the dump and restore logs. Thank you dump.log restore.log

Hello @Oussalvatore We are currently working on an application that requires SCTP protocol support for CRIU. I would like to know whether you are successful in the addition of SCTP support. Could you please share the sctp support module added and we shall work on it from the place where you encounter issues. Thank you.

Regards, Priya.

ShunmugaPriyaR avatar Mar 09 '20 16:03 ShunmugaPriyaR

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jan 22 '21 00:01 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Feb 26 '21 00:02 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Apr 04 '21 00:04 github-actions[bot]

Hello! Do we have any updates for supporting SCTP maintenance? @ShunmugaPriyaR I saw there is a repository that you guys working with, is there any progress? Thank you :)

teo-tsou avatar Sep 12 '22 11:09 teo-tsou