Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Can't find MPTCP_ENABLED define #496

Open
yuyujunjiang opened this issue Sep 16, 2022 · 5 comments
Open

Can't find MPTCP_ENABLED define #496

yuyujunjiang opened this issue Sep 16, 2022 · 5 comments
Labels

Comments

@yuyujunjiang
Copy link

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 <time.h>

#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
Copy link
Member

matttbe commented Sep 16, 2022

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
Copy link
Author

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
Copy link
Member

matttbe commented Sep 19, 2022

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
Copy link
Author

yuyujunjiang commented Sep 23, 2022

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
Copy link
Member

matttbe commented Sep 23, 2022

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants