Move fib_rte_to_nh_flags() from net/route_var.h to net/route/nhop_ctl.c.
No functional changes. Initially this function was created to perform runtime flag conversions for the previous incarnation of fib lookup functions. As these functions got deprecated, move the function to the file with the only remaining caller. Lastly, rename it to convert_rt_to_nh_flags() to follow the naming notation.
This commit is contained in:
parent
a624ca3dff
commit
7c89a3b63f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364942
@ -244,6 +244,21 @@ set_nhop_gw_from_info(struct nhop_object *nh, struct rt_addrinfo *info)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
convert_rt_to_nh_flags(int rt_flags)
|
||||
{
|
||||
uint16_t res;
|
||||
|
||||
res = (rt_flags & RTF_REJECT) ? NHF_REJECT : 0;
|
||||
res |= (rt_flags & RTF_HOST) ? NHF_HOST : 0;
|
||||
res |= (rt_flags & RTF_BLACKHOLE) ? NHF_BLACKHOLE : 0;
|
||||
res |= (rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) ? NHF_REDIRECT : 0;
|
||||
res |= (rt_flags & RTF_BROADCAST) ? NHF_BROADCAST : 0;
|
||||
res |= (rt_flags & RTF_GATEWAY) ? NHF_GATEWAY : 0;
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
static int
|
||||
fill_nhop_from_info(struct nhop_priv *nh_priv, struct rt_addrinfo *info)
|
||||
{
|
||||
@ -258,7 +273,7 @@ fill_nhop_from_info(struct nhop_priv *nh_priv, struct rt_addrinfo *info)
|
||||
nh_priv->nh_family = info->rti_info[RTAX_DST]->sa_family;
|
||||
nh_priv->nh_type = 0; // hook responsibility to set nhop type
|
||||
|
||||
nh->nh_flags = fib_rte_to_nh_flags(rt_flags);
|
||||
nh->nh_flags = convert_rt_to_nh_flags(rt_flags);
|
||||
set_nhop_mtu_from_info(nh, info);
|
||||
nh->nh_ifp = info->rti_ifa->ifa_ifp;
|
||||
nh->nh_ifa = info->rti_ifa;
|
||||
@ -397,7 +412,7 @@ alter_nhop_from_info(struct nhop_object *nh, struct rt_addrinfo *info)
|
||||
nh->nh_priv->rt_flags |= (RTF_GATEWAY & info->rti_flags);
|
||||
}
|
||||
/* Update datapath flags */
|
||||
nh->nh_flags = fib_rte_to_nh_flags(nh->nh_priv->rt_flags);
|
||||
nh->nh_flags = convert_rt_to_nh_flags(nh->nh_priv->rt_flags);
|
||||
|
||||
if (info->rti_ifa != NULL)
|
||||
nh->nh_ifa = info->rti_ifa;
|
||||
|
@ -212,22 +212,6 @@ struct rtentry {
|
||||
((!NH_IS_MULTIPATH(_nh)) ? (_nh) : _SELECT_NHOP(_nh, _flowid))
|
||||
#define RT_SELECT_NHOP(_rt, _flowid) _RT_SELECT_NHOP((_rt)->rt_nhop, _flowid)
|
||||
|
||||
/* rte<>nhop translation */
|
||||
static inline uint16_t
|
||||
fib_rte_to_nh_flags(int rt_flags)
|
||||
{
|
||||
uint16_t res;
|
||||
|
||||
res = (rt_flags & RTF_REJECT) ? NHF_REJECT : 0;
|
||||
res |= (rt_flags & RTF_HOST) ? NHF_HOST : 0;
|
||||
res |= (rt_flags & RTF_BLACKHOLE) ? NHF_BLACKHOLE : 0;
|
||||
res |= (rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) ? NHF_REDIRECT : 0;
|
||||
res |= (rt_flags & RTF_BROADCAST) ? NHF_BROADCAST : 0;
|
||||
res |= (rt_flags & RTF_GATEWAY) ? NHF_GATEWAY : 0;
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/* route_temporal.c */
|
||||
void tmproutes_update(struct rib_head *rnh, struct rtentry *rt);
|
||||
void tmproutes_init(struct rib_head *rh);
|
||||
|
Loading…
Reference in New Issue
Block a user