git: bcc27cf809d2 - stable/15 - raw ip: clear sin_port on bind(2)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 24 Sep 2026 03:33:34 UTC
The branch stable/15 has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=bcc27cf809d2f5a19f423d28539b938b6fa0733a
commit bcc27cf809d2f5a19f423d28539b938b6fa0733a
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-09-12 12:12:36 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-09-24 03:32:59 +0000
raw ip: clear sin_port on bind(2)
Application may set sin_port to some value. Although this value is not
used by SOCK_RAW, it breaks a check that the address is available. A
perfect fix would be not use sockaddrs for ifaddrs, but that would be a
bigger change.
PR: 298366
Reviewed by: pouria, bnovkov, adrian
Differential Revision: https://reviews.freebsd.org/D59570
Fixes: 948ad32ae1e0811f45e1d38f26636fefed5051f0
(cherry picked from commit 465942e8cc8160b21e1a3d5e45fa3ddbb852f6db)
---
sys/netinet/raw_ip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 2d9871f9911f..3cb77eb1fe04 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -951,7 +951,7 @@ rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
fib = V_rip_bind_all_fibs == 0 ? inp->inp_inc.inc_fibnum :
RT_ALL_FIBS;
-
+ addr->sin_port = 0;
if (CK_STAILQ_EMPTY(&V_ifnet) ||
(addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK) ||
(addr->sin_addr.s_addr &&