opnsense-src/sys/netinet
Bojan Novković 65a7d0af51 bind(2): Lookup local address in current FIB if '*.bind_all_fibs' is active
When a protocol-specific 'bind_all_fibs' tunable is set to 0, a
listening socket will only receive traffic originating from the FIB
it was bound to. However, there are no checks to determine whether
an address exists in the target FIB when binding the socket, which can
lead to a situation where a socket and the address it was bound to
belong to different FIBs.

Prevent this footgun by looking up the requested address in the current
FIB if 'bind_all_fibs' is active and returning an error if the address
does not exist.

Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D58281
Reviewed by:	glebius, pouria, markj
MFC after:	2 weeks

(cherry picked from commit 948ad32ae1e0811f45e1d38f26636fefed5051f0)
2026-09-14 07:30:53 +02:00
..
cc netinet: Use proper prototype for SYSINIT functions 2026-02-01 01:01:05 +08:00
khelp sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
libalias libalias: Serialize updates to the global instance list 2026-08-11 08:33:11 +02:00
netdump netdump: Check the return value of ifunit_ref() 2023-10-02 08:09:26 -04:00
tcp_stacks rack: Reload the TCP stack PCB after reacquiring the inpcb lock 2026-07-06 10:29:32 +02:00
accf_data.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
accf_dns.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
accf_http.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
accf_tls.c accf_tls: accept filter that waits for TLS handshake header 2024-04-24 17:53:10 -07:00
dccp.h Decorate IPv4 structures used for byte buffer overlays as packed. 2025-05-04 13:48:04 +02:00
icmp6.h IPv6: Ignore PTB packets with an MTU < 1280 2025-08-12 10:38:55 -04:00
icmp_var.h icmp: remove unused BANDLIM_UNLIMITED 2025-08-11 18:46:08 +02:00
if_ether.c bridge: store a bridge_iflist pointer in ifnet 2025-04-09 09:39:01 +02:00
if_ether.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
igmp.c igmp: Avoid leaving dangling pointers in the state-change queue 2026-07-06 10:50:03 +02:00
igmp.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
igmp_var.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
in.c bridge: Print a warning if member_ifaddrs=1 2025-09-04 17:33:39 +01:00
in.h netinet: Make in_canforward() return bool 2025-03-02 23:00:42 +08:00
in_cksum.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
in_debug.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
in_fib.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
in_fib.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
in_fib_algo.c route/fib_algo: Free leaked radix_masks in radix_lockless 2026-09-11 09:41:11 +02:00
in_fib_dxr.c tcp: remove trailing whitespaces 2025-07-24 18:17:35 +02:00
in_gif.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
in_jail.c netinet: use in_broadcast() inline 2025-02-21 18:11:06 -08:00
in_kdtrace.c tcp: add missing SDT probes 2025-06-17 09:52:51 -07:00
in_kdtrace.h tcp: add missing SDT probes 2025-06-17 09:52:51 -07:00
in_mcast.c in_mcast: Fix uninitialized variable usage in inm_merge() 2026-09-14 07:29:31 +02:00
in_pcb.c bind(2): Lookup local address in current FIB if '*.bind_all_fibs' is active 2026-09-14 07:30:53 +02:00
in_pcb.h ddb: provide inp_flags2 when printing inpcbs 2025-11-10 20:54:12 +01:00
in_pcb_var.h inpcb: retire two-level port hash database 2025-03-06 22:58:35 -08:00
in_prot.c netinet/in_prot.c: normalize includes 2025-06-10 02:47:13 +03:00
in_proto.c UDP-Lite: export pcblist via sysctl interface 2025-10-26 14:50:45 +01:00
in_rmx.c netinet: rename in_broadcast() to in_ifnet_broadcast() 2025-02-21 18:10:53 -08:00
in_rss.c inet: fix typo 2025-08-08 11:17:38 -06:00
in_rss.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
in_systm.h inpcb: provide policy cr_canexport_ktlskeys() and the privilege PRIV_NETINET_KTLSKEYS 2025-06-10 02:47:13 +03:00
in_var.h in: add in_mask2len() 2024-12-17 11:07:12 +01:00
ip.h Decorate IPv4 structures used for byte buffer overlays as packed. 2025-05-04 13:48:04 +02:00
ip6.h netinet: Define IPv6 ECN mask 2024-01-03 12:56:28 -05:00
ip_carp.c carp6: revise the generation of ND6 NA 2025-10-18 15:01:21 +03:00
ip_carp.h carp: support VRRPv3 2024-05-08 13:19:03 +02:00
ip_carp_nl.h carp: support VRRPv3 2024-05-08 13:19:03 +02:00
ip_divert.c divert: Avoid using atomic_(load|store)_(acq|rel)_16 2026-06-25 11:18:46 +02:00
ip_divert.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ip_dummynet.h dummynet: add simple gilbert-elliott channel model 2023-12-17 13:20:45 +01:00
ip_ecn.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ip_ecn.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ip_encap.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ip_encap.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ip_fastfwd.c Revert "Revert "ip: improve deferred computation of checksums"" 2026-07-10 14:54:56 +02:00
ip_fw.h ipfw: add support for masked ip-address lookups 2026-03-24 12:31:11 +03:00
ip_gre.c netinet: allow per protocol random IP id control, single out IPSEC 2025-03-04 08:45:32 -08:00
ip_icmp.c icmp: clear offset and flags when reflecting a packet 2025-08-18 19:19:13 +02:00
ip_icmp.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
ip_id.c netinet: allow per protocol random IP id control, single out IPSEC 2025-03-04 08:45:32 -08:00
ip_input.c Revert "Revert "ip: improve deferred computation of checksums"" 2026-07-10 14:54:56 +02:00
ip_mroute.c ip_mroute: Avoid leaking uninitialized bytes to the routing daemon 2026-09-14 07:28:39 +02:00
ip_mroute.h ip_mroute: FIBify 2026-09-14 07:23:32 +02:00
ip_options.c netinet*: Add assertions for some places that don't support M_EXTPG mbufs 2024-10-31 16:32:32 -04:00
ip_options.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ip_output.c ip_mroute: FIBify 2026-09-14 07:23:32 +02:00
ip_reass.c rss: add sysctl enable toggle 2026-06-25 11:18:46 +02:00
ip_var.h pf: pf_route() "dst" no longer holds the gateway in 15.x #294 2026-07-13 09:09:45 +02:00
pim.h Decorate IPv4 structures used for byte buffer overlays as packed. 2025-05-04 13:48:04 +02:00
pim_var.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
raw_ip.c bind(2): Lookup local address in current FIB if '*.bind_all_fibs' is active 2026-09-14 07:30:53 +02:00
sctp.h sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
sctp_asconf.c sctp: improve debug output 2024-10-24 13:19:14 +02:00
sctp_asconf.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_auth.c sctp: cleanup locking for notifications 2023-09-08 16:20:51 +02:00
sctp_auth.h sctp: cleanup SCTP AUTH related notification 2023-09-08 13:13:43 +02:00
sctp_bsd_addr.c sctp: support bridge interfaces 2026-01-21 20:55:36 +01:00
sctp_bsd_addr.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_cc_functions.c sctp: Use __sdt_used for variables only used by SDT probes 2026-04-24 11:33:36 -04:00
sctp_constants.h sctp: make sure all SCTP RESET notifications use sctp_ulp_notify() 2023-09-08 14:19:56 +02:00
sctp_crc32.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
sctp_crc32.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_header.h sctp: store heartbeat creation time as time_t 2024-05-10 20:40:15 +02:00
sctp_indata.c sctp: improve input validation for data chunks 2024-08-03 13:27:18 +02:00
sctp_indata.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_input.c sctp, tcp, udp: improve deferred computation of checksums 2025-08-01 12:09:47 +02:00
sctp_input.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_kdtrace.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
sctp_kdtrace.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_lock_bsd.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_module.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
sctp_os.h sockets: don't malloc/free sockaddr memory on getpeername/getsockname 2023-11-30 08:31:10 -08:00
sctp_os_bsd.h netinet: rename in_broadcast() to in_ifnet_broadcast() 2025-02-21 18:10:53 -08:00
sctp_output.c netinet: allow per protocol random IP id control, single out IPSEC 2025-03-04 08:45:32 -08:00
sctp_output.h sctp: improve sending of packets containing an INIT ACK chunk 2024-02-24 19:16:36 +01:00
sctp_pcb.c sctp: compute address flags only for IPv6 addresses 2025-05-05 22:43:50 +02:00
sctp_pcb.h sctp: improve handling of address changes 2024-11-03 10:20:08 +01:00
sctp_peeloff.c sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_peeloff.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_ss_functions.c sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_structs.h sctp(4): Fix a typo in a source code comment 2026-04-20 09:27:29 +02:00
sctp_syscalls.c sctp: fix NOINET build 2026-05-21 14:20:55 -07:00
sctp_sysctl.c sctp: don't report unusable addresses via sysctl interface 2025-05-05 00:28:52 +02:00
sctp_sysctl.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_timer.c sctp: whitespace cleanup 2025-07-27 12:49:45 +02:00
sctp_timer.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_uio.h sctp: cleanup cdefs.h include 2023-08-18 15:25:34 +02:00
sctp_usrreq.c netinet: Fix getcred sysctl handlers to do nothing if no input is given 2025-03-20 01:33:44 +00:00
sctp_var.h sockets: make pr_shutdown fully protocol specific method 2024-01-16 10:30:37 -08:00
sctputil.c netinet: use in_broadcast() inline 2025-02-21 18:11:06 -08:00
sctputil.h sctp: make sure all SCTP RESET notifications use sctp_ulp_notify() 2023-09-08 14:19:56 +02:00
siftr.c style(9): white space after ; and around binary operators 2026-02-05 22:52:32 +01:00
tcp.h Decorate IPv4 structures used for byte buffer overlays as packed. 2025-05-04 13:48:04 +02:00
tcp_accounting.h Move access to tcp's t_logstate into inline functions and provide new tracepoint and bbpoint capabilities. 2023-03-16 11:43:16 -04:00
tcp_ecn.c tcp: commonize check for more data to send, style changes 2024-01-26 01:20:35 +01:00
tcp_ecn.h tcp: AccECN access ACE field by shifting bits 2024-01-26 00:16:22 +01:00
tcp_fastopen.c tcp_fastopen: Fix a typo in a source code comment 2024-01-22 21:49:47 +01:00
tcp_fastopen.h sockets: remove unused KPIs to manipulate sockets 2024-03-18 08:50:30 -07:00
tcp_fsm.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
tcp_hostcache.c tcp: Add CTLFLAG_VNET flag to some sysctls 2025-09-27 22:00:56 +08:00
tcp_hpts.c rss: add sysctl enable toggle 2026-06-25 11:18:46 +02:00
tcp_hpts.h tcp hpts: cleanup header file 2025-07-31 15:13:53 +02:00
tcp_input.c pf|ipfw|netinet6?: shared IP forwarding 2026-06-25 11:18:46 +02:00
tcp_log_buf.c tcp: improve compilability 2025-09-05 08:07:52 +02:00
tcp_log_buf.h tcp: remove trailing whitespaces 2025-07-24 18:17:35 +02:00
tcp_lro.c tcp lro: use the flowid only when it has hash properties 2025-10-09 14:53:09 +02:00
tcp_lro.h tcp: make tcp_lro_flush() static 2024-09-05 17:44:33 +02:00
tcp_lro_hpts.c tcp: improve function names 2025-07-31 14:56:10 +02:00
tcp_offload.c tcp_fill_info(): Change lock assertion on INPCB to locked only 2023-08-22 20:33:49 +02:00
tcp_offload.h sockets: remove unused KPIs to manipulate sockets 2024-03-18 08:50:30 -07:00
tcp_output.c tcp: bump max snd buffer size for autoscaling 2025-10-19 09:33:58 +02:00
tcp_ratelimit.c tcp_ratelimit: Use static initializers 2025-03-06 12:51:45 +08:00
tcp_ratelimit.h tcp_ratelimit: provide an api for drivers to release ratesets at detach 2024-08-05 12:51:35 -04:00
tcp_reass.c tcp: change SOCKBUF_* macros to SOCK_[RECV|SEND]BUF_* macros 2024-11-14 02:08:12 +01:00
tcp_sack.c tcp: add gone_in note for net.inet.tcp.sack.revised for fbsd16 2025-09-05 00:23:52 +02:00
tcp_seq.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
tcp_stats.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
tcp_subr.c tcp: improve validation of received TCP over UDP packets 2026-05-21 14:20:58 -07:00
tcp_syncache.c tcp: improve comments in the syncache code 2025-11-10 20:56:34 +01:00
tcp_syncache.h tcp: drop SYN ACK segment for listening sockets 2025-11-10 20:52:56 +01:00
tcp_timer.c rss: add sysctl enable toggle 2026-06-25 11:18:46 +02:00
tcp_timer.h tcp: allow specifying a MSL for local communications 2025-06-26 18:59:36 +02:00
tcp_timewait.c tcp: use RFC 6191 for connection recycling in TIME-WAIT 2026-04-26 10:09:03 +02:00
tcp_usrreq.c ddb: use %b when showing flags for a tcpcb 2025-11-10 20:35:07 +01:00
tcp_var.h tcp: retire TF_SENTSYN 2026-04-26 10:05:33 +02:00
tcpip.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
toecore.c Remove remaining mentions of pr_usrreq. 2025-05-08 16:29:15 +02:00
toecore.h Remove remaining mentions of pr_usrreq. 2025-05-08 16:29:15 +02:00
udp.h Decorate IPv4 structures used for byte buffer overlays as packed. 2025-05-04 13:48:04 +02:00
udp_usrreq.c udp: Wrap a long line in udp_send() 2026-07-09 08:58:25 +02:00
udp_var.h UDP-Lite: export pcblist via sysctl interface 2025-10-26 14:50:45 +01:00
udplite.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00