Go to the documentation of this file.
26 #elif defined(_MSC_VER)
71 struct buffer newbuf = *buf;
148 int hlen, olen, optlen;
171 opt = (uint8_t *)(tc + 1);
173 olen -= optlen, opt += optlen)
186 if (optlen <= 0 || optlen > olen)
196 mssval = (opt[2]<<8)+opt[3];
199 dmsg(
D_MSS,
"MSS: %d -> %d", (
int) mssval, (
int) maxmss);
200 accumulate = htons(mssval);
201 opt[2] = (maxmss>>8)&0xff;
202 opt[3] = maxmss&0xff;
203 accumulate -= htons(maxmss);
211 static inline unsigned int
261 #if defined(ENABLE_FRAGMENT)
262 unsigned int overhead;
300 unsigned int overhead, payload_overhead;
323 payload_overhead += 20 + 20;
363 int proto = lsi->
proto;
372 msg(
D_MTU_INFO,
"Note adjusting 'mssfix %d%s' to 'mssfix %d mtu' "
373 "according to path MTU discovery", o->
ce.
mssfix,
380 #if defined(ENABLE_FRAGMENT)
385 msg(
D_MTU_INFO,
"Note adjusting 'fragment %d%s' to 'fragment %d mtu' "
386 "according to path MTU discovery", o->
ce.
fragment,
#define OPENVPN_IPPROTO_TCP
union openvpn_sockaddr::@14 addr
unsigned int mss_fix
The actual MSS value that should be written to the payload packets.
Contains all state information for one tunnel.
#define OPENVPN_TCPOPT_MAXSEG
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.
struct link_socket_addr * lsa
#define OPENVPN_IP_OFFMASK
static unsigned int adjust_payload_max_cbc(const struct key_type *kt, unsigned int target)
struct connection_entry ce
static unsigned int get_ip_encap_overhead(const struct options *options, const struct link_socket_info *lsi)
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.
Packet geometry parameters.
unsigned short sa_family_t
#define OPENVPN_TCPOPT_NOP
int cipher_kt_block_size(const char *ciphername)
Returns the block size of the cipher, in bytes.
#define ADJUST_CHECKSUM(acc, cksum)
static void frame_calculate_fragment(struct frame *frame, struct key_type *kt, const struct options *options, struct link_socket_info *lsi)
struct context_2 c2
Level 2 context.
static bool buf_advance(struct buffer *buf, int size)
#define OPENVPN_TCPOLEN_MAXSEG
#define OPENVPN_TCPOPT_EOL
int extra_tun
Maximum number of bytes in excess of the tun/tap MTU that might be read from or written to the virtua...
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_dowork(struct buffer *buf, uint16_t maxmss)
struct options options
Options loaded from command line or configuration file.
#define verify_align_4(ptr)
struct frame frame_fragment
static struct link_socket_info * get_link_socket_info(struct context *c)
Wrapper structure for dynamically allocated memory.
int max_fragment_size
The maximum size of a fragment.
struct link_socket_actual actual
struct link_socket * link_socket
const char * cipher
const name of the cipher
void mss_fixup_ipv4(struct buffer *buf, int maxmss)
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...
bool cipher_kt_mode_cbc(const char *ciphername)
Check if the supplied cipher is a supported CBC mode cipher.
#define OPENVPN_TCPH_GET_DOFF(d)
#define OPENVPN_TCPH_SYN_MASK
static unsigned int round_down_uint(unsigned int num, unsigned int multiple)
Rounds down num to the nearest multiple of multiple.
static int datagram_overhead(sa_family_t af, int proto)
static void frame_calculate_mssfix(struct frame *frame, struct key_type *kt, const struct options *options, struct link_socket_info *lsi)
struct openvpn_sockaddr dest
void mss_fixup_ipv6(struct buffer *buf, int maxmss)
#define OPENVPN_IPH_GET_LEN(v)
void frame_adjust_path_mtu(struct context *c)
Checks and adjusts the fragment and mssfix value according to the discovered path mtu value.
struct context_1 c1
Level 1 context.