OpenVPN
|
#include "syshead.h"
#include "mroute.h"
#include "proto.h"
#include "error.h"
#include "socket.h"
#include "memdbg.h"
Go to the source code of this file.
Functions | |
void | mroute_addr_init (struct mroute_addr *addr) |
static bool | is_mac_mcast_addr (const uint8_t *mac) |
static bool | is_mac_mcast_maddr (const struct mroute_addr *addr) |
bool | mroute_learnable_address (const struct mroute_addr *addr, struct gc_arena *gc) |
static void | mroute_get_in_addr_t (struct mroute_addr *ma, const in_addr_t src, unsigned int mask) |
static void | mroute_get_in6_addr (struct mroute_addr *ma, const struct in6_addr src, unsigned int mask) |
static bool | mroute_is_mcast (const in_addr_t addr) |
static bool | mroute_is_mcast_ipv6 (const struct in6_addr addr) |
unsigned int | mroute_extract_addr_ip (struct mroute_addr *src, struct mroute_addr *dest, const struct buffer *buf) |
static void | mroute_copy_ether_to_addr (struct mroute_addr *maddr, const uint8_t *ether_addr, uint16_t vid) |
unsigned int | mroute_extract_addr_ether (struct mroute_addr *src, struct mroute_addr *dest, uint16_t vid, const struct buffer *buf) |
bool | mroute_extract_openvpn_sockaddr (struct mroute_addr *addr, const struct openvpn_sockaddr *osaddr, bool use_port) |
void | mroute_addr_mask_host_bits (struct mroute_addr *ma) |
uint32_t | mroute_addr_hash_function (const void *key, uint32_t iv) |
bool | mroute_addr_compare_function (const void *key1, const void *key2) |
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) |
struct mroute_helper * | mroute_helper_init (int ageable_ttl_secs) |
static void | mroute_helper_regenerate (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) |
void | mroute_helper_free (struct mroute_helper *mh) |
|
inlinestatic |
Definition at line 49 of file mroute.c.
Referenced by is_mac_mcast_maddr(), and mroute_extract_addr_ether().
|
inlinestatic |
Definition at line 55 of file mroute.c.
References mroute_addr::ether, is_mac_mcast_addr(), MR_ADDR_ETHER, MR_ADDR_MASK, and mroute_addr::type.
Referenced by mroute_learnable_address().
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().
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().
void mroute_addr_init | ( | struct mroute_addr * | addr | ) |
void mroute_addr_mask_host_bits | ( | struct mroute_addr * | ma | ) |
Definition at line 321 of file mroute.c.
References ASSERT, IPV4_NETMASK_HOST, MR_ADDR_IPV4, MR_ADDR_IPV6, MR_ADDR_MASK, mroute_addr::netbits, netbits_to_netmask(), mroute_addr::type, mroute_addr::v4, and mroute_addr::v6.
Referenced by multi_get_instance_by_virtual_addr(), and multi_learn_in6_addr().
const char* mroute_addr_print | ( | const struct mroute_addr * | ma, |
struct gc_arena * | gc | ||
) |
Definition at line 376 of file mroute.c.
References MAPF_IA_EMPTY_IF_UNDEF, and mroute_addr_print_ex().
Referenced by check_stale_routes(), learn_address_script(), mroute_learnable_address(), multi_create_instance(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_get_instance_by_virtual_addr(), multi_instance_string(), multi_learn_addr(), multi_print_status(), multi_process_float(), multi_process_incoming_link(), and multi_reap_range().
const char* mroute_addr_print_ex | ( | const struct mroute_addr * | ma, |
const unsigned int | flags, | ||
struct gc_arena * | gc | ||
) |
Definition at line 383 of file mroute.c.
References alloc_buf_gc(), BSTR, buf_printf(), mroute_addr::ether, format_hex_ex(), IA_EMPTY_IF_UNDEF, IA_NET_ORDER, MAPF_IA_EMPTY_IF_UNDEF, MAPF_SHOW_ARP, MAPF_SUBNET, MR_ADDR_ETHER, MR_ADDR_IPV4, MR_ADDR_IPV6, MR_ADDR_MASK, MR_ARP, MR_WITH_NETBITS, MR_WITH_PORT, mroute_addr::netbits, netbits_to_netmask(), print_in6_addr(), print_in_addr_t(), mroute_addr::type, mroute_addr::v4, mroute_addr::v4mappedv6, and mroute_addr::v6.
Referenced by management_learn_addr(), and mroute_addr_print().
|
static |
Definition at line 216 of file mroute.c.
References mroute_addr::ether, mroute_addr::len, MR_ADDR_ETHER, mroute_addr::netbits, OPENVPN_ETH_ALEN, and mroute_addr::type.
Referenced by 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 | ||
) |
Definition at line 229 of file mroute.c.
References BLEN, BPTR, openvpn_ethhdr::dest, is_mac_mcast_addr(), mroute_copy_ether_to_addr(), MROUTE_EXTRACT_BCAST, MROUTE_EXTRACT_SUCCEEDED, and openvpn_ethhdr::source.
Referenced by mroute_extract_addr_from_packet().
unsigned int mroute_extract_addr_ip | ( | struct mroute_addr * | src, |
struct mroute_addr * | dest, | ||
const struct buffer * | buf | ||
) |
Definition at line 151 of file mroute.c.
References BLEN, BPTR, openvpn_iphdr::daddr, openvpn_ipv6hdr::daddr, gc_free(), gc_new(), M_INFO, M_WARN, MROUTE_EXTRACT_IGMP, MROUTE_EXTRACT_MCAST, MROUTE_EXTRACT_SUCCEEDED, mroute_get_in6_addr(), mroute_get_in_addr_t(), mroute_is_mcast(), mroute_is_mcast_ipv6(), msg, OPENVPN_IPH_GET_VER, OPENVPN_IPPROTO_IGMP, print_in6_addr(), openvpn_iphdr::protocol, openvpn_iphdr::saddr, and openvpn_ipv6hdr::saddr.
Referenced by mroute_extract_addr_from_packet().
bool mroute_extract_openvpn_sockaddr | ( | struct mroute_addr * | addr, |
const struct openvpn_sockaddr * | osaddr, | ||
bool | use_port | ||
) |
Definition at line 264 of file mroute.c.
References openvpn_sockaddr::addr, openvpn_sockaddr::in4, openvpn_sockaddr::in6, mroute_addr::len, MR_ADDR_IPV4, MR_ADDR_IPV6, MR_WITH_PORT, mroute_addr::netbits, openvpn_sockaddr::sa, mroute_addr::type, mroute_addr::v4, and mroute_addr::v6.
Referenced by management_callback_kill_by_addr(), multi_get_create_instance_udp(), multi_learn_in_addr_t(), multi_process_float(), and multi_tcp_instance_specific_init().
|
inlinestatic |
Definition at line 123 of file mroute.c.
References mroute_addr::len, MR_ADDR_IPV6, mroute_addr::netbits, mroute_addr::type, and mroute_addr::v6.
Referenced by mroute_extract_addr_ip().
|
inlinestatic |
Definition at line 111 of file mroute.c.
References mroute_addr::len, MR_ADDR_IPV4, mroute_addr::netbits, mroute_addr::type, and mroute_addr::v4.
Referenced by mroute_extract_addr_ip().
void mroute_helper_add_iroute46 | ( | struct mroute_helper * | mh, |
int | netbits | ||
) |
Definition at line 509 of file mroute.c.
References ASSERT, mroute_helper::cache_generation, MR_HELPER_NET_LEN, mroute_helper_regenerate(), and mroute_helper::net_len_refcount.
Referenced by multi_add_iroutes().
void mroute_helper_del_iroute46 | ( | struct mroute_helper * | mh, |
int | netbits | ||
) |
Definition at line 524 of file mroute.c.
References ASSERT, mroute_helper::cache_generation, MR_HELPER_NET_LEN, mroute_helper_regenerate(), and mroute_helper::net_len_refcount.
Referenced by multi_del_iroutes().
void mroute_helper_free | ( | struct mroute_helper * | mh | ) |
Definition at line 540 of file mroute.c.
Referenced by multi_uninit().
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().
|
static |
Definition at line 480 of file mroute.c.
References alloc_buf_gc(), BSTR, buf_printf(), check_debug_level(), D_MULTI_DEBUG, dmsg, gc_free(), gc_new(), MR_HELPER_NET_LEN, mroute_helper::n_net_len, mroute_helper::net_len, and mroute_helper::net_len_refcount.
Referenced by mroute_helper_add_iroute46(), and mroute_helper_del_iroute46().
|
inlinestatic |
Definition at line 135 of file mroute.c.
References IP_MCAST_NETWORK, and IP_MCAST_SUBNET_MASK.
Referenced by mroute_extract_addr_ip().
|
inlinestatic |
Definition at line 144 of file mroute.c.
Referenced by mroute_extract_addr_ip().
bool mroute_learnable_address | ( | const struct mroute_addr * | addr, |
struct gc_arena * | gc | ||
) |
Definition at line 65 of file mroute.c.
References D_MULTI_LOW, is_mac_mcast_maddr(), mroute_addr::len, MR_WITH_NETBITS, mroute_addr_print(), msg, mroute_addr::netbits, mroute_addr::raw_addr, and mroute_addr::type.
Referenced by multi_learn_addr().