multipath-tcp / mptcp

⚠️⚠️⚠️ Deprecated 🚫 Out-of-tree Linux Kernel implementation of MultiPath TCP. 👉 Use https://github.com/multipath-tcp/mptcp_net-next repo instead ⚠️⚠️⚠️
https://github.com/multipath-tcp/mptcp_net-next
Other
888 stars 335 forks source link

Using MPTCP after installation #389

Closed coderdhruv closed 4 years ago

coderdhruv commented 4 years ago

I have installed the 4.19.55 version of MPTCP and while following the procedure given in multipath-tcp.org for configuring mptcp when I typed the line setsockopt(fd, SOL_TCP, MPTCP_ENABLED, &enable, sizeof(enable)); SOL_TCP option is not available What are the headers I need to include in my C code to run mptcp functions and options like MPTCP_ENABLED and in general how to use the kernel functionalities for making subflows and connections.

matttbe commented 4 years ago

Hi

How exactly did you install the new kernel? There are many different methods. Did you install the headers package? Did you ask your compiler to look where the headers are installed, typically /usr/src/linux-headers-<kernel-version>/include?

coderdhruv commented 4 years ago

I was using apt repository for installing the mptcp kernel.Also when I use /usr/src/linux-headers-<kernel-version>/include I am getting this error

In file included from /usr/src/linux-headers-4.19.55.mptcp/include/linux/kernel.h:7:0,
                 from /usr/src/linux-headers-4.19.55.mptcp/include/linux/list.h:9,
                 from /usr/src/linux-headers-4.19.55.mptcp/include/linux/module.h:9,
                 from multipath_tcp.c:1:
/usr/src/linux-headers-4.19.55.mptcp/include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory
 #include <asm/linkage.h>
          ^~~~~~~~~~~~~~~
compilation terminated.

when Iooked into the linux.mptcp kernel headers there was no asm module present instead asm-generic is present.

matttbe commented 4 years ago

Can you try with: -I /usr/src/linux-headers-4.19.55.mptcp/include/uapi?

matttbe commented 4 years ago

Just to be sure because it's unclear when reading your last comment:

In your .c code, you should have #include <linux/tcp.h> and when compiling, you should add this flag: -I /usr/src/linux-headers-4.19.55.mptcp/include/uapi

Note that sometimes linux/tcp.h can conflict with the one from /usr/include/linux/tcp.h. Sometimes easier to add this in your .c code:

#ifndef MPTCP_ENABLED
#define MPTCP_ENABLED 42
#endif
coderdhruv commented 4 years ago

This is preprocessor search list:

include <...> search starts here: .

/usr/src/linux-headers-4.19.55.mptcp/include /usr/src/linux-headers-4.19.55.mptcp/include/uapi /usr/lib/gcc/x86_64-linux-gnu/7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list.

dhruv@dhruv-Inspiron-5567:~$ gcc -I /usr/src/linux-headers-4.19.55.mptcp/include/uapi multipath_tcp.c In file included from /usr/src/linux-headers-4.19.55.mptcp/include/linux/kernel.h:7:0, from /usr/src/linux-headers-4.19.55.mptcp/include/linux/skbuff.h:17, from /usr/src/linux-headers-4.19.55.mptcp/include/linux/tcp.h:21, from multipath_tcp.c:3: /usr/src/linux-headers-4.19.55.mptcp/include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory

include <asm/linkage.h>

      ^~~~~~~~~~~~~~~

compilation terminated. This error is coming again. But after looking in the kernel headers there is no asm module.Is it because in my version it's not there or it's the same for every version.Any help will be helpful.

coderdhruv commented 4 years ago

Can you provide a working code just for socket creation using AF_MULTIPATH and IPPROTO_TCP including the headers

matttbe commented 4 years ago

Do you know why gcc is looking at the parent forlder (/usr/src/linux-headers-4.19.55.mptcp/include)? That's the directory used for kernel code, not for userland programs. It should only look at uapi otherwise you will have issues like you have here.

$ gcc -E -x c -I/usr/src/linux-headers-5.4.0-21/include/uapi - -v < /dev/null
(...)
#include <...> search starts here:
 /usr/src/linux-headers-5.4.0-21/include/uapi
 /usr/lib/gcc/x86_64-linux-gnu/9/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
(...)
matttbe commented 4 years ago

Hello,

Maybe the message I just sent on #393 can help you.

Please re-open this ticket if it doesn't.