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


#define IP_MCAST_SUBNET_MASK   ((in_addr_t)240<<24)
#define IP_MCAST_NETWORK   ((in_addr_t)224<<24)
#define MROUTE_EXTRACT_BCAST   (1<<1)
#define MROUTE_EXTRACT_MCAST   (1<<2)
#define MROUTE_EXTRACT_IGMP   (1<<3)
#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 ether   mroute_union.ether
#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)


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, uint16_t vid, const struct buffer *buf)
static unsigned int mroute_extract_addr_from_packet (struct mroute_addr *src, struct mroute_addr *dest, uint16_t vid, 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_t * mroute_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

◆ ether

#define ether   mroute_union.ether


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

Definition at line 34 of file mroute.h.


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

Definition at line 33 of file mroute.h.


#define MAPF_IA_EMPTY_IF_UNDEF   (1<<1)

Definition at line 158 of file mroute.h.


#define MAPF_SHOW_ARP   (1<<2)

Definition at line 159 of file mroute.h.


#define MAPF_SUBNET   (1<<0)

Definition at line 157 of file mroute.h.


#define MR_ADDR_ETHER   1

Definition at line 61 of file mroute.h.


#define MR_ADDR_IPV4   2

Definition at line 62 of file mroute.h.


#define MR_ADDR_IPV6   3

Definition at line 63 of file mroute.h.


#define MR_ADDR_MASK   3

Definition at line 64 of file mroute.h.


#define MR_ADDR_NONE   0

Definition at line 60 of file mroute.h.


#define MR_ARP   16

Definition at line 73 of file mroute.h.


#define MR_HELPER_NET_LEN   129

Definition at line 126 of file mroute.h.


#define MR_MAX_ADDR_LEN   20

Definition at line 55 of file mroute.h.


#define MR_WITH_NETBITS   8

Definition at line 70 of file mroute.h.


#define MR_WITH_PORT   4

Definition at line 67 of file mroute.h.


#define MROUTE_EXTRACT_BCAST   (1<<1)

Definition at line 39 of file mroute.h.


#define MROUTE_EXTRACT_IGMP   (1<<3)

Definition at line 41 of file mroute.h.


#define MROUTE_EXTRACT_MCAST   (1<<2)

Definition at line 40 of file mroute.h.



Definition at line 38 of file mroute.h.



Definition at line 44 of file mroute.h.



Definition at line 46 of file mroute.h.



Definition at line 45 of file mroute.h.



Definition at line 43 of file mroute.h.


#define MROUTE_SEC_SHIFT   4

Definition at line 48 of file mroute.h.

◆ 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)

◆ mroute_addr_compare_function()

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

Definition at line 369 of file mroute.c.

References key1, and 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 

◆ mroute_addr_hash_function()

uint32_t mroute_addr_hash_function ( const void *  key,
uint32_t  iv 

Definition at line 361 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)

Definition at line 233 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)

Definition at line 226 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 39 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)

Definition at line 261 of file mroute.h.

References mroute_addr::len, MR_ADDR_NONE, and mroute_addr::type.

◆ mroute_extract_addr_ether()

unsigned int mroute_extract_addr_ether ( struct mroute_addr src,
struct mroute_addr dest,
uint16_t  vid,
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,
uint16_t  vid,
const struct buffer buf,
int  tunnel_type 

◆ 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 

Definition at line 239 of file mroute.h.

References mroute_addr::len, MR_ADDR_IPV4, mroute_addr::netbits, mroute_addr::type, and mroute_addr::v4.

Referenced by multi_init().

◆ 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 540 of file mroute.c.

Referenced by multi_uninit().

◆ mroute_helper_init()

struct mroute_helper* mroute_helper_init ( int  ageable_ttl_secs)

Definition at line 471 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