The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a64246401e62c3351b149445ebe638f4d894f69e
commit a64246401e62c3351b149445ebe638f4d894f69e Author: Mark Johnston <[email protected]> AuthorDate: 2026-05-26 18:21:27 +0000 Commit: Mark Johnston <[email protected]> CommitDate: 2026-06-25 15:21:51 +0000 divert: Avoid using atomic_(load|store)_(acq|rel)_16 It's not implemented on some arches. Use a plain int to count the number of sockets in a divert lbgroup. Reported by: Jenkins Fixes: 895a0ae67fe2 ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets") (cherry picked from commit c564074c9aaa8a3f9273de3cb802edcb3e2e2a40) --- sys/netinet/ip_divert.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 54789f279272..47c4ad861b8a 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -51,12 +51,14 @@ #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/sysctl.h> -#include <net/vnet.h> + +#include <machine/atomic.h> #include <net/if.h> #include <net/if_var.h> #include <net/if_private.h> #include <net/netisr.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/in_pcb.h> @@ -153,7 +155,7 @@ struct divcblbgroup { CK_SLIST_ENTRY(divcblbgroup) dl_next; struct epoch_context dl_epochctx; uint16_t dl_port; - uint16_t dl_count; + int dl_count; #define DIVCBLBGROUP_SIZE 32 struct divcb *dl_dcb[DIVCBLBGROUP_SIZE]; }; @@ -298,7 +300,7 @@ divert_packet(struct mbuf *m, uint64_t id, bool incoming) CK_SLIST_FOREACH(dlb, &V_divlbhash[DIVHASH(nport)], dl_next) { uint16_t count; - count = atomic_load_acq_16(&dlb->dl_count); + count = atomic_load_acq_int(&dlb->dl_count); if (dlb->dl_port == nport && count > 0) { uint32_t hash; @@ -667,7 +669,7 @@ div_lbgroup_detach(struct divcb *dcb) count = dlb->dl_count; if (i != count - 1) dlb->dl_dcb[i] = dlb->dl_dcb[count - 1]; - atomic_store_rel_16(&dlb->dl_count, count - 1); + atomic_store_rel_int(&dlb->dl_count, count - 1); if (count == 1) { CK_SLIST_REMOVE(&V_divlbhash[DCBHASH(dcb)], dlb, divcblbgroup, dl_next); @@ -744,7 +746,7 @@ div_bind(struct socket *so, struct sockaddr *nam, struct thread *td) ("div_bind: lbgroup %p has count 0", tmp)); tmp->dl_dcb[tmp->dl_count] = dcb; - atomic_store_rel_16(&tmp->dl_count, tmp->dl_count + 1); + atomic_store_rel_int(&tmp->dl_count, tmp->dl_count + 1); free(dlb, M_PCB); } else { error = ENOSPC;
