OpenVPN
Data Structures | Macros | Functions
mroute.h File Reference
#include "buffer.h"
#include "list.h"
#include "route.h"
#include <stddef.h>
Include dependency graph for mroute.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mroute_addr
 
struct  mroute_helper
 

Macros

#define IP_MCAST_SUBNET_MASK   ((in_addr_t)240<<24)
 
#define IP_MCAST_NETWORK   ((in_addr_t)224<<24)
 
#define MROUTE_EXTRACT_SUCCEEDED   (1<<0)
 
#define MROUTE_EXTRACT_BCAST   (1<<1)
 
#define MROUTE_EXTRACT_MCAST   (1<<2)
 
#define MROUTE_EXTRACT_IGMP   (1<<3)
 
#define MROUTE_SEC_EXTRACT_SUCCEEDED   (1<<(0+MROUTE_SEC_SHIFT))
 
#define MROUTE_SEC_EXTRACT_BCAST   (1<<(1+MROUTE_SEC_SHIFT))
 
#define MROUTE_SEC_EXTRACT_MCAST   (1<<(2+MROUTE_SEC_SHIFT))
 
#define MROUTE_SEC_EXTRACT_IGMP   (1<<(3+MROUTE_SEC_SHIFT))
 
#define MROUTE_SEC_SHIFT   4
 
#define MR_MAX_ADDR_LEN   20
 
#define MR_ADDR_NONE   0
 
#define MR_ADDR_ETHER   1
 
#define MR_ADDR_IPV4   2
 
#define MR_ADDR_IPV6   3
 
#define MR_ADDR_MASK   3
 
#define MR_WITH_PORT   4
 
#define MR_WITH_NETBITS   8
 
#define MR_ARP   16
 
#define raw_addr   mroute_union.raw_addr
 
#define eth_addr   mroute_union.eth_addr
 
#define v4   mroute_union.v4
 
#define v6   mroute_union.v6
 
#define v4mappedv6   mroute_union.v4mappedv6
 
#define MR_HELPER_NET_LEN   129
 
#define MAPF_SUBNET   (1<<0)
 
#define MAPF_IA_EMPTY_IF_UNDEF   (1<<1)
 
#define MAPF_SHOW_ARP   (1<<2)
 

Functions

bool mroute_extract_openvpn_sockaddr (struct mroute_addr *addr, const struct openvpn_sockaddr *osaddr, bool use_port)
 
bool mroute_learnable_address (const struct mroute_addr *addr, struct gc_arena *gc)
 
uint32_t mroute_addr_hash_function (const void *key, uint32_t iv)
 
bool mroute_addr_compare_function (const void *key1, const void *key2)
 
void mroute_addr_init (struct mroute_addr *addr)
 
const char * mroute_addr_print (const struct mroute_addr *ma, struct gc_arena *gc)
 
const char * mroute_addr_print_ex (const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc)
 
void mroute_addr_mask_host_bits (struct mroute_addr *ma)
 
struct mroute_helpermroute_helper_init (int ageable_ttl_secs)
 
void mroute_helper_free (struct mroute_helper *mh)
 
void mroute_helper_add_iroute46 (struct mroute_helper *mh, int netbits)
 
void mroute_helper_del_iroute46 (struct mroute_helper *mh, int netbits)
 
unsigned int mroute_extract_addr_ip (struct mroute_addr *src, struct mroute_addr *dest, const struct buffer *buf)
 
unsigned int mroute_extract_addr_ether (struct mroute_addr *src, struct mroute_addr *dest, struct mroute_addr *esrc, struct mroute_addr *edest, const struct buffer *buf)
 
static unsigned int mroute_extract_addr_from_packet (struct mroute_addr *src, struct mroute_addr *dest, struct mroute_addr *esrc, struct mroute_addr *edest, const struct buffer *buf, int tunnel_type)
 
static bool mroute_addr_equal (const struct mroute_addr *a1, const struct mroute_addr *a2)
 
static const uint8_tmroute_addr_hash_ptr (const struct mroute_addr *a)
 
static uint32_t mroute_addr_hash_len (const struct mroute_addr *a)
 
static void mroute_extract_in_addr_t (struct mroute_addr *dest, const in_addr_t src)
 
static in_addr_t in_addr_t_from_mroute_addr (const struct mroute_addr *addr)
 
