Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Dec 2021 10:41:27 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 89bbc8498885 - stable/13 - sctp: inherit IP level socket options from listening socket
Message-ID:  <202112101041.1BAAfRKV016280@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=89bbc849888546bf8cd74c8356de70bc38cced8b

commit 89bbc849888546bf8cd74c8356de70bc38cced8b
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-03 21:40:52 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-12-10 10:40:59 +0000

    sctp: inherit IP level socket options from listening socket
    
    Ensure that TTL and TOS values set on a listener get inheritet
    to the accepted sockets.
    
    PR:             260119
    MFC after:      1 week
    
    (cherry picked from commit d79676fb1368f5acac5fd182363ea3f46fb3bd93)
---
 sys/netinet/sctp_pcb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 7e0c0562e8a9..86f315afe051 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -2627,6 +2627,15 @@ sctp_move_pcb_and_assoc(struct sctp_inpcb *old_inp, struct sctp_inpcb *new_inp,
 	SCTP_TCB_LOCK(stcb);
 	atomic_subtract_int(&stcb->asoc.refcnt, 1);
 
+	if (old_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
+		new_inp->ip_inp.inp.inp_flags |= old_inp->ip_inp.inp.inp_flags & INP_CONTROLOPTS;
+		if (old_inp->ip_inp.inp.in6p_outputopts) {
+			new_inp->ip_inp.inp.in6p_outputopts = ip6_copypktopts(old_inp->ip_inp.inp.in6p_outputopts, M_NOWAIT);
+		}
+	} else {
+		new_inp->ip_inp.inp.inp_ip_tos = old_inp->ip_inp.inp.inp_ip_tos;
+		new_inp->ip_inp.inp.inp_ip_ttl = old_inp->ip_inp.inp.inp_ip_ttl;
+	}
 	new_inp->sctp_ep.time_of_secret_change =
 	    old_inp->sctp_ep.time_of_secret_change;
 	memcpy(new_inp->sctp_ep.secret_key, old_inp->sctp_ep.secret_key,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112101041.1BAAfRKV016280>