SCTP protocol support in android
Asked Answered
S

1

8

How can I use SCTP protocol in Android?

I'm already aware that that Android systems don't support SCTP by default, however it's may be possible to enable it by inserting SCTP kernel module, or rebuilding the kernel with SCTP enabled in modules configuration.

I need some insight on this issue. Is it possible? How to make android support the protocol? How to build kernel module and insert it correctly? If we could succeed in making the system to support it, how we can use the protocol? Does the Java API on android support SCTP?

Stickseed answered 17/4, 2013 at 23:28 Comment(0)
Y
9

Going about it with a module is the right way. To answer your questions:

  • SCTP is already provided as a kernel module in the Linux source tree - "CONFIG_IP_SCTP=m" would enable that module. And you can change that to a "y" to hard link, though that is probably unfeasible, since you'd have to rebuild the entire kernel for that.

  • The module would have to still be built per kernel version. So basically per vendor, you'd need to get their kernel sources (doable), and then compile your module against it.

To use: In User mode - would create the socket by calling s = socket (AF_INET[6], SOCK_STREAM, IPPROTO_SCTP); From that point, socket APIs work exactly the same, with a few exceptions (namely setsockopt, which is particular for the protocol type).

From Java - does in fact support the protocol in its latest incarnations (JDK7 as of milestone 3), but that Java supports it doesn't mean that Dalvik (the "java vm" of Android) does. Though Android does have SCTP support "in the ready", it's not yet in Dalvik (at least not in 4.2). You could create a Java class, though, as in a package, that would wrap a native library with SCTP calls. It's a bit trickier in Android because of the NET permissions, but still manageable (from experience).

Yarvis answered 18/4, 2013 at 23:36 Comment(2)
Thanks for the useful answer. I'm going to build the module for android emulator, the kernel source is available by the codename goldfish. Can you guide me or refer me to a how-to, so I can build the module for the specific kernel. Also how can I make the module persistent, inserting the module each time during boot.Stickseed
During your testing - for the module to be persistent - best way is to modify /init.rc. As for a how-to.. It's part of building the Linux kernel. Get the source tree of the corresponding kernel, then go into the directory for sctp (./net/sctp, if memory serves). Then make it. That will produce the .ko. Make sure to compile using the NDK so it cross-compiles to ARM, if you are on a device.Yarvis

© 2022 - 2024 — McMap. All rights reserved.