static void mroute_addr_reset (struct mroute_addr *ma)
 

Macro Definition Documentation

◆ eth_addr

#define eth_addr   mroute_union.eth_addr

◆ IP_MCAST_NETWORK

#define IP_MCAST_NETWORK   ((in_addr_t)224<<24)

Definition at line 36 of file mroute.h.

Referenced by mroute_is_mcast().

◆ IP_MCAST_SUBNET_MASK

#define IP_MCAST_SUBNET_MASK   ((in_addr_t)240<<24)

Definition at line 35 of file mroute.h.

Referenced by mroute_is_mcast().

◆ MAPF_IA_EMPTY_IF_UNDEF

#define MAPF_IA_EMPTY_IF_UNDEF   (1<<1)

Definition at line 157 of file mroute.h.

Referenced by mroute_addr_print(), and mroute_addr_print_ex().

◆ MAPF_SHOW_ARP

#define MAPF_SHOW_ARP   (1<<2)

◆ MAPF_SUBNET

#define MAPF_SUBNET   (1<<0)

Definition at line 156 of file mroute.h.

Referenced by management_notify_generic(), and mroute_addr_print_ex().

◆ MR_ADDR_ETHER

#define MR_ADDR_ETHER   1

Definition at line 63 of file mroute.h.

Referenced by is_mac_mcast_maddr(), mroute_addr_print_ex(), and mroute_extract_addr_ether().

◆ MR_ADDR_IPV4

#define MR_ADDR_IPV4   2

◆ MR_ADDR_IPV6

#define MR_ADDR_IPV6   3

◆ MR_ADDR_MASK

#define MR_ADDR_MASK   3

◆ MR_ADDR_NONE

#define MR_ADDR_NONE   0

Definition at line 62 of file mroute.h.

Referenced by mroute_addr_reset().

◆ MR_ARP

#define MR_ARP   16

Definition at line 75 of file mroute.h.

Referenced by mroute_addr_print_ex(), and mroute_is_mcast_ipv6().

◆ MR_HELPER_NET_LEN

#define MR_HELPER_NET_LEN   129

◆ MR_MAX_ADDR_LEN

#define MR_MAX_ADDR_LEN   20

Definition at line 57 of file mroute.h.

◆ MR_WITH_NETBITS

#define MR_WITH_NETBITS   8

◆ MR_WITH_PORT

#define MR_WITH_PORT   4

Definition at line 69 of file mroute.h.

Referenced by mroute_addr_print_ex(), and mroute_extract_openvpn_sockaddr().

◆ MROUTE_EXTRACT_BCAST

#define MROUTE_EXTRACT_BCAST   (1<<1)

◆ MROUTE_EXTRACT_IGMP

#define MROUTE_EXTRACT_IGMP   (1<<3)

Definition at line 43 of file mroute.h.

Referenced by mroute_extract_addr_ip().

◆ MROUTE_EXTRACT_MCAST

#define MROUTE_EXTRACT_MCAST   (1<<2)

◆ MROUTE_EXTRACT_SUCCEEDED

#define MROUTE_EXTRACT_SUCCEEDED   (1<<0)

◆ MROUTE_SEC_EXTRACT_BCAST

#define MROUTE_SEC_EXTRACT_BCAST   (1<<(1+MROUTE_SEC_SHIFT))

Definition at line 46 of file mroute.h.

◆ MROUTE_SEC_EXTRACT_IGMP

#define MROUTE_SEC_EXTRACT_IGMP   (1<<(3+MROUTE_SEC_SHIFT))

Definition at line 48 of file mroute.h.

◆ MROUTE_SEC_EXTRACT_MCAST

#define MROUTE_SEC_EXTRACT_MCAST   (1<<(2+MROUTE_SEC_SHIFT))

Definition at line 47 of file mroute.h.

◆ MROUTE_SEC_EXTRACT_SUCCEEDED

#define MROUTE_SEC_EXTRACT_SUCCEEDED   (1<<(0+MROUTE_SEC_SHIFT))

Definition at line 45 of file mroute.h.

◆ MROUTE_SEC_SHIFT

#define MROUTE_SEC_SHIFT   4

Definition at line 50 of file mroute.h.

Referenced by mroute_extract_addr_ether().

◆ raw_addr

#define raw_addr   mroute_union.raw_addr

