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);
234 unsigned int ret = 0;
268 switch (osaddr->
addr.
sa.sa_family)
333 in_addr_t addr = ntohl(ma->
v4.
addr);
335 ma->
v4.
addr = htonl(addr);
339 int byte =
sizeof(ma->
v6.
addr) - 1;
340 int bits_to_clear = 128 - ma->
netbits;
342 while (
byte >= 0 && bits_to_clear > 0)
344 if (bits_to_clear >= 8)
346 ma->
v6.
addr.s6_addr[
byte--] = 0;
355 ASSERT( bits_to_clear == 0 );
392 const unsigned int flags,
404 sizeof(
ma->ether.addr), 0, 1,
":",
gc));
504 mh->
net_len[j++] = (uint8_t) i;
515 for (
i = 0;
i <
mh->n_net_len; ++
i)
531 ++
mh->cache_generation;
532 ++
mh->net_len_refcount[netbits];
533 if (
mh->net_len_refcount[netbits] == 1)
546 ++
mh->cache_generation;
547 --
mh->net_len_refcount[netbits];
548 ASSERT(
mh->net_len_refcount[netbits] >= 0);
549 if (!
mh->net_len_refcount[netbits])
bool buf_printf(struct buffer *buf, const char *format,...)
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 buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
static void gc_free(struct gc_arena *a)
#define ALLOC_OBJ_CLEAR(dptr, type)
static struct gc_arena gc_new(void)
static const char *const key1
uint32_t hash_func(const uint8_t *k, uint32_t length, uint32_t initval)
void mroute_addr_mask_host_bits(struct mroute_addr *ma)
void mroute_helper_add_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)
static bool is_mac_mcast_maddr(const struct mroute_addr *addr)
static void mroute_copy_ether_to_addr(struct mroute_addr *maddr, const uint8_t *ether_addr, uint16_t vid)
const char * mroute_addr_print_ex(const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc)
bool mroute_extract_openvpn_sockaddr(struct mroute_addr *addr, const struct openvpn_sockaddr *osaddr, bool use_port)
const char * mroute_addr_print(const struct mroute_addr *ma, struct gc_arena *gc)
static bool is_mac_mcast_addr(const uint8_t *mac)
uint32_t mroute_addr_hash_function(const void *key, uint32_t iv)
void mroute_helper_del_iroute46(struct mroute_helper *mh, int netbits)
bool mroute_learnable_address(const struct mroute_addr *addr, struct gc_arena *gc)
static bool mroute_is_mcast(const in_addr_t addr)
bool mroute_addr_compare_function(const void *key1, const void *key2)
static bool mroute_is_mcast_ipv6(const struct in6_addr addr)
unsigned int mroute_extract_addr_ether(struct mroute_addr *src, struct mroute_addr *dest, uint16_t vid, const struct buffer *buf)
struct mroute_helper * mroute_helper_init(int ageable_ttl_secs)
void mroute_addr_init(struct mroute_addr *addr)
static void mroute_helper_regenerate(struct mroute_helper *mh)
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)
void mroute_helper_free(struct mroute_helper *mh)
static uint32_t mroute_addr_hash_len(const struct mroute_addr *a)
#define MROUTE_EXTRACT_SUCCEEDED
#define MROUTE_EXTRACT_MCAST
#define IP_MCAST_SUBNET_MASK
static const uint8_t * mroute_addr_hash_ptr(const struct mroute_addr *a)
#define MR_HELPER_NET_LEN
#define MAPF_IA_EMPTY_IF_UNDEF
static bool mroute_addr_equal(const struct mroute_addr *a1, const struct mroute_addr *a2)
#define MROUTE_EXTRACT_BCAST
#define MROUTE_EXTRACT_IGMP
#define IPV4_NETMASK_HOST
static bool check_debug_level(unsigned int level)
#define OPENVPN_IPH_GET_VER(v)
#define OPENVPN_IPPROTO_IGMP
static in_addr_t netbits_to_netmask(const int netbits)
const char * proto2ascii(int proto, sa_family_t af, bool display_form)
const char * print_in6_addr(struct in6_addr a6, unsigned int flags, struct gc_arena *gc)
const char * print_in_addr_t(in_addr_t addr, unsigned int flags, struct gc_arena *gc)
#define IA_EMPTY_IF_UNDEF
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Garbage collection arena used to keep track of dynamically allocated memory.
Container for bidirectional cipher and HMAC key material.
Container for unidirectional cipher and HMAC key material.
uint8_t raw_addr[MR_MAX_ADDR_LEN]
struct mroute_addr::@2::@4 ether
struct mroute_addr::@2::@6 v6
uint8_t addr[OPENVPN_ETH_ALEN]
struct mroute_addr::@2::@5 v4
int net_len_refcount[MR_HELPER_NET_LEN]
uint8_t net_len[MR_HELPER_NET_LEN]
uint8_t dest[OPENVPN_ETH_ALEN]
uint8_t source[OPENVPN_ETH_ALEN]
union openvpn_sockaddr::@20 addr