The branch main has been updated by tuexen:

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

commit d79676fb1368f5acac5fd182363ea3f46fb3bd93
Author:     Michael Tuexen <[email protected]>
AuthorDate: 2021-12-03 21:40:52 +0000
Commit:     Michael Tuexen <[email protected]>
CommitDate: 2021-12-03 21:44:01 +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
---
 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 0b26ea8c1944..63a99cbc2c07 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -2622,6 +2622,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,

Reply via email to