Author: tuexen
Date: Wed Jul  1 17:40:11 2020
New Revision: 362847
URL: https://svnweb.freebsd.org/changeset/base/362847

Log:
  MFC r350588: SCTP related cleanup
  
  Improve consistency. No functional change.

Modified:
  stable/12/sys/netinet/sctp_asconf.c
  stable/12/sys/netinet/sctp_os_bsd.h
  stable/12/sys/netinet/sctp_pcb.c
  stable/12/sys/netinet/sctp_usrreq.c
  stable/12/sys/netinet6/sctp6_usrreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_asconf.c
==============================================================================
--- stable/12/sys/netinet/sctp_asconf.c Wed Jul  1 17:17:06 2020        
(r362846)
+++ stable/12/sys/netinet/sctp_asconf.c Wed Jul  1 17:40:11 2020        
(r362847)
@@ -1982,7 +1982,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sc
 
                        /* invalid if we are a v6 only endpoint */
                        if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-                           SCTP_IPV6_V6ONLY(&inp->ip_inp.inp))
+                           SCTP_IPV6_V6ONLY(inp))
                                return;
 
                        sin = &ifa->address.sin;
@@ -2055,9 +2055,8 @@ sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *
                case AF_INET:
                        {
                                /* invalid if we are a v6 only endpoint */
-
                                if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-                                   SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) {
+                                   SCTP_IPV6_V6ONLY(inp)) {
                                        cnt_invalid++;
                                        if (asc->cnt == cnt_invalid)
                                                return (1);
@@ -2172,7 +2171,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
 
                                /* invalid if we are a v6 only endpoint */
                                if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-                                   SCTP_IPV6_V6ONLY(&inp->ip_inp.inp))
+                                   SCTP_IPV6_V6ONLY(inp))
                                        continue;
 
                                sin = &ifa->address.sin;
@@ -2189,7 +2188,7 @@ sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, stru
                                        continue;
                                }
                                if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) 
&&
-                                   SCTP_IPV6_V6ONLY(&inp->ip_inp.inp)) {
+                                   SCTP_IPV6_V6ONLY(inp)) {
                                        cnt_invalid++;
                                        if (asc->cnt == cnt_invalid)
                                                return;

Modified: stable/12/sys/netinet/sctp_os_bsd.h
==============================================================================
--- stable/12/sys/netinet/sctp_os_bsd.h Wed Jul  1 17:17:06 2020        
(r362846)
+++ stable/12/sys/netinet/sctp_os_bsd.h Wed Jul  1 17:40:11 2020        
(r362847)
@@ -365,10 +365,10 @@ typedef struct callout sctp_os_timer_t;
  */
 
 /* get the v6 hop limit */
-#define SCTP_GET_HLIM(inp, ro) in6_selecthlim((struct inpcb 
*)&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));
+#define SCTP_GET_HLIM(inp, ro) in6_selecthlim(&inp->ip_inp.inp, (ro ? 
(ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));
 
 /* is the endpoint v6only? */
-#define SCTP_IPV6_V6ONLY(inp)  (((struct inpcb *)inp)->inp_flags & 
IN6P_IPV6_V6ONLY)
+#define SCTP_IPV6_V6ONLY(sctp_inpcb)   ((sctp_inpcb)->ip_inp.inp.inp_flags & 
IN6P_IPV6_V6ONLY)
 /* is the socket non-blocking? */
 #define SCTP_SO_IS_NBIO(so)    ((so)->so_state & SS_NBIO)
 #define SCTP_SET_SO_NBIO(so)   ((so)->so_state |= SS_NBIO)

Modified: stable/12/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/12/sys/netinet/sctp_pcb.c    Wed Jul  1 17:17:06 2020        
(r362846)
+++ stable/12/sys/netinet/sctp_pcb.c    Wed Jul  1 17:40:11 2020        
(r362847)
@@ -2844,7 +2844,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *ad
                                struct sockaddr_in *sin;
 
                                /* IPV6_V6ONLY socket? */
-                               if (SCTP_IPV6_V6ONLY(ip_inp)) {
+                               if (SCTP_IPV6_V6ONLY(inp)) {
                                        SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_PCB, EINVAL);
                                        return (EINVAL);
                                }
@@ -3642,8 +3642,9 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate,
 
 
 #ifdef INET6
-       if (ip_pcb->inp_vflag & INP_IPV6)
-               ip6_freepcbopts(((struct inpcb *)inp)->in6p_outputopts);
+       if (ip_pcb->inp_vflag & INP_IPV6) {
+               ip6_freepcbopts(ip_pcb->in6p_outputopts);
+       }
 #endif                         /* INET6 */
        ip_pcb->inp_vflag = 0;
        /* free up authentication fields */

Modified: stable/12/sys/netinet/sctp_usrreq.c
==============================================================================
--- stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 17:17:06 2020        
(r362846)
+++ stable/12/sys/netinet/sctp_usrreq.c Wed Jul  1 17:40:11 2020        
(r362847)
@@ -1412,7 +1412,6 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb
        }
        if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
            (num_v4 > 0)) {
-
                if (SCTP_IPV6_V6ONLY(inp)) {
                        /*
                         * if IPV6_V6ONLY flag, ignore connections destined
@@ -6931,14 +6930,14 @@ sctp_connect(struct socket *so, struct sockaddr *addr,
 #ifdef INET
        case AF_INET:
                {
-                       struct sockaddr_in *sinp;
+                       struct sockaddr_in *sin;
 
                        if (addr->sa_len != sizeof(struct sockaddr_in)) {
                                SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
                                return (EINVAL);
                        }
-                       sinp = (struct sockaddr_in *)addr;
-                       if (p != NULL && (error = 
prison_remote_ip4(p->td_ucred, &sinp->sin_addr)) != 0) {
+                       sin = (struct sockaddr_in *)addr;
+                       if (p != NULL && (error = 
prison_remote_ip4(p->td_ucred, &sin->sin_addr)) != 0) {
                                SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, error);
                                return (error);
                        }

Modified: stable/12/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- stable/12/sys/netinet6/sctp6_usrreq.c       Wed Jul  1 17:17:06 2020        
(r362846)
+++ stable/12/sys/netinet6/sctp6_usrreq.c       Wed Jul  1 17:40:11 2020        
(r362847)
@@ -596,7 +596,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s
        vflagsav = inp->ip_inp.inp.inp_vflag;
        inp->ip_inp.inp.inp_vflag &= ~INP_IPV4;
        inp->ip_inp.inp.inp_vflag |= INP_IPV6;
-       if ((addr != NULL) && (SCTP_IPV6_V6ONLY(&inp->ip_inp.inp) == 0)) {
+       if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp) == 0)) {
                switch (addr->sa_family) {
 #ifdef INET
                case AF_INET:
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to