Go to the documentation of this file.
51 return (
bool) (mac[0] & 1);
68 bool all_zeros =
true;
71 for (i = 0; i < addr->
len; ++i)
88 msg(
D_MULTI_LOW,
"Can't learn %s: network is all 0s, but netbits >= 8",
102 msg(
D_MULTI_LOW,
"Can't learn %s: network is a multicast address",
146 return (addr.s6_addr[0] == 0xff);
154 unsigned int ret = 0;
189 msg(
M_INFO,
"IPv6 packet! src=%s, dst=%s",
208 msg(
M_WARN,
"IP packet with unknown IP version=%d seen",
217 const uint8_t *ether_addr,
224 maddr->
len +=
sizeof(vid);
225 maddr->
ether.vid = vid;
234 unsigned int ret = 0;
268 switch (osaddr->
addr.
sa.sa_family)
277 addr->
v4.addr = osaddr->
addr.
in4.sin_addr.s_addr;
278 addr->
v4.port = osaddr->
addr.
in4.sin_port;
285 addr->
v4.addr = osaddr->
addr.
in4.sin_addr.s_addr;
296 addr->
v6.addr = osaddr->
addr.
in6.sin6_addr;
297 addr->
v6.port = osaddr->
addr.
in6.sin6_port;
304 addr->
v6.addr = osaddr->
addr.
in6.sin6_addr;
325 in_addr_t addr = ntohl(ma->
v4.addr);
327 ma->
v4.addr = htonl(addr);
331 int byte =
sizeof(ma->
v6.addr) - 1;
332 int bits_to_clear = 128 - ma->
netbits;
334 while (
byte >= 0 && bits_to_clear > 0)
336 if (bits_to_clear >= 8)
338 ma->
v6.addr.s6_addr[
byte--] = 0;
347 ASSERT( bits_to_clear == 0 );
384 const unsigned int flags,
396 sizeof(ma->
ether.addr), 0, 1,
":", gc));
429 if (IN6_IS_ADDR_V4MAPPED( &maddr.
v6.addr ) )
487 mh->
net_len[j++] = (uint8_t) i;
static void mroute_helper_regenerate(struct mroute_helper *mh)
struct mroute_helper * mroute_helper_init(int ageable_ttl_secs)
union openvpn_sockaddr::@14 addr
#define MAPF_IA_EMPTY_IF_UNDEF
static struct gc_arena gc_new(void)
static bool mroute_is_mcast(const in_addr_t addr)
static const char *const key1
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
int net_len_refcount[MR_HELPER_NET_LEN]
char * format_hex_ex(const uint8_t *data, int size, int maxoutput, unsigned int space_break_flags, const char *separator, struct gc_arena *gc)
struct mroute_addr::@1::@2 ether
uint32_t mroute_addr_hash_function(const void *key, uint32_t iv)
unsigned int mroute_extract_addr_ether(struct mroute_addr *src, struct mroute_addr *dest, uint16_t vid, const struct buffer *buf)
uint8_t net_len[MR_HELPER_NET_LEN]
Container for unidirectional cipher and HMAC key material.
static void mroute_get_in6_addr(struct mroute_addr *ma, const struct in6_addr src, unsigned int mask)
#define MR_HELPER_NET_LEN
void mroute_helper_free(struct mroute_helper *mh)
void mroute_helper_del_iroute46(struct mroute_helper *mh, int netbits)
struct mroute_addr::@1::@3 v4
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
static uint32_t mroute_addr_hash_len(const struct mroute_addr *a)
void mroute_addr_init(struct mroute_addr *addr)
#define MROUTE_EXTRACT_IGMP
static void mroute_get_in_addr_t(struct mroute_addr *ma, const in_addr_t src, unsigned int mask)
unsigned int cache_generation
struct mroute_addr::@1::@5 v4mappedv6
static bool is_mac_mcast_maddr(const struct mroute_addr *addr)
bool mroute_extract_openvpn_sockaddr(struct mroute_addr *addr, const struct openvpn_sockaddr *osaddr, bool use_port)
Wrapper structure for dynamically allocated memory.
uint8_t source[OPENVPN_ETH_ALEN]
#define IPV4_NETMASK_HOST
uint8_t dest[OPENVPN_ETH_ALEN]
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
static bool is_mac_mcast_addr(const uint8_t *mac)
Garbage collection arena used to keep track of dynamically allocated memory.
const char * mroute_addr_print(const struct mroute_addr *ma, struct gc_arena *gc)
#define IP_MCAST_SUBNET_MASK
const char * mroute_addr_print_ex(const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc)
static bool check_debug_level(unsigned int level)
struct mroute_addr::@1::@4 v6
void mroute_helper_add_iroute46(struct mroute_helper *mh, int netbits)
static in_addr_t netbits_to_netmask(const int netbits)
#define OPENVPN_IPH_GET_VER(v)
unsigned int mroute_extract_addr_ip(struct mroute_addr *src, struct mroute_addr *dest, const struct buffer *buf)
static void gc_free(struct gc_arena *a)
bool mroute_addr_compare_function(const void *key1, const void *key2)
static void mroute_copy_ether_to_addr(struct mroute_addr *maddr, const uint8_t *ether_addr, uint16_t vid)
#define ALLOC_OBJ_CLEAR(dptr, type)
bool mroute_learnable_address(const struct mroute_addr *addr, struct gc_arena *gc)
#define MROUTE_EXTRACT_BCAST
Container for bidirectional cipher and HMAC key material.
#define IA_EMPTY_IF_UNDEF
#define MROUTE_EXTRACT_MCAST
void mroute_addr_mask_host_bits(struct mroute_addr *ma)
#define OPENVPN_IPPROTO_IGMP
uint8_t raw_addr[MR_MAX_ADDR_LEN]
#define MROUTE_EXTRACT_SUCCEEDED
static bool mroute_is_mcast_ipv6(const struct in6_addr addr)
uint32_t hash_func(const uint8_t *k, uint32_t length, uint32_t initval)
static const uint8_t * mroute_addr_hash_ptr(const struct mroute_addr *a)
bool buf_printf(struct buffer *buf, const char *format,...)
static bool mroute_addr_equal(const struct mroute_addr *a1, const struct mroute_addr *a2)