65 struct buffer newbuf = *buf;
159 for (olen = hlen - (
int)
sizeof(
struct openvpn_tcphdr), opt = (uint8_t *)(tc + 1); olen > 1;
160 olen -= optlen, opt += optlen)
173 if (optlen <= 0 || optlen > olen)
183 uint16_t mssval = (uint16_t)(opt[2] << 8) + opt[3];
186 dmsg(
D_MSS,
"MSS: %" PRIu16
" -> %" PRIu16, mssval, maxmss);
187 opt[2] = (uint8_t)((maxmss >> 8) & 0xff);
188 opt[3] = (uint8_t)(maxmss & 0xff);
189 int32_t accumulate = htons(mssval);
190 accumulate -= htons(maxmss);
245#if defined(ENABLE_FRAGMENT)
283 size_t overhead, payload_overhead;
306 payload_overhead += 20 + 20;
343 int proto = lsi->
proto;
352 "Note adjusting 'mssfix %d%s' to 'mssfix %d mtu' "
353 "according to path MTU discovery",
360#if defined(ENABLE_FRAGMENT)
365 "Note adjusting 'fragment %d%s' to 'fragment %d mtu' "
366 "according to path MTU discovery",
#define BPTR(buf)
Return a pointer to the start of the buffer content.
static bool buf_advance(struct buffer *buf, ssize_t size)
Advance the content start of a buffer, consuming bytes from the front.
#define verify_align_4(ptr)
#define BLEN(buf)
Return the length of the buffer content in bytes.
#define BLENZ(buf)
Return the length of the buffer content as a size_t.
Data Channel Cryptography Module.
bool cipher_kt_mode_cbc(const char *ciphername)
Check if the supplied cipher is a supported CBC mode cipher.
unsigned int cipher_kt_block_size(const char *ciphername)
Returns the block size of the cipher, in bytes.
Interface functions to the internal and external multiplexers.
static struct link_socket_info * get_link_socket_info(struct context *c)
static size_t round_down_size(size_t num, size_t multiple)
Rounds down num to the nearest multiple of multiple.
static int clamp_size_to_int(size_t size)
void mss_fixup_dowork(struct buffer *buf, uint16_t maxmss)
static void frame_calculate_mssfix(struct frame *frame, const struct key_type *kt, const struct options *options, const struct link_socket_info *lsi)
void mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss)
void frame_calculate_dynamic(struct frame *frame, const struct key_type *kt, const struct options *options, const struct link_socket_info *lsi)
Set the –mssfix option.
void mss_fixup_ipv4(struct buffer *buf, uint16_t maxmss)
void frame_adjust_path_mtu(struct context *c)
Checks and adjusts the fragment and mssfix value according to the discovered path mtu value.
static size_t get_ip_encap_overhead(const struct options *options, const struct link_socket_info *lsi)
static void frame_calculate_fragment(struct frame *frame, const struct key_type *kt, const struct options *options, const struct link_socket_info *lsi)
static size_t adjust_payload_max_cbc(const struct key_type *kt, size_t target)
size_t frame_calculate_protocol_header_size(const struct key_type *kt, const struct options *options, bool occ)
Calculates the size of the OpenVPN protocol header.
unsigned int calc_packet_id_size_dc(const struct options *options, const struct key_type *kt)
Return the size of the packet ID size that is currently in use by cipher and options for the data cha...
size_t frame_calculate_payload_overhead(size_t extra_tun, const struct options *options, const struct key_type *kt)
Calculates the size of the payload overhead according to tun-mtu and tap overhead.
#define OPENVPN_TCPOPT_NOP
#define OPENVPN_IPH_GET_LEN(v)
#define OPENVPN_TCPH_GET_DOFF(d)
#define OPENVPN_TCPOPT_MAXSEG
#define OPENVPN_TCPOPT_EOL
#define OPENVPN_IP_OFFMASK
#define ADJUST_CHECKSUM(acc, cksum)
#define OPENVPN_TCPH_SYN_MASK
#define OPENVPN_TCPOLEN_MAXSEG
#define OPENVPN_IPPROTO_TCP
static int datagram_overhead(sa_family_t af, int proto)
Overhead added to packets by various protocols.
Control Channel Common Data Structures.
Wrapper structure for dynamically allocated memory.
struct frame frame_fragment
struct link_socket ** link_sockets
Contains all state information for one tunnel.
struct context_2 c2
Level 2 context.
struct options options
Options loaded from command line or configuration file.
struct context_1 c1
Level 1 context.
Packet geometry parameters.
int extra_tun
Maximum number of bytes in excess of the tun/tap MTU that might be read from or written to the virtua...
uint16_t mss_fix
The actual MSS value that should be written to the payload packets.
int max_fragment_size
The maximum size of a fragment.
const char * cipher
const name of the cipher
struct openvpn_sockaddr dest
struct link_socket_actual actual
struct link_socket_addr * lsa
union openvpn_sockaddr::@051240265251124304325377241125360350250341115171 addr
struct connection_entry ce
unsigned short sa_family_t