Author: tuexen
Date: Mon Aug  5 13:22:15 2019
New Revision: 350588
URL: https://svnweb.freebsd.org/changeset/base/350588

Log:
  Improve consistency. No functional change.
  
  MFC after:            3 days

Modified:
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c      Mon Aug  5 13:22:02 2019        
(r350587)
+++ head/sys/netinet/sctp_asconf.c      Mon Aug  5 13:22:15 2019        
(r350588)
@@ -1957,7 +1957,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;
@@ -2030,9 +2030,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);
@@ -2147,7 +2146,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;
@@ -2164,7 +2163,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: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h      Mon Aug  5 13:22:02 2019        
(r350587)
+++ head/sys/netinet/sctp_os_bsd.h      Mon Aug  5 13:22:15 2019        
(r350588)
@@ -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: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c Mon Aug  5 13:22:02 2019        (r350587)
+++ head/sys/netinet/sctp_pcb.c Mon Aug  5 13:22:15 2019        (r350588)
@@ -2845,7 +2845,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);
                                }
@@ -3643,8 +3643,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: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c      Mon Aug  5 13:22:02 2019        
(r350587)
+++ head/sys/netinet/sctp_usrreq.c      Mon Aug  5 13:22:15 2019        
(r350588)
@@ -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: head/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- head/sys/netinet6/sctp6_usrreq.c    Mon Aug  5 13:22:02 2019        
(r350587)
+++ head/sys/netinet6/sctp6_usrreq.c    Mon Aug  5 13:22:15 2019        
(r350588)
@@ -592,7 +592,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s
        }
        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:
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to