54 #define ETHERNET_MTU 1500 60 #define TUN_MTU_MIN 100 65 #define LINK_MTU_DEFAULT 1500 70 #define TUN_MTU_DEFAULT 1500 75 #define TAP_MTU_EXTRA_DEFAULT 32 80 #define MSSFIX_DEFAULT 1450 86 #define PAYLOAD_ALIGN 4 129 #define FRAME_HEADROOM_MARKER_DECRYPT (1<<0) 130 #define FRAME_HEADROOM_MARKER_FRAGMENT (1<<1) 131 #define FRAME_HEADROOM_MARKER_READ_LINK (1<<2) 132 #define FRAME_HEADROOM_MARKER_READ_STREAM (1<<3) 145 #define EXTRA_FRAME(f) ((f)->extra_frame) 151 #define TUN_LINK_DELTA(f) ((f)->extra_frame + (f)->extra_tun) 156 #define TUN_MTU_SIZE(f) ((f)->link_mtu - TUN_LINK_DELTA(f)) 157 #define TUN_MTU_SIZE_DYNAMIC(f) ((f)->link_mtu_dynamic - TUN_LINK_DELTA(f)) 165 #define PAYLOAD_SIZE(f) ((f)->link_mtu - (f)->extra_frame) 166 #define PAYLOAD_SIZE_DYNAMIC(f) ((f)->link_mtu_dynamic - (f)->extra_frame) 172 #define EXPANDED_SIZE(f) ((f)->link_mtu) 173 #define EXPANDED_SIZE_DYNAMIC(f) ((f)->link_mtu_dynamic) 174 #define EXPANDED_SIZE_MIN(f) (TUN_MTU_MIN + TUN_LINK_DELTA(f)) 180 #define MAX_RW_SIZE_TUN(f) (PAYLOAD_SIZE(f)) 181 #define MAX_RW_SIZE_LINK(f) (EXPANDED_SIZE(f) + (f)->extra_link) 186 #define FRAME_HEADROOM_BASE(f) (TUN_LINK_DELTA(f) + (f)->extra_buffer + (f)->extra_link) 187 #define FRAME_HEADROOM(f) frame_headroom(f, 0) 188 #define FRAME_HEADROOM_ADJ(f, fm) frame_headroom(f, fm) 194 #define BUF_SIZE(f) (TUN_MTU_SIZE(f) + FRAME_HEADROOM_BASE(f) * 2) 201 bool link_mtu_defined,
203 bool tun_mtu_defined,
220 #define SET_MTU_TUN (1<<0) 221 #define SET_MTU_UPPER_BOUND (1<<1) 230 const bool tuntap_buffer,
231 const unsigned int align_mask);
242 #if EXTENDED_SOCKET_ERROR_CAPABILITY 244 void set_sock_extended_error_passing(
int sd);
246 const char *format_extended_socket_error(
int fd,
int *mtu,
struct gc_arena *
gc);
260 return offset + delta;
static void frame_add_to_extra_buffer(struct frame *frame, const int increment)
void frame_init_mssfix(struct frame *frame, const struct options *options)
Set the –mssfix option.
static void frame_or_align_flags(struct frame *frame, const unsigned int flag_mask)
Packet geometry parameters.
static void frame_add_to_extra_frame(struct frame *frame, const unsigned int increment)
unsigned short sa_family_t
static void frame_add_to_extra_link(struct frame *frame, const int increment)
static void frame_add_to_extra_tun(struct frame *frame, const int increment)
static void frame_add_to_link_mtu(struct frame *frame, const int increment)
int extra_buffer
Maximum number of bytes that processing steps could expand the internal work buffer.
int extra_link
Maximum number of bytes in excess of external network interface's MTU that might be read from or writ...
int extra_tun
Maximum number of bytes in excess of the tun/tap MTU that might be read from or written to the virtua...
static void frame_add_to_align_adjust(struct frame *frame, const int increment)
#define FRAME_HEADROOM_BASE(f)
void alloc_buf_sock_tun(struct buffer *buf, const struct frame *frame, const bool tuntap_buffer, const unsigned int align_mask)
int translate_mtu_discover_type_name(const char *name)
void frame_set_mtu_dynamic(struct frame *frame, int mtu, unsigned int flags)
static void frame_align_to_extra_frame(struct frame *frame)
int extra_frame
Maximum number of bytes that all processing steps together could add.
static bool frame_defined(const struct frame *frame)
void frame_print(const struct frame *frame, int level, const char *prefix)
void frame_subtract_extra(struct frame *frame, const struct frame *src)
Wrapper structure for dynamically allocated memory.
static int frame_headroom(const struct frame *f, const unsigned int flag_mask)
void frame_finalize(struct frame *frame, bool link_mtu_defined, int link_mtu, bool tun_mtu_defined, int tun_mtu)
int link_mtu
Maximum packet size to be sent over the external network interface.
static void frame_remove_from_extra_frame(struct frame *frame, const unsigned int decrement)
Garbage collection arena used to keep track of dynamically allocated memory.
void set_mtu_discover_type(int sd, int mtu_type, sa_family_t proto_af)
int link_mtu_dynamic
Dynamic MTU value for the external network interface.