OpenVPN
Functions
proto.c File Reference
#include "syshead.h"
#include "proto.h"
#include "error.h"
#include "memdbg.h"
Include dependency graph for proto.c:

Go to the source code of this file.

Functions

static bool is_ipv_X (int tunnel_type, struct buffer *buf, int ip_ver)
 
bool is_ipv4 (int tunnel_type, struct buffer *buf)
 
bool is_ipv6 (int tunnel_type, struct buffer *buf)
 
uint16_t ip_checksum (const sa_family_t af, const uint8_t *payload, const int len_payload, const uint8_t *src_addr, const uint8_t *dest_addr, const int proto)
 Calculates an IP or IPv6 checksum with a pseudo header as required by TCP, UDP and ICMPv6. More...
 

Function Documentation

◆ ip_checksum()

uint16_t ip_checksum ( const sa_family_t  af,
const uint8_t *  payload,
const int  len_payload,
const uint8_t *  src_addr,
const uint8_t *  dest_addr,
const int  proto 
)

Calculates an IP or IPv6 checksum with a pseudo header as required by TCP, UDP and ICMPv6.

Parameters
af- Address family for which the checksum is calculated AF_INET or AF_INET6
payload- the TCP, ICMPv6 or UDP packet
len_payload- length of payload
src_addr- Source address of the packet
dest_addr- Destination address of the packet
protonext - header or IP protocol of the packet
Returns
The calculated checksum in host order

Definition at line 123 of file proto.c.

Referenced by dhcp_extract_router_msg(), and ipv6_send_icmp_unreachable().

◆ is_ipv4()

bool is_ipv4 ( int  tunnel_type,
struct buffer buf 
)

Definition at line 111 of file proto.c.

References is_ipv_X().

Referenced by process_ip_header().

◆ is_ipv6()

bool is_ipv6 ( int  tunnel_type,
struct buffer buf 
)

Definition at line 116 of file proto.c.

References is_ipv_X().

Referenced by ipv6_send_icmp_unreachable(), and process_ip_header().

◆ is_ipv_X()

static bool is_ipv_X ( int  tunnel_type,
struct buffer buf,
int  ip_ver 
)
static