svn commit: r364942 - head/sys/net/route
Alexander V. Chernikov
melifaro at FreeBSD.org
Fri Aug 28 23:01:57 UTC 2020
Author: melifaro
Date: Fri Aug 28 23:01:56 2020
New Revision: 364942
URL: https://svnweb.freebsd.org/changeset/base/364942
Log:
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.
Modified:
head/sys/net/route/nhop_ctl.c
head/sys/net/route/route_var.h
Modified: head/sys/net/route/nhop_ctl.c
==============================================================================
--- head/sys/net/route/nhop_ctl.c Fri Aug 28 22:50:20 2020 (r364941)
+++ head/sys/net/route/nhop_ctl.c Fri Aug 28 23:01:56 2020 (r364942)
@@ -244,6 +244,21 @@ set_nhop_gw_from_info(struct nhop_object *nh, struct r
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
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
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;
Modified: head/sys/net/route/route_var.h
==============================================================================
--- head/sys/net/route/route_var.h Fri Aug 28 22:50:20 2020 (r364941)
+++ head/sys/net/route/route_var.h Fri Aug 28 23:01:56 2020 (r364942)
@@ -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);
More information about the svn-src-head
mailing list