Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6_fib.c
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/route.h> | #include <net/route.h> | ||||
#include <net/route/route_ctl.h> | #include <net/route/route_ctl.h> | ||||
#include <net/route/route_var.h> | #include <net/route/route_var.h> | ||||
#include <net/route/nhop.h> | #include <net/route/nhop.h> | ||||
#include <net/toeplitz.h> | |||||
#include <net/vnet.h> | #include <net/vnet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#include <netinet/ip_mroute.h> | #include <netinet/ip_mroute.h> | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet6/in6_fib.h> | #include <netinet6/in6_fib.h> | ||||
#include <netinet6/in6_var.h> | #include <netinet6/in6_var.h> | ||||
#include <netinet6/nd6.h> | #include <netinet6/nd6.h> | ||||
#include <netinet6/scope6_var.h> | #include <netinet6/scope6_var.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#ifdef INET6 | #ifdef INET6 | ||||
CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); | CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); | ||||
#ifdef ROUTE_MPATH | |||||
struct _hash_5tuple_ipv6 { | |||||
struct in6_addr src; | |||||
struct in6_addr dst; | |||||
unsigned short src_port; | |||||
unsigned short dst_port; | |||||
char proto; | |||||
char spare[3]; | |||||
}; | |||||
_Static_assert(sizeof(struct _hash_5tuple_ipv6) == 40, | |||||
"_hash_5tuple_ipv6 size is wrong"); | |||||
uint32_t | |||||
fib6_calc_software_hash(const struct in6_addr *src, const struct in6_addr *dst, | |||||
unsigned short src_port, unsigned short dst_port, char proto, | |||||
uint32_t *phashtype) | |||||
{ | |||||
struct _hash_5tuple_ipv6 data; | |||||
data.src = *src; | |||||
data.dst = *dst; | |||||
data.src_port = src_port; | |||||
data.dst_port = dst_port; | |||||
data.proto = proto; | |||||
data.spare[0] = data.spare[1] = data.spare[2] = 0; | |||||
*phashtype = M_HASHTYPE_OPAQUE_HASH; | |||||
return (toeplitz_hash(MPATH_ENTROPY_KEY_LEN, mpath_entropy_key, | |||||
sizeof(data), (uint8_t *)&data)); | |||||
} | |||||
#endif | |||||
/* | /* | ||||
* Looks up path in fib @fibnum specified by @dst. | * Looks up path in fib @fibnum specified by @dst. | ||||
* Assumes scope is deembedded and provided in @scopeid. | * Assumes scope is deembedded and provided in @scopeid. | ||||
* | * | ||||
* Returns path nexthop on success. Nexthop is safe to use | * Returns path nexthop on success. Nexthop is safe to use | ||||
* within the current network epoch. If longer lifetime is required, | * within the current network epoch. If longer lifetime is required, | ||||
* one needs to pass NHR_REF as a flag. This will return referenced | * one needs to pass NHR_REF as a flag. This will return referenced | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |