diff options
| author | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-03-27 11:20:05 +0000 |
|---|---|---|
| committer | Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> | 2026-03-27 20:25:33 +0000 |
| commit | 254b23eb1f540844cf2a90f2781ae4231c5701ce (patch) | |
| tree | c1c77bdd9b1dd12281a55be51de2a5c373dc9df8 | |
| parent | 2371b24c22f063ef79dc1935419c9854656e265e (diff) | |
routing: Retire ROUTE_MPATH compile option
The ROUTE_MPATH compile option was introduced to
test the new multipath implementation.
Since compiling it has no overhead and it's enabled
by default, remove it.
Reviewed by: melifaro, markj
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D55884
47 files changed, 67 insertions, 223 deletions
diff --git a/sys/amd64/conf/FIRECRACKER b/sys/amd64/conf/FIRECRACKER index 07c02d51ed4c..676199602ede 100644 --- a/sys/amd64/conf/FIRECRACKER +++ b/sys/amd64/conf/FIRECRACKER @@ -29,7 +29,6 @@ options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options ROUTE_MPATH # Multipath routing support options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload options TCP_BLACKBOX # Enhanced TCP event logging diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 07e31e354d45..7de19f86afbf 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -33,7 +33,6 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 options IPSEC_OFFLOAD # Inline ipsec offload infra -options ROUTE_MPATH # Multipath routing support options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload options TCP_BLACKBOX # Enhanced TCP event logging diff --git a/sys/arm64/conf/std.arm64 b/sys/arm64/conf/std.arm64 index 68ad7ebc856e..8069703626c9 100644 --- a/sys/arm64/conf/std.arm64 +++ b/sys/arm64/conf/std.arm64 @@ -14,7 +14,6 @@ options INET6 # IPv6 communications protocols options CC_CUBIC # include CUBIC congestion control options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 options IPSEC_OFFLOAD # Inline ipsec offload infra -options ROUTE_MPATH # Multipath routing support options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload options TCP_BLACKBOX # Enhanced TCP event logging diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 136a795cc83c..4dda93e2ee70 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1031,8 +1031,6 @@ device dummymbuf # TCP_HHOOK enables the hhook(9) framework hooks for the TCP stack. # SOCKET_HHOOK enables the hhook(9) framework hooks for socket operations. # -# ROUTE_MPATH provides support for multipath routing. -# options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #enable logging to syslogd(8) @@ -1052,7 +1050,6 @@ options PF_DEFAULT_TO_DROP #drop everything by default options TCP_BLACKBOX options TCP_HHOOK options SOCKET_HHOOK -options ROUTE_MPATH # The MBUF_STRESS_TEST option enables options which create # various random failures / extreme cases related to mbuf diff --git a/sys/conf/files b/sys/conf/files index 269f9387ec08..de13b76e71a4 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4246,8 +4246,8 @@ net/debugnet_inet.c optional inet debugnet net/pfil.c optional ether | inet net/radix.c standard net/route.c standard -net/route/nhgrp.c optional route_mpath -net/route/nhgrp_ctl.c optional route_mpath +net/route/nhgrp.c standard +net/route/nhgrp_ctl.c standard net/route/nhop.c standard net/route/nhop_ctl.c standard net/route/nhop_utils.c standard @@ -4263,7 +4263,7 @@ net/route/route_temporal.c standard net/rss_config.c standard net/rtsock.c standard net/slcompress.c optional netgraph_vjc -net/toeplitz.c optional inet | inet6 | route_mpath +net/toeplitz.c optional inet | inet6 net/vnet.c optional vimage net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl diff --git a/sys/conf/options b/sys/conf/options index 53b1f61a6e0b..155fbf8e6c8a 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -473,7 +473,6 @@ MROUTING opt_mrouting.h NFSLOCKD NETLINK opt_global.h PF_DEFAULT_TO_DROP opt_pf.h -ROUTE_MPATH opt_route.h ROUTETABLES opt_route.h FIB_ALGO opt_route.h RSS opt_rss.h diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 3de346013111..595683883686 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -33,7 +33,6 @@ options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options ROUTE_MPATH # Multipath routing support options TCP_HHOOK # hhook(9) framework for TCP options TCP_OFFLOAD # TCP offload options SCTP_SUPPORT # Allow kldload of SCTP diff --git a/sys/modules/netgraph/netflow/Makefile b/sys/modules/netgraph/netflow/Makefile index c73e9ac41680..c743db9d7eca 100644 --- a/sys/modules/netgraph/netflow/Makefile +++ b/sys/modules/netgraph/netflow/Makefile @@ -5,6 +5,6 @@ .PATH: ${SRCTOP}/sys/netgraph/netflow KMOD= ng_netflow -SRCS= ng_netflow.c netflow.c netflow_v9.c opt_inet.h opt_inet6.h opt_route.h +SRCS= ng_netflow.c netflow.c netflow_v9.c opt_inet.h opt_inet6.h .include <bsd.kmod.mk> diff --git a/sys/modules/netlink/Makefile b/sys/modules/netlink/Makefile index 4abef5106899..6f8205289dd4 100644 --- a/sys/modules/netlink/Makefile +++ b/sys/modules/netlink/Makefile @@ -5,7 +5,7 @@ SRCS = netlink_module.c netlink_domain.c netlink_io.c \ netlink_message_writer.c netlink_generic.c \ netlink_route.c route/iface.c route/iface_drivers.c route/neigh.c \ route/nexthop.c route/rt.c -SRCS+= opt_inet.h opt_inet6.h opt_route.h +SRCS+= opt_inet.h opt_inet6.h CFLAGS+= -DNETLINK_MODULE diff --git a/sys/net/route.c b/sys/net/route.c index 1a1de22804f0..9ed3a53cbfcb 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -36,7 +36,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_mrouting.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/net/route.h b/sys/net/route.h index 8c713d65ec95..49bb7abd9726 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -126,30 +126,13 @@ VNET_DECLARE(u_int, fib_hash_outbound); /* Outbound flowid generation rules */ #ifdef RSS - #define fib4_calc_packet_hash xps_proto_software_hash_v4 #define fib6_calc_packet_hash xps_proto_software_hash_v6 #define CALC_FLOWID_OUTBOUND_SENDTO true - -#ifdef ROUTE_MPATH -#define CALC_FLOWID_OUTBOUND V_fib_hash_outbound -#else -#define CALC_FLOWID_OUTBOUND false -#endif - #else /* !RSS */ - #define fib4_calc_packet_hash fib4_calc_software_hash #define fib6_calc_packet_hash fib6_calc_software_hash - -#ifdef ROUTE_MPATH #define CALC_FLOWID_OUTBOUND_SENDTO V_fib_hash_outbound -#define CALC_FLOWID_OUTBOUND V_fib_hash_outbound -#else -#define CALC_FLOWID_OUTBOUND_SENDTO false -#define CALC_FLOWID_OUTBOUND false -#endif - #endif /* RSS */ diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index ca635ad8a7b0..2ba044a31020 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -1714,9 +1714,7 @@ fib_get_rtable_info(struct rib_head *rh, struct rib_rtable_info *rinfo) bzero(rinfo, sizeof(struct rib_rtable_info)); rinfo->num_prefixes = rh->rnh_prefixes; rinfo->num_nhops = nhops_get_count(rh); -#ifdef ROUTE_MPATH rinfo->num_nhgrp = nhgrp_get_count(rh); -#endif } /* @@ -1762,12 +1760,10 @@ fib_get_nhop_array(struct fib_data *fd) static uint32_t get_nhop_idx(struct nhop_object *nh) { -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) return (nhgrp_get_idx((struct nhgrp_object *)nh)); - else -#endif - return (nhop_get_idx(nh)); + + return (nhop_get_idx(nh)); } uint32_t diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index d048e09b045a..37f36b86c975 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -26,7 +26,6 @@ */ #include "opt_inet.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index e26c1fcff33a..8a1fa2113a6c 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -25,7 +25,6 @@ * SUCH DAMAGE. */ #include "opt_inet.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/net/route/nhop.c b/sys/net/route/nhop.c index e372c4f7fcd3..dfe9df256f2e 100644 --- a/sys/net/route/nhop.c +++ b/sys/net/route/nhop.c @@ -27,7 +27,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> @@ -115,9 +114,7 @@ destroy_ctl(struct nh_control *ctl) NHOPS_LOCK_DESTROY(ctl); free(ctl->nh_head.ptr, M_NHOP); free(ctl->nh_idx_head.idx, M_NHOP); -#ifdef ROUTE_MPATH nhgrp_ctl_free(ctl); -#endif free(ctl, M_NHOP); } @@ -160,9 +157,7 @@ nhops_destroy_rib(struct rib_head *rh) FIB_RH_LOG(LOG_DEBUG3, rh, "marking nhop %u unlinked", nh_priv->nh_idx); refcount_release(&nh_priv->nh_linked); } CHT_SLIST_FOREACH_END; -#ifdef ROUTE_MPATH nhgrp_ctl_unlink_all(ctl); -#endif NHOPS_WUNLOCK(ctl); /* diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c index 0c028c7ae877..6c03e621ed82 100644 --- a/sys/net/route/nhop_ctl.c +++ b/sys/net/route/nhop_ctl.c @@ -28,7 +28,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> @@ -644,28 +643,21 @@ nhop_free(struct nhop_object *nh) void nhop_ref_any(struct nhop_object *nh) { -#ifdef ROUTE_MPATH + if (!NH_IS_NHGRP(nh)) nhop_ref_object(nh); else nhgrp_ref_object((struct nhgrp_object *)nh); -#else - nhop_ref_object(nh); -#endif } void nhop_free_any(struct nhop_object *nh) { -#ifdef ROUTE_MPATH if (!NH_IS_NHGRP(nh)) nhop_free(nh); else nhgrp_free((struct nhgrp_object *)nh); -#else - nhop_free(nh); -#endif } /* Nhop-related methods */ @@ -1169,12 +1161,11 @@ nhop_print_buf(const struct nhop_object *nh, char *buf, size_t bufsize) char * nhop_print_buf_any(const struct nhop_object *nh, char *buf, size_t bufsize) { -#ifdef ROUTE_MPATH + if (NH_IS_NHGRP(nh)) return (nhgrp_print_buf((const struct nhgrp_object *)nh, buf, bufsize)); - else -#endif - return (nhop_print_buf(nh, buf, bufsize)); + + return (nhop_print_buf(nh, buf, bufsize)); } /* diff --git a/sys/net/route/nhop_utils.c b/sys/net/route/nhop_utils.c index 0308eb331947..ee4ea969d2ac 100644 --- a/sys/net/route/nhop_utils.c +++ b/sys/net/route/nhop_utils.c @@ -27,7 +27,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index d629fd1625c3..f99b8eacf0a7 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -28,7 +28,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> @@ -82,11 +81,9 @@ static int change_route_byinfo(struct rib_head *rnh, struct rtentry *rt, static int add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data *rnd_add, int op_flags, struct rib_cmd_info *rc); -#ifdef ROUTE_MPATH static int add_route_flags_mpath(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data *rnd_add, struct route_nhop_data *rnd_orig, int op_flags, struct rib_cmd_info *rc); -#endif static int add_route(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data *rnd, struct rib_cmd_info *rc); @@ -100,25 +97,15 @@ static bool fill_pxmask_family(int family, int plen, struct sockaddr *_dst, static int get_prio_from_info(const struct rt_addrinfo *info); static int nhop_get_prio(const struct nhop_object *nh); -#ifdef ROUTE_MPATH static bool rib_can_multipath(struct rib_head *rh); -#endif /* Per-vnet multipath routing configuration */ SYSCTL_DECL(_net_route); #define V_rib_route_multipath VNET(rib_route_multipath) -#ifdef ROUTE_MPATH -#define _MP_FLAGS CTLFLAG_RW VNET_DEFINE(u_int, rib_route_multipath) = 1; -#else -#define _MP_FLAGS CTLFLAG_RD -VNET_DEFINE(u_int, rib_route_multipath) = 0; -#endif -SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, +SYSCTL_UINT(_net_route, OID_AUTO, multipath, CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); -#undef _MP_FLAGS -#ifdef ROUTE_MPATH VNET_DEFINE(u_int, fib_hash_outbound) = 0; SYSCTL_UINT(_net_route, OID_AUTO, hash_outbound, CTLFLAG_RD | CTLFLAG_VNET, &VNET_NAME(fib_hash_outbound), 0, @@ -132,7 +119,6 @@ uint8_t mpath_entropy_key[MPATH_ENTROPY_KEY_LEN] = { 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa, }; -#endif #if defined(INET) && defined(INET6) FEATURE(ipv4_rfc5549_support, "Route IPv4 packets via IPv6 nexthops"); @@ -167,7 +153,6 @@ rib_can_4o6_nhop(void) } #endif -#ifdef ROUTE_MPATH static bool rib_can_multipath(struct rib_head *rh) { @@ -200,7 +185,6 @@ nhop_can_multipath(const struct nhop_object *nh) return (1); } -#endif static int get_info_weight(const struct rt_addrinfo *info, uint32_t default_weight) @@ -602,7 +586,6 @@ rib_del_route_px(uint32_t fibnum, struct sockaddr *dst, int plen, if (rc->rc_cmd == RTM_DELETE) rt_free(rc->rc_rt); -#ifdef ROUTE_MPATH else { /* * Deleting 1 path may result in RTM_CHANGE to @@ -611,7 +594,6 @@ rib_del_route_px(uint32_t fibnum, struct sockaddr *dst, int plen, */ nhop_free_any(rc->rc_nh_old); } -#endif return (0); } @@ -834,7 +816,6 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data RIB_WUNLOCK(rnh); -#ifdef ROUTE_MPATH if ((op_flags & RTM_F_APPEND) && rib_can_multipath(rnh) && nhop_can_multipath(rnd_add->rnd_nhop) && nhop_can_multipath(rnd_orig.rnd_nhop)) { @@ -857,7 +838,6 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data } return (error); } -#endif /* Out of options - free state and return error */ error = EEXIST; out: @@ -868,7 +848,6 @@ out: return (error); } -#ifdef ROUTE_MPATH static int add_route_flags_mpath(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data *rnd_add, struct route_nhop_data *rnd_orig, @@ -912,7 +891,6 @@ add_route_flags_mpath(struct rib_head *rnh, struct rtentry *rt, return (0); } -#endif /* * Removes route defined by @info from the kernel table specified by @fibnum and @@ -981,7 +959,6 @@ rib_del_route(uint32_t fibnum, struct rt_addrinfo *info, struct rib_cmd_info *rc if (rc->rc_cmd == RTM_DELETE) rt_free(rc->rc_rt); -#ifdef ROUTE_MPATH else { /* * Deleting 1 path may result in RTM_CHANGE to @@ -990,7 +967,6 @@ rib_del_route(uint32_t fibnum, struct rt_addrinfo *info, struct rib_cmd_info *rc */ nhop_free_any(rc->rc_nh_old); } -#endif return (0); } @@ -1008,7 +984,6 @@ rt_delete_conditional(struct rib_head *rnh, struct rtentry *rt, { struct nhop_object *nh = rt->rt_nhop; -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) { struct nhgrp_object *nhg = (struct nhgrp_object *)nh; struct route_nhop_data rnd; @@ -1027,7 +1002,6 @@ rt_delete_conditional(struct rib_head *rnh, struct rtentry *rt, } return (error); } -#endif if (cb != NULL && !cb(rt, nh, cbdata)) return (ESRCH); @@ -1129,7 +1103,6 @@ change_nhop(struct rib_head *rnh, struct rt_addrinfo *info, return (error); } -#ifdef ROUTE_MPATH static int change_mpath_route(struct rib_head *rnh, struct rtentry *rt, struct rt_addrinfo *info, struct route_nhop_data *rnd_orig, @@ -1180,7 +1153,6 @@ change_mpath_route(struct rib_head *rnh, struct rtentry *rt, return (error); } -#endif static int change_route_byinfo(struct rib_head *rnh, struct rtentry *rt, @@ -1195,10 +1167,8 @@ change_route_byinfo(struct rib_head *rnh, struct rtentry *rt, if (nh_orig == NULL) return (ESRCH); -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh_orig)) return (change_mpath_route(rnh, rt, info, rnd_orig, rc)); -#endif rnd_new.rnd_weight = get_info_weight(info, rnd_orig->rnd_weight); error = change_nhop(rnh, info, nh_orig, &rnd_new.rnd_nhop); @@ -1448,14 +1418,12 @@ rt_checkdelroute(struct radix_node *rn, void *arg) /* Add to the list and return */ rt->rt_chain = di->head; di->head = rt; -#ifdef ROUTE_MPATH } else { /* * RTM_CHANGE to a different nexthop or nexthop group. * Free old multipath group. */ nhop_free_any(di->rc.rc_nh_old); -#endif } return (0); @@ -1510,7 +1478,6 @@ rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *filter_ar rib_notify(rnh, RIB_NOTIFY_DELAYED, &di.rc); if (report) { -#ifdef ROUTE_MPATH struct nhgrp_object *nhg; const struct weightened_nhop *wn; uint32_t num_nhops; @@ -1520,8 +1487,7 @@ rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *filter_ar for (int i = 0; i < num_nhops; i++) rt_routemsg(RTM_DELETE, rt, wn[i].nh, fibnum); } else -#endif - rt_routemsg(RTM_DELETE, rt, nh, fibnum); + rt_routemsg(RTM_DELETE, rt, nh, fibnum); } rt_free(rt); } diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 2c0df15b04b7..303ff018e9e0 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -28,7 +28,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/jail.h> @@ -257,7 +256,6 @@ rib_lookup(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, return (nh); } -#ifdef ROUTE_MPATH static void notify_add(struct rib_cmd_info *rc, const struct weightened_nhop *wn_src, route_notification_t *cb, void *cbdata) @@ -410,7 +408,6 @@ rib_decompose_notification(const struct rib_cmd_info *rc, route_notification_t * break; } } -#endif union sockaddr_union { struct sockaddr sa; diff --git a/sys/net/route/route_ifaddrs.c b/sys/net/route/route_ifaddrs.c index cf369846fd59..8da023ff0e9a 100644 --- a/sys/net/route/route_ifaddrs.c +++ b/sys/net/route/route_ifaddrs.c @@ -29,8 +29,6 @@ * SUCH DAMAGE. */ -#include "opt_route.h" - #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> diff --git a/sys/net/route/route_rtentry.c b/sys/net/route/route_rtentry.c index 9440233f0906..b807f3a2d4f2 100644 --- a/sys/net/route/route_rtentry.c +++ b/sys/net/route/route_rtentry.c @@ -28,7 +28,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> @@ -105,21 +104,19 @@ static void destroy_rtentry(struct rtentry *rt) { #ifdef VIMAGE + const struct weightened_nhop *wn; struct nhop_object *nh = rt->rt_nhop; + uint32_t num_nhops; /* * At this moment rnh, nh_control may be already freed. * nhop interface may have been migrated to a different vnet. * Use vnet stored in the nexthop to delete the entry. */ -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) { - const struct weightened_nhop *wn; - uint32_t num_nhops; wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); nh = wn[0].nh; } -#endif CURVNET_SET(nhop_get_vnet(nh)); #endif diff --git a/sys/net/route/route_subscription.c b/sys/net/route/route_subscription.c index f3f0aac529c7..daf5f004f7f6 100644 --- a/sys/net/route/route_subscription.c +++ b/sys/net/route/route_subscription.c @@ -26,7 +26,6 @@ */ #include <sys/cdefs.h> -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index 074ebc779719..40433f1b37c0 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -277,13 +277,12 @@ struct nhgrp_object { static inline struct nhop_object * nhop_select(struct nhop_object *nh, uint32_t flowid) { + struct nhgrp_object *nhg; -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) { - struct nhgrp_object *nhg = (struct nhgrp_object *)nh; + nhg = (struct nhgrp_object *)nh; nh = nhg->nhops[flowid % nhg->nhg_size]; } -#endif return (nh); } diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 5251d4d75f15..562cf6d426c9 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -29,7 +29,6 @@ * SUCH DAMAGE. */ #include "opt_ddb.h" -#include "opt_route.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -287,13 +286,12 @@ report_route_event(const struct rib_cmd_info *rc, void *_cbdata) static void rts_handle_route_event(uint32_t fibnum, const struct rib_cmd_info *rc) { -#ifdef ROUTE_MPATH + if ((rc->rc_nh_new && NH_IS_NHGRP(rc->rc_nh_new)) || (rc->rc_nh_old && NH_IS_NHGRP(rc->rc_nh_old))) { rib_decompose_notification(rc, report_route_event, (void *)(uintptr_t)fibnum); } else -#endif report_route_event(rc, (void *)(uintptr_t)fibnum); } static struct rtbridge rtsbridge = { @@ -750,11 +748,12 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, struct linear_buffer *lb, u_int fi static struct nhop_object * select_nhop(struct nhop_object *nh, const struct sockaddr *gw) { - if (!NH_IS_NHGRP(nh)) - return (nh); -#ifdef ROUTE_MPATH const struct weightened_nhop *wn; uint32_t num_nhops; + + if (!NH_IS_NHGRP(nh)) + return (nh); + wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); if (gw == NULL) return (wn[0].nh); @@ -762,7 +761,7 @@ select_nhop(struct nhop_object *nh, const struct sockaddr *gw) if (match_nhop_gw(wn[i].nh, gw)) return (wn[i].nh); } -#endif + return (NULL); } @@ -1029,7 +1028,6 @@ update_rtm_from_rc(struct rt_addrinfo *info, struct rt_msghdr **prtm, return (0); } -#ifdef ROUTE_MPATH static void save_del_notification(const struct rib_cmd_info *rc, void *_cbdata) { @@ -1047,7 +1045,6 @@ save_add_notification(const struct rib_cmd_info *rc, void *_cbdata) if (rc->rc_cmd == RTM_ADD) *rc_new = *rc; } -#endif #if defined(INET6) || defined(INET) static struct sockaddr * @@ -1171,7 +1168,6 @@ rts_send(struct socket *so, int flags, struct mbuf *m, error = rib_action(fibnum, rtm->rtm_type, &info, &rc); if (error == 0) { rtsock_notify_event(fibnum, &rc); -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(rc.rc_nh_new) || (rc.rc_nh_old && NH_IS_NHGRP(rc.rc_nh_old))) { struct rib_cmd_info rc_simple = {}; @@ -1179,7 +1175,7 @@ rts_send(struct socket *so, int flags, struct mbuf *m, save_add_notification, (void *)&rc_simple); rc = rc_simple; } -#endif + /* nh MAY be empty if RTM_CHANGE request is no-op */ nh = rc.rc_nh_new; if (nh != NULL) { @@ -1193,7 +1189,6 @@ rts_send(struct socket *so, int flags, struct mbuf *m, error = rib_action(fibnum, RTM_DELETE, &info, &rc); if (error == 0) { rtsock_notify_event(fibnum, &rc); -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(rc.rc_nh_old) || (rc.rc_nh_new && NH_IS_NHGRP(rc.rc_nh_new))) { struct rib_cmd_info rc_simple = {}; @@ -1201,7 +1196,6 @@ rts_send(struct socket *so, int flags, struct mbuf *m, save_del_notification, (void *)&rc_simple); rc = rc_simple; } -#endif nh = rc.rc_nh_old; } break; @@ -2249,8 +2243,11 @@ rt_dispatch(struct mbuf *m, sa_family_t saf) static int sysctl_dumpentry(struct rtentry *rt, void *vw) { + const struct weightened_nhop *wn; struct walkarg *w = vw; struct nhop_object *nh; + int error; + uint32_t num_nhops; NET_EPOCH_ASSERT(); @@ -2259,11 +2256,7 @@ sysctl_dumpentry(struct rtentry *rt, void *vw) export_rtaddrs(rt, w->dst, w->mask); nh = rt_get_raw_nhop(rt); -#ifdef ROUTE_MPATH if (NH_IS_NHGRP(nh)) { - const struct weightened_nhop *wn; - uint32_t num_nhops; - int error; wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); for (int i = 0; i < num_nhops; i++) { error = sysctl_dumpnhop(rt, wn[i].nh, wn[i].weight, w); @@ -2271,7 +2264,6 @@ sysctl_dumpentry(struct rtentry *rt, void *vw) return (error); } } else -#endif sysctl_dumpnhop(rt, nh, rt->rt_weight, w); return (0); @@ -2701,11 +2693,7 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS) if (w.w_op == NET_RT_NHOP) error = nhops_dump_sysctl(rnh, w.w_req); else -#ifdef ROUTE_MPATH error = nhgrp_dump_sysctl(rnh, w.w_req); -#else - error = ENOTSUP; -#endif break; case NET_RT_IFLIST: case NET_RT_IFLISTL: diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index 05c6062463be..3b3878dbcde8 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -33,7 +33,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/bitstring.h> #include <sys/systm.h> diff --git a/sys/netgraph/netflow/netflow_v9.c b/sys/netgraph/netflow/netflow_v9.c index e6b63a8aa36b..2761bd3a0074 100644 --- a/sys/netgraph/netflow/netflow_v9.c +++ b/sys/netgraph/netflow/netflow_v9.c @@ -28,7 +28,6 @@ #include <sys/cdefs.h> #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/counter.h> diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c index 9bf212871fcb..22f58b0876a2 100644 --- a/sys/netgraph/netflow/ng_netflow.c +++ b/sys/netgraph/netflow/ng_netflow.c @@ -33,7 +33,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/netinet/in_fib.c b/sys/netinet/in_fib.c index 0bcda9fdd312..d8e373bf3dc2 100644 --- a/sys/netinet/in_fib.c +++ b/sys/netinet/in_fib.c @@ -66,7 +66,6 @@ CHK_STRUCT_ROUTE_COMPAT(struct route_in, ro_dst4); VNET_DEFINE(struct fib_dp *, inet_dp); #endif -#ifdef ROUTE_MPATH struct _hash_5tuple_ipv4 { struct in_addr src; struct in_addr dst; @@ -97,7 +96,6 @@ fib4_calc_software_hash(struct in_addr src, struct in_addr dst, return (toeplitz_hash(MPATH_ENTROPY_KEY_LEN, mpath_entropy_key, sizeof(data), (uint8_t *)&data)); } -#endif /* * Looks up path in fib @fibnum specified by @dst. @@ -192,19 +190,19 @@ static int check_urpf(struct nhop_object *nh, uint32_t flags, const struct ifnet *src_if) { -#ifdef ROUTE_MPATH + const struct weightened_nhop *wn; + uint32_t num_nhops; + if (NH_IS_NHGRP(nh)) { - const struct weightened_nhop *wn; - uint32_t num_nhops; wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); for (int i = 0; i < num_nhops; i++) { if (check_urpf_nhop(wn[i].nh, flags, src_if) != 0) return (1); } return (0); - } else -#endif - return (check_urpf_nhop(nh, flags, src_if)); + } + + return (check_urpf_nhop(nh, flags, src_if)); } #ifndef FIB_ALGO diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index e375f0edcc7e..f72260834a96 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -41,7 +41,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ratelimit.h" -#include "opt_route.h" #include "opt_rss.h" #include <sys/param.h> @@ -1167,8 +1166,8 @@ in_pcbconnect(struct inpcb *inp, struct sockaddr_in *sin, struct ucred *cred) MPASS(error == 0); } else in_pcbrehash(inp); -#ifdef ROUTE_MPATH - if (CALC_FLOWID_OUTBOUND) { + + if (V_fib_hash_outbound) { uint32_t hash_val, hash_type; hash_val = fib4_calc_software_hash(inp->inp_laddr, @@ -1178,7 +1177,6 @@ in_pcbconnect(struct inpcb *inp, struct sockaddr_in *sin, struct ucred *cred) inp->inp_flowid = hash_val; inp->inp_flowtype = hash_type; } -#endif if (anonport) inp->inp_flags |= INP_ANONPORT; return (0); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 7de3dc24dc53..5800a0854ee5 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -33,7 +33,6 @@ #include "opt_inet.h" #include "opt_ipstealth.h" #include "opt_ipsec.h" -#include "opt_route.h" #include "opt_rss.h" #include "opt_sctp.h" diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 8af44c6a200d..9431d5f0d7b2 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -34,7 +34,6 @@ #include "opt_kern_tls.h" #include "opt_mbuf_stress_test.h" #include "opt_ratelimit.h" -#include "opt_route.h" #include "opt_rss.h" #include "opt_sctp.h" diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index e0e7aed04cd0..9b17d0d80327 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -33,7 +33,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/jail.h> @@ -486,8 +485,7 @@ rip_send(struct socket *so, int pruflags, struct mbuf *m, struct sockaddr *nam, ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; ip->ip_dst.s_addr = *dst; -#ifdef ROUTE_MPATH - if (CALC_FLOWID_OUTBOUND) { + if (V_fib_hash_outbound) { uint32_t hash_type, hash_val; hash_val = fib4_calc_software_hash(ip->ip_src, @@ -496,7 +494,6 @@ rip_send(struct socket *so, int pruflags, struct mbuf *m, struct sockaddr *nam, M_HASHTYPE_SET(m, hash_type); flags |= IP_NODEFAULTFLOWID; } -#endif if (jailed(inp->inp_cred)) { /* * prison_local_ip4() would be good enough but would @@ -539,8 +536,7 @@ rip_send(struct socket *so, int pruflags, struct mbuf *m, struct sockaddr *nam, return (EINVAL); ip = mtod(m, struct ip *); } -#ifdef ROUTE_MPATH - if (CALC_FLOWID_OUTBOUND) { + if (V_fib_hash_outbound) { uint32_t hash_type, hash_val; hash_val = fib4_calc_software_hash(ip->ip_dst, @@ -549,7 +545,6 @@ rip_send(struct socket *so, int pruflags, struct mbuf *m, struct sockaddr *nam, M_HASHTYPE_SET(m, hash_type); flags |= IP_NODEFAULTFLOWID; } -#endif INP_RLOCK(inp); /* * Don't allow both user specified and setsockopt options, diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 75782765bc98..e8847ea12f1e 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -39,7 +39,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_route.h" #include "opt_rss.h" #include <sys/param.h> @@ -1127,7 +1126,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, u_char tos, vflagsav; uint8_t pr; uint16_t cscov = 0; - uint32_t flowid = 0; + uint32_t hash_val, hash_type, flowid = 0; uint8_t flowtype = M_HASHTYPE_NONE; bool use_cached_route; @@ -1487,11 +1486,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, if (flowtype != M_HASHTYPE_NONE) { m->m_pkthdr.flowid = flowid; M_HASHTYPE_SET(m, flowtype); - } -#if defined(ROUTE_MPATH) || defined(RSS) - else if (CALC_FLOWID_OUTBOUND_SENDTO) { - uint32_t hash_val, hash_type; - + } else if (CALC_FLOWID_OUTBOUND_SENDTO) { hash_val = fib4_calc_packet_hash(laddr, faddr, lport, fport, pr, &hash_type); m->m_pkthdr.flowid = hash_val; @@ -1510,7 +1505,6 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, * hash value based on the packet contents. */ ipflags |= IP_NODEFAULTFLOWID; -#endif /* RSS */ if (pr == IPPROTO_UDPLITE) UDPLITE_PROBE(send, NULL, inp, &ui->ui_i, inp, &ui->ui_u); diff --git a/sys/netinet6/in6_fib.c b/sys/netinet6/in6_fib.c index 95094a1ace76..c851a5bd14c5 100644 --- a/sys/netinet6/in6_fib.c +++ b/sys/netinet6/in6_fib.c @@ -72,7 +72,6 @@ CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); VNET_DEFINE(struct fib_dp *, inet6_dp); #endif -#ifdef ROUTE_MPATH struct _hash_5tuple_ipv6 { struct in6_addr src; struct in6_addr dst; @@ -103,7 +102,6 @@ fib6_calc_software_hash(const struct in6_addr *src, const struct in6_addr *dst, return (toeplitz_hash(MPATH_ENTROPY_KEY_LEN, mpath_entropy_key, sizeof(data), (uint8_t *)&data)); } -#endif /* * Looks up path in fib @fibnum specified by @dst. @@ -201,19 +199,19 @@ static int check_urpf(struct nhop_object *nh, uint32_t flags, const struct ifnet *src_if) { -#ifdef ROUTE_MPATH + const struct weightened_nhop *wn; + uint32_t num_nhops; + if (NH_IS_NHGRP(nh)) { - const struct weightened_nhop *wn; - uint32_t num_nhops; wn = nhgrp_get_nhops((struct nhgrp_object *)nh, &num_nhops); for (int i = 0; i < num_nhops; i++) { if (check_urpf_nhop(wn[i].nh, flags, src_if) != 0) return (1); } return (0); - } else -#endif - return (check_urpf_nhop(nh, flags, src_if)); + } + + return (check_urpf_nhop(nh, flags, src_if)); } #ifndef FIB_ALGO diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 6bea94160eb2..216051156767 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -67,7 +67,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_route.h" #include "opt_rss.h" #include <sys/hash.h> @@ -449,8 +448,7 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, bzero(&laddr6, sizeof(laddr6)); laddr6.sin6_family = AF_INET6; -#ifdef ROUTE_MPATH - if (CALC_FLOWID_OUTBOUND) { + if (V_fib_hash_outbound) { uint32_t hash_type, hash_val; hash_val = fib6_calc_software_hash(&inp->in6p_laddr, @@ -459,7 +457,6 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred, inp->inp_flowid = hash_val; inp->inp_flowtype = hash_type; } -#endif /* * Call inner routine, to assign local interface address. * in6_pcbladdr() may automatically fill in sin6_scope_id. diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 560698a5e6ad..784b824478fc 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -65,7 +65,6 @@ #include "opt_ipsec.h" #include "opt_ipstealth.h" #include "opt_sctp.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/socket.h> diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 20b092cf6fd2..0dae879c1bd5 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -63,7 +63,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_route.h" #include "opt_rss.h" #include "opt_sctp.h" diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index b7ba3c4c080c..29374a39e336 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -65,7 +65,6 @@ #include "opt_ipsec.h" #include "opt_kern_tls.h" #include "opt_ratelimit.h" -#include "opt_route.h" #include "opt_rss.h" #include "opt_sctp.h" diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 88f159a6af43..48e80bb75e0b 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -33,7 +33,6 @@ #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/systm.h> @@ -1637,13 +1636,10 @@ check_release_defrouter(const struct rib_cmd_info *rc, void *_cbdata) void nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, void *arg) { -#ifdef ROUTE_MPATH + rib_decompose_notification(rc, check_release_defrouter, NULL); if (rc->rc_cmd == RTM_DELETE && !NH_IS_NHGRP(rc->rc_nh_old)) check_release_defrouter(rc, NULL); -#else - check_release_defrouter(rc, NULL); -#endif } int diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index f3153b5435e2..9e51005d7c2e 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -61,7 +61,6 @@ #include "opt_ipsec.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/param.h> #include <sys/errno.h> @@ -361,6 +360,7 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, int use_defzone = 0; int hlim = 0; struct in6_addr in6a; + uint32_t hash_type, hash_val; inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip6_send: inp == NULL")); @@ -452,16 +452,12 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, } ip6 = mtod(m, struct ip6_hdr *); -#ifdef ROUTE_MPATH - if (CALC_FLOWID_OUTBOUND) { - uint32_t hash_type, hash_val; - + if (V_fib_hash_outbound) { hash_val = fib6_calc_software_hash(&inp->in6p_laddr, &dstsock->sin6_addr, 0, 0, inp->inp_ip_p, &hash_type); inp->inp_flowid = hash_val; inp->inp_flowtype = hash_type; } -#endif /* * Source address selection. */ diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 1d1dcb75a1df..729be392668a 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -70,7 +70,6 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_route.h" #include "opt_rss.h" #include <sys/param.h> @@ -940,7 +939,6 @@ udp6_send(struct socket *so, int flags_arg, struct mbuf *m, } flags = 0; -#if defined(ROUTE_MPATH) || defined(RSS) if (CALC_FLOWID_OUTBOUND_SENDTO) { uint32_t hash_type, hash_val; uint8_t pr; @@ -954,7 +952,6 @@ udp6_send(struct socket *so, int flags_arg, struct mbuf *m, } /* do not use inp flowid */ flags |= IP_NODEFAULTFLOWID; -#endif UDPSTAT_INC(udps_opackets); if (nxt == IPPROTO_UDPLITE) diff --git a/sys/netlink/route/nexthop.c b/sys/netlink/route/nexthop.c index 30aa3dd72534..314fb66431b9 100644 --- a/sys/netlink/route/nexthop.c +++ b/sys/netlink/route/nexthop.c @@ -28,7 +28,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/types.h> #include <sys/ck.h> #include <sys/epoch.h> @@ -268,12 +267,10 @@ nl_find_base_unhop(struct unhop_ctl *ctl, uint32_t uidx) static struct nhop_object * clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_flags) { -#ifdef ROUTE_MPATH const struct weightened_nhop *wn; struct weightened_nhop *wn_new, wn_base[MAX_STACK_NHOPS]; - uint32_t num_nhops; -#endif struct nhop_object *nh = NULL; + uint32_t num_nhops; int error; if (unhop->un_nhop_src != NULL) { @@ -298,10 +295,9 @@ clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_f nhop_set_pxtype_flag(nh, nh_flags); return (nhop_get_nhop(nh, &error)); } -#ifdef ROUTE_MPATH + wn = unhop->un_nhgrp_src; num_nhops = unhop->un_nhgrp_count; - if (num_nhops > MAX_STACK_NHOPS) { wn_new = malloc(num_nhops * sizeof(struct weightened_nhop), M_TEMP, M_NOWAIT); if (wn_new == NULL) @@ -328,7 +324,7 @@ clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_f if (wn_new != wn_base) free(wn_new, M_TEMP); -#endif + return (nh); } diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 4d7f676d2aec..39ae65217620 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -29,7 +29,6 @@ #include <sys/cdefs.h> #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_route.h" #include <sys/types.h> #include <sys/malloc.h> #include <sys/rmlock.h> @@ -67,20 +66,21 @@ get_rtm_type(const struct nhop_object *nh) static uint8_t nl_get_rtm_protocol(const struct nhop_object *nh) { -#ifdef ROUTE_MPATH + const struct nhgrp_object *nhg = (const struct nhgrp_object *)nh; + int rt_flags; + uint8_t origin; + if (NH_IS_NHGRP(nh)) { - const struct nhgrp_object *nhg = (const struct nhgrp_object *)nh; - uint8_t origin = nhgrp_get_origin(nhg); + origin = nhgrp_get_origin(nhg); if (origin != RTPROT_UNSPEC) return (origin); nh = nhg->nhops[0]; } -#endif - uint8_t origin = nhop_get_origin(nh); + origin = nhop_get_origin(nh); if (origin != RTPROT_UNSPEC) return (origin); /* TODO: remove guesswork once all kernel users fill in origin */ - int rt_flags = nhop_get_rtflags(nh); + rt_flags = nhop_get_rtflags(nh); if (rt_flags & RTF_PROTO1) return (RTPROT_ZEBRA); if (rt_flags & RTF_STATIC) @@ -174,7 +174,6 @@ dump_rc_nhop_mtu(struct nl_writer *nw, const struct nhop_object *nh) *((uint32_t *)(nla + 1)) = nh->nh_mtu; } -#ifdef ROUTE_MPATH static void dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg *rtm) { @@ -218,20 +217,19 @@ dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg * } nlattr_set_len(nw, off); } -#endif static void dump_rc_nhop(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtmsg *rtm) { -#ifdef ROUTE_MPATH + const struct nhop_object *nh = rnd->rnd_nhop; + uint32_t rtflags, uidx, nh_expire; + if (NH_IS_NHGRP(rnd->rnd_nhop)) { dump_rc_nhg(nw, rnd->rnd_nhgrp, rtm); return; } -#endif - const struct nhop_object *nh = rnd->rnd_nhop; - uint32_t rtflags = nhop_get_rtflags(nh); + rtflags = nhop_get_rtflags(nh); /* * IPv4 over IPv6 * ('RTA_VIA', {'family': 10, 'addr': 'fe80::20c:29ff:fe67:2dd'}), ('RTA_OIF', 2), @@ -243,7 +241,7 @@ dump_rc_nhop(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtm if (nh->nh_flags & NHF_GATEWAY) dump_rc_nhop_gw(nw, nh); - uint32_t uidx = nhop_get_uidx(nh); + uidx = nhop_get_uidx(nh); if (uidx != 0) nlattr_add_u32(nw, NL_RTA_NH_ID, uidx); nlattr_add_u32(nw, NL_RTA_KNH_ID, nhop_get_idx(nh)); @@ -251,7 +249,7 @@ dump_rc_nhop(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtm if (rtflags & RTF_FIXEDMTU) dump_rc_nhop_mtu(nw, nh); - uint32_t nh_expire = nhop_get_expire(nh); + nh_expire = nhop_get_expire(nh); if (nh_expire > 0) nlattr_add_u32(nw, NL_RTA_EXPIRES, nh_expire - time_uptime); @@ -818,7 +816,6 @@ get_op_flags(int nlm_flags) return (op_flags); } -#ifdef ROUTE_MPATH static int create_nexthop_one(struct nl_parsed_route *attrs, struct rta_mpath_nh *mpnh, struct nl_pstate *npt, struct nhop_object **pnh) @@ -848,7 +845,6 @@ create_nexthop_one(struct nl_parsed_route *attrs, struct rta_mpath_nh *mpnh, return (error); } -#endif static struct nhop_object * create_nexthop_from_attrs(struct nl_parsed_route *attrs, @@ -859,7 +855,6 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, uint32_t nh_expire = 0; if (attrs->rta_multipath != NULL) { -#ifdef ROUTE_MPATH /* Multipath w/o explicit nexthops */ int num_nhops = attrs->rta_multipath->num_nhops; struct weightened_nhop *wn = npt_alloc(npt, sizeof(*wn) * num_nhops); @@ -892,9 +887,6 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, return ((struct nhop_object *)nhg); error = *perror; } -#else - error = ENOTSUP; -#endif *perror = error; } else { nh = nhop_alloc(attrs->rta_table, attrs->rtm_family); diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 4f61b34a9f18..8daf5353263a 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -41,7 +41,6 @@ options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking options INET6 # IPv6 communications protocols options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options ROUTE_MPATH # Multipath routing support options TCP_OFFLOAD # TCP offload options TCP_BLACKBOX # Enhanced TCP event logging options TCP_HHOOK # hhook(9) framework for TCP diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 0761784c095f..827d5efef50b 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -30,7 +30,6 @@ options INET # InterNETworking options INET6 # IPv6 communications protocols options TCP_HHOOK # hhook(9) framework for TCP options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options ROUTE_MPATH # Multipath routing support options FIB_ALGO # Modular fib lookups options TCP_OFFLOAD # TCP offload options TCP_BLACKBOX # Enhanced TCP event logging diff --git a/tests/sys/netinet/output.sh b/tests/sys/netinet/output.sh index 23d427605878..d6b3ccbe607c 100755 --- a/tests/sys/netinet/output.sh +++ b/tests/sys/netinet/output.sh @@ -223,7 +223,7 @@ output_raw_success_cleanup() mpath_check() { if [ `sysctl -iW net.route.multipath | wc -l` != "1" ]; then - atf_skip "This test requires ROUTE_MPATH enabled" + atf_skip "This test requires multipath enabled" fi } diff --git a/tests/sys/netinet6/output6.sh b/tests/sys/netinet6/output6.sh index 5811e0e5eacc..bf8903ba3c07 100755 --- a/tests/sys/netinet6/output6.sh +++ b/tests/sys/netinet6/output6.sh @@ -247,7 +247,7 @@ output6_raw_success_cleanup() mpath_check() { if [ `sysctl -iW net.route.multipath | wc -l` != "1" ]; then - atf_skip "This test requires ROUTE_MPATH enabled" + atf_skip "This test requires multipath enabled" fi } |
