options.c (648ef4b88673dadb8463bf0d4b10fbf33d55def8) | options.c (65492c5a6ab5df5091a77562dbcca2d2dc3877c0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Multipath TCP 3 * 4 * Copyright (c) 2017 - 2019, Intel Corporation. 5 */ 6 7#include <linux/kernel.h> 8#include <net/tcp.h> 9#include <net/mptcp.h> 10#include "protocol.h" 11 | 1// SPDX-License-Identifier: GPL-2.0 2/* Multipath TCP 3 * 4 * Copyright (c) 2017 - 2019, Intel Corporation. 5 */ 6 7#include <linux/kernel.h> 8#include <net/tcp.h> 9#include <net/mptcp.h> 10#include "protocol.h" 11 |
12static bool mptcp_cap_flag_sha256(u8 flags) 13{ 14 return (flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA256; 15} 16 |
|
12void mptcp_parse_option(const unsigned char *ptr, int opsize, 13 struct tcp_options_received *opt_rx) 14{ 15 struct mptcp_options_received *mp_opt = &opt_rx->mptcp; 16 u8 subtype = *ptr >> 4; 17 int expected_opsize; 18 u8 version; 19 u8 flags; --- 4 unchanged lines hidden (view full) --- 24 opsize != TCPOLEN_MPTCP_MPC_ACK) 25 break; 26 27 version = *ptr++ & MPTCP_VERSION_MASK; 28 if (version != MPTCP_SUPPORTED_VERSION) 29 break; 30 31 flags = *ptr++; | 17void mptcp_parse_option(const unsigned char *ptr, int opsize, 18 struct tcp_options_received *opt_rx) 19{ 20 struct mptcp_options_received *mp_opt = &opt_rx->mptcp; 21 u8 subtype = *ptr >> 4; 22 int expected_opsize; 23 u8 version; 24 u8 flags; --- 4 unchanged lines hidden (view full) --- 29 opsize != TCPOLEN_MPTCP_MPC_ACK) 30 break; 31 32 version = *ptr++ & MPTCP_VERSION_MASK; 33 if (version != MPTCP_SUPPORTED_VERSION) 34 break; 35 36 flags = *ptr++; |
32 if (!((flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA1) || | 37 if (!mptcp_cap_flag_sha256(flags) || |
33 (flags & MPTCP_CAP_EXTENSIBILITY)) 34 break; 35 36 /* RFC 6824, Section 3.1: 37 * "For the Checksum Required bit (labeled "A"), if either 38 * host requires the use of checksums, checksums MUST be used. 39 * In other words, the only way for checksums not to be used 40 * is if both hosts in their SYNs set A=0." --- 353 unchanged lines hidden (view full) --- 394 else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) 395 len = TCPOLEN_MPTCP_MPC_SYNACK; 396 else 397 len = TCPOLEN_MPTCP_MPC_ACK; 398 399 *ptr++ = htonl((TCPOPT_MPTCP << 24) | (len << 16) | 400 (MPTCPOPT_MP_CAPABLE << 12) | 401 (MPTCP_SUPPORTED_VERSION << 8) | | 38 (flags & MPTCP_CAP_EXTENSIBILITY)) 39 break; 40 41 /* RFC 6824, Section 3.1: 42 * "For the Checksum Required bit (labeled "A"), if either 43 * host requires the use of checksums, checksums MUST be used. 44 * In other words, the only way for checksums not to be used 45 * is if both hosts in their SYNs set A=0." --- 353 unchanged lines hidden (view full) --- 399 else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) 400 len = TCPOLEN_MPTCP_MPC_SYNACK; 401 else 402 len = TCPOLEN_MPTCP_MPC_ACK; 403 404 *ptr++ = htonl((TCPOPT_MPTCP << 24) | (len << 16) | 405 (MPTCPOPT_MP_CAPABLE << 12) | 406 (MPTCP_SUPPORTED_VERSION << 8) | |
402 MPTCP_CAP_HMAC_SHA1); | 407 MPTCP_CAP_HMAC_SHA256); |
403 put_unaligned_be64(opts->sndr_key, ptr); 404 ptr += 2; 405 if (OPTION_MPTCP_MPC_ACK & opts->suboptions) { 406 put_unaligned_be64(opts->rcvr_key, ptr); 407 ptr += 2; 408 } 409 } 410 --- 41 unchanged lines hidden --- | 408 put_unaligned_be64(opts->sndr_key, ptr); 409 ptr += 2; 410 if (OPTION_MPTCP_MPC_ACK & opts->suboptions) { 411 put_unaligned_be64(opts->rcvr_key, ptr); 412 ptr += 2; 413 } 414 } 415 --- 41 unchanged lines hidden --- |