git: 254b23eb1f54 - main - routing: Retire ROUTE_MPATH compile option
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 27 Mar 2026 20:51:18 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=254b23eb1f540844cf2a90f2781ae4231c5701ce
commit 254b23eb1f540844cf2a90f2781ae4231c5701ce
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-03-27 11:20:05 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-03-27 20:25:33 +0000
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
---
sys/amd64/conf/FIRECRACKER | 1 -
sys/amd64/conf/GENERIC | 1 -
sys/arm64/conf/std.arm64 | 1 -
sys/conf/NOTES | 3 ---
sys/conf/files | 6 +++---
sys/conf/options | 1 -
sys/i386/conf/GENERIC | 1 -
sys/modules/netgraph/netflow/Makefile | 2 +-
sys/modules/netlink/Makefile | 2 +-
sys/net/route.c | 1 -
sys/net/route.h | 17 ----------------
sys/net/route/fib_algo.c | 8 ++------
sys/net/route/nhgrp.c | 1 -
sys/net/route/nhgrp_ctl.c | 1 -
sys/net/route/nhop.c | 5 -----
sys/net/route/nhop_ctl.c | 17 ++++------------
sys/net/route/nhop_utils.c | 1 -
sys/net/route/route_ctl.c | 38 ++---------------------------------
sys/net/route/route_helpers.c | 3 ---
sys/net/route/route_ifaddrs.c | 2 --
sys/net/route/route_rtentry.c | 7 ++-----
sys/net/route/route_subscription.c | 1 -
sys/net/route/route_var.h | 5 ++---
sys/net/rtsock.c | 32 +++++++++--------------------
sys/netgraph/netflow/netflow.c | 1 -
sys/netgraph/netflow/netflow_v9.c | 1 -
sys/netgraph/netflow/ng_netflow.c | 1 -
sys/netinet/in_fib.c | 14 ++++++-------
sys/netinet/in_pcb.c | 6 ++----
sys/netinet/ip_input.c | 1 -
sys/netinet/ip_output.c | 1 -
sys/netinet/raw_ip.c | 9 ++-------
sys/netinet/udp_usrreq.c | 10 ++-------
sys/netinet6/in6_fib.c | 14 ++++++-------
sys/netinet6/in6_pcb.c | 5 +----
sys/netinet6/in6_proto.c | 1 -
sys/netinet6/ip6_input.c | 1 -
sys/netinet6/ip6_output.c | 1 -
sys/netinet6/nd6.c | 6 +-----
sys/netinet6/raw_ip6.c | 8 ++------
sys/netinet6/udp6_usrreq.c | 3 ---
sys/netlink/route/nexthop.c | 10 +++------
sys/netlink/route/rt.c | 34 ++++++++++++-------------------
sys/powerpc/conf/GENERIC64 | 1 -
sys/riscv/conf/GENERIC | 1 -
tests/sys/netinet/output.sh | 2 +-
tests/sys/netinet6/output6.sh | 2 +-
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
*** 538 LINES SKIPPED ***