Changeset View
Changeset View
Standalone View
Standalone View
sys/net/route.h
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | |||||
#define NHR_NONE 0x00 /* empty flags field */ | #define NHR_NONE 0x00 /* empty flags field */ | ||||
#define NHR_REF 0x01 /* reference nexhop */ | #define NHR_REF 0x01 /* reference nexhop */ | ||||
#define NHR_NODEFAULT 0x02 /* uRPF: do not consider default route */ | #define NHR_NODEFAULT 0x02 /* uRPF: do not consider default route */ | ||||
/* Control plane route request flags */ | /* Control plane route request flags */ | ||||
#define NHR_COPY 0x100 /* Copy rte data */ | #define NHR_COPY 0x100 /* Copy rte data */ | ||||
#define NHR_UNLOCKED 0x200 /* Do not lock table */ | #define NHR_UNLOCKED 0x200 /* Do not lock table */ | ||||
/* nd6 / arpresolve gateway type */ | |||||
/* FIXME need proper place */ | |||||
typedef enum { | |||||
GW_NONE = 0, | |||||
#ifdef INET | |||||
GW_IPV4_SRC, | |||||
#endif | |||||
#ifdef INET6 | |||||
GW_IPV6_SRC | |||||
#endif | |||||
} gw_type_t; | |||||
/* FIXME need proper place */ | |||||
static __inline gw_type_t | |||||
ro_get_gw_type(struct route *ro) | |||||
{ | |||||
if (ro == NULL || (ro->ro_flags & RT_HAS_GW) == 0) | |||||
return GW_NONE; | |||||
switch(ro->ro_dst.sa_family) { | |||||
#ifdef INET | |||||
case AF_INET: | |||||
return GW_IPV4_SRC; | |||||
#endif | |||||
#ifdef INET6 | |||||
case AF_INET6: | |||||
return GW_IPV6_SRC; | |||||
#endif | |||||
default: | |||||
return GW_NONE; | |||||
} | |||||
} | |||||
/* | /* | ||||
* Routing statistics. | * Routing statistics. | ||||
*/ | */ | ||||
struct rtstat { | struct rtstat { | ||||
uint64_t rts_badredirect; /* bogus redirect calls */ | uint64_t rts_badredirect; /* bogus redirect calls */ | ||||
uint64_t rts_dynamic; /* routes created by redirects */ | uint64_t rts_dynamic; /* routes created by redirects */ | ||||
uint64_t rts_newgateway; /* routes modified by redirects */ | uint64_t rts_newgateway; /* routes modified by redirects */ | ||||
uint64_t rts_unreach; /* lookups which failed */ | uint64_t rts_unreach; /* lookups which failed */ | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | if ((ro)->ro_lle != NULL) { \ | ||||
LLE_FREE((ro)->ro_lle); \ | LLE_FREE((ro)->ro_lle); \ | ||||
(ro)->ro_lle = NULL; \ | (ro)->ro_lle = NULL; \ | ||||
} \ | } \ | ||||
if ((ro)->ro_nh != NULL) { \ | if ((ro)->ro_nh != NULL) { \ | ||||
NH_FREE((ro)->ro_nh); \ | NH_FREE((ro)->ro_nh); \ | ||||
(ro)->ro_nh = NULL; \ | (ro)->ro_nh = NULL; \ | ||||
} \ | } \ | ||||
} while (0) | } while (0) | ||||
#define RO_GET_FAMILY(ro, dst) ((ro) != NULL && \ | |||||
(ro)->ro_flags & RT_HAS_GW \ | |||||
? (ro)->ro_dst.sa_family : (dst)->sa_family) | |||||
/* | /* | ||||
* Validate a cached route based on a supplied cookie. If there is an | * Validate a cached route based on a supplied cookie. If there is an | ||||
* out-of-date cache, simply free it. Update the generation number | * out-of-date cache, simply free it. Update the generation number | ||||
* for the new allocation | * for the new allocation | ||||
*/ | */ | ||||
#define NH_VALIDATE(ro, cookiep, fibnum) do { \ | #define NH_VALIDATE(ro, cookiep, fibnum) do { \ | ||||
rt_gen_t cookie = RT_GEN(fibnum, (ro)->ro_dst.sa_family); \ | rt_gen_t cookie = RT_GEN(fibnum, (ro)->ro_dst.sa_family); \ | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |