89 if (
BLEN(buf) <
sizeof(*ethhdr))
101 "dropping frame without vlan-tag (proto/len 0x%04x)",
102 ntohs(ethhdr->
proto));
108 "assuming pvid for frame without vlan-tag, pvid: %u (proto/len 0x%04x)",
115 if (
BLEN(buf) <
sizeof(*vlanhdr))
129 msg(
D_VLAN_DEBUG,
"dropping frame with vlan-tag, vid: %u (proto/len 0x%04x)",
130 vid, ntohs(vlanhdr->
proto));
153 "removing vlan-tag from frame: vid: %u, wrapped proto/len: 0x%04x",
154 vid, ntohs(vlanhdr->
proto));
165 ethhdr = memmove(
BPTR(buf), vlanhdr,
sizeof(*ethhdr));
191 if (
BLEN(buf) <
sizeof(*ethhdr))
204 if (
BLEN(buf) <
sizeof(*vlanhdr))
239 memmove(vlanhdr, ethhdr,
sizeof(*ethhdr));
static bool buf_advance(struct buffer *buf, int size)
static uint8_t * buf_prepend(struct buffer *buf, int size)
static int buf_reverse_capacity(const struct buffer *buf)
Header file for server-mode related structures and functions.
@ VLAN_ONLY_UNTAGGED_OR_PRIORITY
#define OPENVPN_ETH_P_8021Q
#define SIZE_ETH_TO_8021Q_HDR
#define OPENVPN_8021Q_MASK_VID
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
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.
Main OpenVPN server state structure.
struct context top
Storage structure for process-wide configuration.
Server-mode state structure for one single VPN tunnel.
struct context context
The context structure storing state for this VPN tunnel.
enum vlan_acceptable_frames vlan_accept
int16_t vlan_decapsulate(const struct context *c, struct buffer *buf)
void vlan_process_outgoing_tun(struct multi_context *m, struct multi_instance *mi)
static void vlanhdr_set_vid(struct openvpn_8021qhdr *hdr, const uint16_t vid)
static uint16_t vlanhdr_get_vid(const struct openvpn_8021qhdr *hdr)
void vlan_encapsulate(const struct context *c, struct buffer *buf)
bool vlan_is_tagged(const struct buffer *buf)