diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 2b36ba4e1f21..389943e18ac1 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4138,6 +4138,9 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, #ifdef INVARIANTS net->flowidset = 1; #endif + if (netp) { + *netp = net; + } netfirst = TAILQ_FIRST(&stcb->asoc.nets); if (net->ro.ro_rt == NULL) { /* Since we have no route put it at the back */ @@ -4209,9 +4212,6 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next); } - if (netp) { - *netp = net; - } return (0); }