Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137020519
D25546.id74012.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D25546.id74012.diff
View Options
Index: sys/net/if.c
===================================================================
--- sys/net/if.c
+++ sys/net/if.c
@@ -80,6 +80,7 @@
#include <net/if_vlan_var.h>
#include <net/radix.h>
#include <net/route.h>
+#include <net/route/route_ctl.h>
#include <net/vnet.h>
#if defined(INET) || defined(INET6)
@@ -1845,6 +1846,7 @@
ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa,
struct sockaddr *ia)
{
+ struct rib_cmd_info rc;
struct epoch_tracker et;
int error;
struct rt_addrinfo info;
@@ -1872,7 +1874,7 @@
info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl;
link_init_sdl(ifp, (struct sockaddr *)&null_sdl, ifp->if_type);
- error = rtrequest1_fib(cmd, &info, NULL, ifp->if_fib);
+ error = rib_action(ifp->if_fib, cmd, &info, &rc);
NET_EPOCH_EXIT(et);
if (rti_ifa != NULL)
Index: sys/net/route.h
===================================================================
--- sys/net/route.h
+++ sys/net/route.h
@@ -413,7 +413,6 @@
int rtioctl_fib(u_long, caddr_t, u_int);
int rtrequest_fib(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
-int rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int);
int rib_lookup_info(uint32_t, const struct sockaddr *, uint32_t, uint32_t,
struct rt_addrinfo *);
void rib_free_info(struct rt_addrinfo *info);
Index: sys/net/route.c
===================================================================
--- sys/net/route.c
+++ sys/net/route.c
@@ -468,7 +468,7 @@
rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway,
struct sockaddr *author, struct ifnet *ifp, int flags, int lifetime_sec)
{
- struct rtentry *rt;
+ struct rib_cmd_info rc;
int error;
struct rt_addrinfo info;
struct rt_metrics rti_rmx;
@@ -502,7 +502,7 @@
info.rti_mflags |= RTV_EXPIRE;
info.rti_rmx = &rti_rmx;
- error = rtrequest1_fib(RTM_ADD, &info, &rt, fibnum);
+ error = rib_action(fibnum, RTM_ADD, &info, &rc);
ifa_free(ifa);
if (error != 0) {
@@ -510,9 +510,9 @@
return (error);
}
- RT_LOCK(rt);
- flags = rt->rt_flags;
- RT_UNLOCK(rt);
+ RT_LOCK(rc.rc_rt);
+ flags = rc.rc_rt->rt_flags;
+ RT_UNLOCK(rc.rc_rt);
RTSTAT_INC(rts_dynamic);
@@ -614,6 +614,8 @@
u_int fibnum)
{
struct rt_addrinfo info;
+ struct rib_cmd_info rc;
+ int ret;
if (dst->sa_len == 0)
return(EINVAL);
@@ -623,12 +625,15 @@
info.rti_info[RTAX_DST] = dst;
info.rti_info[RTAX_GATEWAY] = gateway;
info.rti_info[RTAX_NETMASK] = netmask;
- return rtrequest1_fib(req, &info, ret_nrt, fibnum);
+ NET_EPOCH_ASSERT();
+ ret = rib_action(fibnum, req, &info, &rc);
+ *ret_nrt = rc.rc_rt;
+ return ret;
}
/*
- * Copy most of @rt data into @info.
+ * - * Copy most of @rt data into @info.
*
* If @flags contains NHR_COPY, copies dst,netmask and gw to the
* pointers specified by @info structure. Assume such pointers
@@ -1146,73 +1151,6 @@
}
#endif
-int
-rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
- u_int fibnum)
-{
- const struct sockaddr *dst;
- struct rib_head *rnh;
- struct rib_cmd_info rc;
- int error;
-
- KASSERT((fibnum < rt_numfibs), ("rtrequest1_fib: bad fibnum"));
- KASSERT((info->rti_flags & RTF_RNH_LOCKED) == 0, ("rtrequest1_fib: locked"));
- NET_EPOCH_ASSERT();
-
- dst = info->rti_info[RTAX_DST];
-
- switch (dst->sa_family) {
- case AF_INET6:
- case AF_INET:
- /* We support multiple FIBs. */
- break;
- default:
- fibnum = RT_DEFAULT_FIB;
- break;
- }
-
- /*
- * Find the correct routing tree to use for this Address Family
- */
- rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
- if (rnh == NULL)
- return (EAFNOSUPPORT);
-
- /*
- * If we are adding a host route then we don't want to put
- * a netmask in the tree, nor do we want to clone it.
- */
- if (info->rti_flags & RTF_HOST)
- info->rti_info[RTAX_NETMASK] = NULL;
-
- bzero(&rc, sizeof(struct rib_cmd_info));
- error = 0;
- switch (req) {
- case RTM_DELETE:
- error = del_route(rnh, info, &rc);
- break;
- case RTM_RESOLVE:
- /*
- * resolve was only used for route cloning
- * here for compat
- */
- break;
- case RTM_ADD:
- error = add_route(rnh, info, &rc);
- break;
- case RTM_CHANGE:
- error = change_route(rnh, info, &rc);
- break;
- default:
- error = EOPNOTSUPP;
- }
-
- if (ret_nrt != NULL)
- *ret_nrt = rc.rc_rt;
-
- return (error);
-}
-
void
rt_setmetrics(const struct rt_addrinfo *info, struct rtentry *rt)
{
@@ -1256,7 +1194,7 @@
struct epoch_tracker et;
struct sockaddr *dst;
struct sockaddr *netmask;
- struct rtentry *rt = NULL;
+ struct rib_cmd_info rc;
struct rt_addrinfo info;
int error = 0;
int startfib, endfib;
@@ -1387,14 +1325,14 @@
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_info[RTAX_NETMASK] = netmask;
NET_EPOCH_ENTER(et);
- error = rtrequest1_fib(cmd, &info, &rt, fibnum);
- if (error == 0 && rt != NULL) {
+ error = rib_action(fibnum, cmd, &info, &rc);
+ if (error == 0 && rc.rc_rt != NULL) {
/*
* notify any listening routing agents of the change
*/
/* TODO: interface routes/aliases */
- rt_newaddrmsg_fib(cmd, ifa, rt, fibnum);
+ rt_newaddrmsg_fib(cmd, ifa, rc.rc_rt, fibnum);
didwork = 1;
}
NET_EPOCH_EXIT(et);
Index: sys/netinet6/nd6.c
===================================================================
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -62,6 +62,7 @@
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/route.h>
+#include <net/route/route_ctl.h>
#include <net/route/route_var.h>
#include <net/route/nhop.h>
#include <net/vnet.h>
@@ -1566,6 +1567,7 @@
int fibnum;
struct sockaddr_in6 sin6;
struct rt_addrinfo info;
+ struct rib_cmd_info rc;
struct epoch_tracker et;
lltable_fill_sa_entry(ln, (struct sockaddr *)&sin6);
@@ -1575,7 +1577,7 @@
NET_EPOCH_ENTER(et);
for (fibnum = 0; fibnum < rt_numfibs; fibnum++)
- rtrequest1_fib(RTM_DELETE, &info, NULL, fibnum);
+ rib_action(fibnum, RTM_DELETE, &info, &rc);
NET_EPOCH_EXIT(et);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 22, 12:11 AM (20 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25788561
Default Alt Text
D25546.id74012.diff (5 KB)
Attached To
Mode
D25546: Transition from rtrequest1_fib() to rib_action()
Attached
Detach File
Event Timeline
Log In to Comment