/***************************************************************************1* _ _ ____ _2* Project ___| | | | _ \| |3* / __| | | | |_) | |4* | (__| |_| | _ <| |___5* \___|\___/|_| \_\_____|6*7* Copyright (C) Daniel Stenberg, <[email protected]>, et al.8*9* This software is licensed as described in the file COPYING, which10* you should have received as part of this distribution. The terms11* are also available at https://curl.se/docs/copyright.html.12*13* You may opt to use, copy, modify, merge, publish, distribute and/or sell14* copies of the Software, and permit persons to whom the Software is15* furnished to do so, under the terms of the COPYING file.16*17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY18* KIND, either express or implied.19*20* SPDX-License-Identifier: curl21*22***************************************************************************/23#include "tool_setup.h"2425#ifdef HAVE_NETINET_IN_H26#include <netinet/in.h> /* IPPROTO_TCP */27#endif2829#include "tool_cb_soc.h"3031/*32** callback for CURLOPT_OPENSOCKETFUNCTION33**34** Notice that only Linux is supported for the moment.35*/3637curl_socket_t tool_socket_open_mptcp_cb(void *clientp,38curlsocktype purpose,39struct curl_sockaddr *addr)40{41int protocol = addr->protocol;4243(void)clientp;44(void)purpose;4546if(protocol == IPPROTO_TCP)47#if defined(__linux__)48# ifndef IPPROTO_MPTCP49# define IPPROTO_MPTCP 26250# endif51protocol = IPPROTO_MPTCP;52#else53return CURL_SOCKET_BAD;54#endif5556return socket(addr->family, addr->socktype, protocol);57}585960