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
887 stars 334 forks source link

Can't find MPTCP_ENABLED define #496

Open yuyujunjiang opened 1 year ago

yuyujunjiang commented 1 year ago

Hello The version of kernel is 4.19, and the mptcp I used is 0.95 out of tree. I code setsockopt(fd, SOL_TCP, MPTCP_ENABLED, &enable, sizeof(enable)); as the same as https://multipath-tcp.org/pmwiki.php/Users/ConfigureMPTCP. But there is no define of MPTCP_ENABLED in the head file. I have included `#include <netinet/in.h>

include <arpa/inet.h>

include

include <linux/tcp.h>

include <linux/mptcp.h>

` Then I check the /usr/include/linux/mptcp.h, MPTCP_PATH_MANAGER and some struct like mptcp_meta_info don't exit too. Did I miss other head files?

matttbe commented 1 year ago

Hello,

MPTCP_ENABLED is specific to this out-of-tree kernel implementation and you will not find it in netinet or any other files from a libc or a lib for another language.

It is available in kernel's uAPI, e.g. in linux/tcp.h (not in mptcp.h) but if you need netinet for other reasons, it might be tricky to include everything from tcp.h. In this case, the easiest is to re-define it, e.g.

#ifndef MPTCP_ENABLED
#define MPTCP_ENABLED 42
#endif

The value should always be 42.

yuyujunjiang commented 1 year ago

Thanks for your reply! It is really helpful for me. I have found the define and other struct I need in /linux/tcp.h on my virtual machine. But I can't find the same thing on two debian system hosts. I compile MPTCP kernel in the same way with out of tree source code. Do you know why?

matttbe commented 1 year ago

On Debian, you can have multiple kernels installed and you might not have the linux-headers package. The header files might be located in different directories specific to a certain kernel version.

So first, check that you installed the linux-headers package (I don't know how you compiled/installed it). If you installed .deb packages, you might need to tell your compiler to look at -I/usr/src/linux-headers-$(uname -r)/include/uapi.

yuyujunjiang commented 1 year ago

thanks for your answer. I recompile the kernel as you said. But I still can't get the defination of MPTCP_ENABLE in linux/tcp.h. Here are my steps.

cd /usr/src/mptcp
make menuconfig
make -j $(getconf _NPROCESSORS_ONLN) deb-pkg -I/usr/src/linux-headers-$(uname -r)/include/uapi
sudo dpkg -i ../linux-image*.deb ../linux-headers*.deb
reboot

Is there something wrong?

matttbe commented 1 year ago

Hello,

-I/usr/src/linux-headers-$(uname -r)/include/uapi is to be used when compiling your userspace program to tell the compiler to first look at files from there, e.g. to find linux/tcp.h file where MPTCP_ENABLED is defined. Please check the content of linux-headers*.deb to see where the uapi files are installed.

But again, it might be easier to modify your userspace program and (re)define what is not defined in the files from your Linux distribution, e.g. /usr/include/linux/tcp.h.

#ifndef MPTCP_ENABLED
#define MPTCP_ENABLED 42
#endif