diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-08-28 22:50:20 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2020-08-28 22:50:20 +0000 |
commit | a624ca3dff0c2fa00728d5f50205f341554a0a10 (patch) | |
tree | 423a2fb4d787975b34ee874fea42f241a11515ee /sys/net | |
parent | b122304f6affd2c79426b079258979ec190321fc (diff) | |
download | src-a624ca3dff0c2fa00728d5f50205f341554a0a10.tar.gz src-a624ca3dff0c2fa00728d5f50205f341554a0a10.zip |
Move net/route/shared.h definitions to net/route/route_var.h.
No functional changes.
net/route/shared.h was created in the inital phases of nexthop conversion.
It was intended to serve the same purpose as route_var.h - share definitions
of functions and structures between the routing subsystem components. At
that time route_var.h was included by many files external to the routing
subsystem, which largerly defeats its purpose.
As currently this is not the case anymore and amount of route_var.h includes
is roughly the same as shared.h, retire the latter in favour of the former.
Notes
Notes:
svn path=/head/; revision=364941
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/radix_mpath.c | 1 | ||||
-rw-r--r-- | sys/net/route.c | 1 | ||||
-rw-r--r-- | sys/net/route/nhop.c | 1 | ||||
-rw-r--r-- | sys/net/route/nhop_ctl.c | 1 | ||||
-rw-r--r-- | sys/net/route/route_ctl.c | 1 | ||||
-rw-r--r-- | sys/net/route/route_helpers.c | 1 | ||||
-rw-r--r-- | sys/net/route/route_var.h | 36 | ||||
-rw-r--r-- | sys/net/route/shared.h | 79 | ||||
-rw-r--r-- | sys/net/rtsock.c | 1 |
9 files changed, 36 insertions, 86 deletions
diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index d17f38f425e4..32c2541956d5 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include <sys/rmlock.h> #include <net/route.h> #include <net/route/nhop.h> -#include <net/route/shared.h> #include <net/route/route_var.h> #include <net/route/nhop.h> #include <net/if.h> diff --git a/sys/net/route.c b/sys/net/route.c index d59b1a0e116b..f34814ffc493 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -64,7 +64,6 @@ #include <net/route/route_ctl.h> #include <net/route/route_var.h> #include <net/route/nhop.h> -#include <net/route/shared.h> #include <net/vnet.h> #ifdef RADIX_MPATH diff --git a/sys/net/route/nhop.c b/sys/net/route/nhop.c index 97710123f891..f39b4fabdc93 100644 --- a/sys/net/route/nhop.c +++ b/sys/net/route/nhop.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include <net/route/nhop_utils.h> #include <net/route/nhop.h> #include <net/route/nhop_var.h> -#include <net/route/shared.h> #include <net/vnet.h> /* diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c index 7787d403eb84..5d5f2f476e4b 100644 --- a/sys/net/route/nhop_ctl.c +++ b/sys/net/route/nhop_ctl.c @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include <net/route/nhop_utils.h> #include <net/route/nhop.h> #include <net/route/nhop_var.h> -#include <net/route/shared.h> #include <net/vnet.h> /* diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 573c8a43b3ce..79749077b924 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include <net/route/nhop_utils.h> #include <net/route/nhop.h> #include <net/route/nhop_var.h> -#include <net/route/shared.h> #include <netinet/in.h> #ifdef RADIX_MPATH diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index eadb62b804f3..c2b7780976fd 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include <net/route/nhop_utils.h> #include <net/route/nhop.h> #include <net/route/nhop_var.h> -#include <net/route/shared.h> #ifdef INET #include <netinet/in_fib.h> #endif diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index 8b44f8705d7d..e926175a3fad 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -39,6 +39,13 @@ #include <sys/epoch.h> #include <netinet/in.h> /* struct sockaddr_in */ #include <sys/counter.h> +#include <net/route/nhop.h> + +#ifdef RTDEBUG +#define DPRINTF(_fmt, ...) printf("%s: " _fmt "\n", __func__ , ## __VA_ARGS__) +#else +#define DPRINTF(_fmt, ...) +#endif struct nh_control; typedef int rnh_preadd_entry_f_t(u_int fibnum, const struct sockaddr *addr, @@ -221,6 +228,7 @@ fib_rte_to_nh_flags(int rt_flags) return (res); } +/* route_temporal.c */ void tmproutes_update(struct rib_head *rnh, struct rtentry *rt); void tmproutes_init(struct rib_head *rh); void tmproutes_destroy(struct rib_head *rh); @@ -237,4 +245,32 @@ int change_route_conditional(struct rib_head *rnh, struct rtentry *rt, void vnet_rtzone_init(void); void vnet_rtzone_destroy(void); +/* subscriptions */ +void rib_init_subscriptions(struct rib_head *rnh); +void rib_destroy_subscriptions(struct rib_head *rnh); + +/* Nexhops */ +void nhops_init(void); +int nhops_init_rib(struct rib_head *rh); +void nhops_destroy_rib(struct rib_head *rh); +void nhop_ref_object(struct nhop_object *nh); +int nhop_try_ref_object(struct nhop_object *nh); +int nhop_ref_any(struct nhop_object *nh); +void nhop_free_any(struct nhop_object *nh); + +void nhop_set_type(struct nhop_object *nh, enum nhop_type nh_type); +void nhop_set_rtflags(struct nhop_object *nh, int rt_flags); + +int nhop_create_from_info(struct rib_head *rnh, struct rt_addrinfo *info, + struct nhop_object **nh_ret); +int nhop_create_from_nhop(struct rib_head *rnh, const struct nhop_object *nh_orig, + struct rt_addrinfo *info, struct nhop_object **pnh_priv); + +void nhops_update_ifmtu(struct rib_head *rh, struct ifnet *ifp, uint32_t mtu); +int nhops_dump_sysctl(struct rib_head *rh, struct sysctl_req *w); + +/* route */ +struct rtentry *rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo *info, + int *perror); + #endif diff --git a/sys/net/route/shared.h b/sys/net/route/shared.h deleted file mode 100644 index 3d68f5db0c8e..000000000000 --- a/sys/net/route/shared.h +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2020 Alexander V. Chernikov - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Contains various definitions shared between the parts of a routing subsystem. - * - * Header is not intended to be included by the code external to the - * routing subsystem. - */ - -#ifndef _NET_ROUTE_SHARED_H_ -#define _NET_ROUTE_SHARED_H_ - -#include <vm/uma.h> - -#ifdef RTDEBUG -#define DPRINTF(_fmt, ...) printf("%s: " _fmt "\n", __func__ , ## __VA_ARGS__) -#else -#define DPRINTF(_fmt, ...) -#endif - -struct rib_head; - -/* Nexhops */ -void nhops_init(void); -int nhops_init_rib(struct rib_head *rh); -void nhops_destroy_rib(struct rib_head *rh); -void nhop_ref_object(struct nhop_object *nh); -int nhop_try_ref_object(struct nhop_object *nh); -int nhop_ref_any(struct nhop_object *nh); -void nhop_free_any(struct nhop_object *nh); - -void nhop_set_type(struct nhop_object *nh, enum nhop_type nh_type); -void nhop_set_rtflags(struct nhop_object *nh, int rt_flags); - -int nhop_create_from_info(struct rib_head *rnh, struct rt_addrinfo *info, - struct nhop_object **nh_ret); -int nhop_create_from_nhop(struct rib_head *rnh, const struct nhop_object *nh_orig, - struct rt_addrinfo *info, struct nhop_object **pnh_priv); - -void nhops_update_ifmtu(struct rib_head *rh, struct ifnet *ifp, uint32_t mtu); -int nhops_dump_sysctl(struct rib_head *rh, struct sysctl_req *w); - -/* subscriptions */ -void rib_init_subscriptions(struct rib_head *rnh); -void rib_destroy_subscriptions(struct rib_head *rnh); - -/* route */ -struct rtentry *rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo *info, - int *perror); - -#endif - diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index b227a123210f..e22ef51b1d93 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -77,7 +77,6 @@ #include <netinet6/scope6_var.h> #endif #include <net/route/nhop.h> -#include <net/route/shared.h> #ifdef COMPAT_FREEBSD32 #include <sys/mount.h> |