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

How to include MPTCP_ENABLED and SOL_TCP definitions #439

Closed
VenkateswaranJ opened this issue Jul 20, 2021 · 3 comments
Closed

How to include MPTCP_ENABLED and SOL_TCP definitions #439

VenkateswaranJ opened this issue Jul 20, 2021 · 3 comments
Assignees
Labels

Comments

@VenkateswaranJ
Copy link

Macro MPTCP_ENABLED is defined in #include <linux/tcp.h> and SOL_TCP defined in #include <netinet/in.h> I want these two definitions to set the mptcp socket option but if I include those two files I get lots of type conflict errors. Is there any better way to do it or do I need to define one of the macros in my CPP file? ( example : #define SOL_TCP 6 )

@matttbe
Copy link
Member

matttbe commented Jul 20, 2021

Hi,

User programs should include files from netninet. Of course here, MPTCP_* macros are not going to be defined there as this is a out-of-tree kernel!

There are workarounds I think, please see: #393 (comment)

But it is maybe easier not to include linux/tcp.h and define MPTCP_ENABLED (and others). The associated numbers should not change.

(Feel free to close this ticket if you got the answer you wanted ;) )

@matttbe matttbe self-assigned this Jul 20, 2021
@VenkateswaranJ
Copy link
Author

I want to include some code only if it's mptcp kernel something like

#ifdef MPTCP_ENABLED
//code
#endif

for this, I need to check linux/tcp.h file. Is there any other way to do this?

@matttbe
Copy link
Member

matttbe commented Jul 20, 2021

This implies you compile the userspace code on the machine it is supposed to run. That's not always the case.

If the workaround from #393 (comment) is not working for you, the best is probably to grep MPTCP_ENABLED (...)/linux/tcp.h and add a -D MPTCP_ENABLED=42 at the compilation time.

I don't think there are "cleaner" solutions for out-of-tree kernels. But if you find any, feel free to share it with us.

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