69 struct buffer newbuf = *buf;
146 int hlen, olen, optlen;
169 opt = (uint8_t *)(tc + 1);
171 olen -= optlen, opt += optlen)
184 if (optlen <= 0 || optlen > olen)
194 mssval = opt[2] << 8;
198 dmsg(
D_MSS,
"MSS: %" PRIu16
" -> %" PRIu16, mssval, maxmss);
199 accumulate = htons(mssval);
200 opt[2] = (uint8_t)((maxmss>>8)&0xff);
201 opt[3] = (uint8_t)(maxmss&0xff);
202 accumulate -= htons(maxmss);
260#if defined(ENABLE_FRAGMENT)
299 size_t overhead, payload_overhead;
322 payload_overhead += 20 + 20;
362 int proto = lsi->
proto;
371 msg(
D_MTU_INFO,
"Note adjusting 'mssfix %d%s' to 'mssfix %d mtu' "
372 "according to path MTU discovery", o->
ce.
mssfix,
379#if defined(ENABLE_FRAGMENT)
384 msg(
D_MTU_INFO,
"Note adjusting 'fragment %d%s' to 'fragment %d mtu' "
385 "according to path MTU discovery", o->
ce.
fragment,
static bool buf_advance(struct buffer *buf, int size)
#define verify_align_4(ptr)
Data Channel Cryptography Module.
bool cipher_kt_mode_cbc(const char *ciphername)
Check if the supplied cipher is a supported CBC mode cipher.
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)
static void frame_calculate_fragment(struct frame *frame, struct key_type *kt, const struct options *options, struct link_socket_info *lsi)
void mss_fixup_dowork(struct buffer *buf, uint16_t maxmss)
void frame_calculate_dynamic(struct frame *frame, struct key_type *kt, const struct options *options, struct link_socket_info *lsi)
Set the –mssfix option.
void mss_fixup_ipv6(struct buffer *buf, uint16_t maxmss)
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_mssfix(struct frame *frame, struct key_type *kt, const struct options *options, 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)
Control Channel Common Data Structures.
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the 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::@20 addr
struct connection_entry ce
unsigned short sa_family_t