88 if (
BLEN(buf) <
sizeof(*ethhdr))
100 ntohs(ethhdr->
proto));
105 msg(
D_VLAN_DEBUG,
"assuming pvid for frame without vlan-tag, pvid: %u (proto/len 0x%04x)",
112 if (
BLEN(buf) <
sizeof(*vlanhdr))
126 msg(
D_VLAN_DEBUG,
"dropping frame with vlan-tag, vid: %u (proto/len 0x%04x)", vid,
127 ntohs(vlanhdr->
proto));
149 msg(
D_VLAN_DEBUG,
"removing vlan-tag from frame: vid: %u, wrapped proto/len: 0x%04x",
150 vid, ntohs(vlanhdr->
proto));
161 ethhdr = memmove(
BPTR(buf), vlanhdr,
sizeof(*ethhdr));
187 if (
BLEN(buf) <
sizeof(*ethhdr))
200 if (
BLEN(buf) <
sizeof(*vlanhdr))
234 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)