◆ v4

#define v4   mroute_union.v4

◆ v4mappedv6

#define v4mappedv6   mroute_union.v4mappedv6

◆ v6

#define v6   mroute_union.v6

Function Documentation

◆ in_addr_t_from_mroute_addr()

static in_addr_t in_addr_t_from_mroute_addr ( const struct mroute_addr addr)
inlinestatic

◆ mroute_addr_compare_function()

bool mroute_addr_compare_function ( const void *  key1,
const void *  key2 
)

Definition at line 417 of file mroute.c.

References mroute_addr_equal().

Referenced by multi_init().

◆ mroute_addr_equal()

static bool mroute_addr_equal ( const struct mroute_addr a1,
const struct mroute_addr a2 
)
inlinestatic

◆ mroute_addr_hash_function()

uint32_t mroute_addr_hash_function ( const void *  key,
uint32_t  iv 
)

Definition at line 409 of file mroute.c.

References hash_func(), mroute_addr_hash_len(), and mroute_addr_hash_ptr().

Referenced by multi_init().

◆ mroute_addr_hash_len()

static uint32_t mroute_addr_hash_len ( const struct mroute_addr a)
inlinestatic

Definition at line 234 of file mroute.h.

References mroute_addr::len.

Referenced by mroute_addr_hash_function().

◆ mroute_addr_hash_ptr()

static const uint8_t* mroute_addr_hash_ptr ( const struct mroute_addr a)
inlinestatic

Definition at line 227 of file mroute.h.

References mroute_addr::type.

Referenced by mroute_addr_hash_function().

◆ mroute_addr_init()

void mroute_addr_init ( struct mroute_addr addr)

Definition at line 42 of file mroute.c.

References CLEAR.

Referenced by multi_create_instance().

◆ mroute_addr_mask_host_bits()

void mroute_addr_mask_host_bits ( struct mroute_addr ma)

◆ mroute_addr_print()

const char* mroute_addr_print ( const struct mroute_addr ma,
struct gc_arena gc 
)

◆ mroute_addr_print_ex()

const char* mroute_addr_print_ex ( const struct mroute_addr ma,
const unsigned int  flags,
struct gc_arena gc 
)

◆ mroute_addr_reset()

static void mroute_addr_reset ( struct mroute_addr ma)
inlinestatic

◆ mroute_extract_addr_ether()

unsigned int mroute_extract_addr_ether ( struct mroute_addr src,
struct mroute_addr dest,
struct mroute_addr esrc,
struct mroute_addr edest,
const struct buffer buf 
)

◆ mroute_extract_addr_from_packet()

static unsigned int mroute_extract_addr_from_packet ( struct mroute_addr src,
struct mroute_addr dest,
struct mroute_addr esrc,
struct mroute_addr edest,
const struct buffer buf,
int  tunnel_type 
)
inlinestatic

◆ mroute_extract_addr_ip()

unsigned int mroute_extract_addr_ip ( struct mroute_addr src,
struct mroute_addr dest,
const struct buffer buf 
)

◆ mroute_extract_in_addr_t()

static void mroute_extract_in_addr_t ( struct mroute_addr dest,
const in_addr_t  src 
)
inlinestatic

◆ mroute_extract_openvpn_sockaddr()

bool mroute_extract_openvpn_sockaddr ( struct mroute_addr addr,
const struct openvpn_sockaddr osaddr,
bool  use_port 
)

◆ mroute_helper_add_iroute46()

void mroute_helper_add_iroute46 ( struct mroute_helper mh,
int  netbits 
)

◆ mroute_helper_del_iroute46()

void mroute_helper_del_iroute46 ( struct mroute_helper mh,
int  netbits 
)

◆ mroute_helper_free()

void mroute_helper_free ( struct mroute_helper mh)

Definition at line 587 of file mroute.c.

References dummy(), and free.

Referenced by multi_uninit().

◆ mroute_helper_init()

struct mroute_helper* mroute_helper_init ( int  ageable_ttl_secs)

Definition at line 518 of file mroute.c.

References mroute_helper::ageable_ttl_secs, and ALLOC_OBJ_CLEAR.

Referenced by multi_init().

◆ mroute_learnable_address()

bool mroute_learnable_address ( const struct mroute_addr addr,
struct gc_arena gc 
)