Author: tuexen
Date: Wed Jul  4 20:59:30 2012
New Revision: 238122
URL: http://svn.freebsd.org/changeset/base/238122

Log:
  Use consistent method to determine IPV4_OUTPUT/IPV6_OUTPUT.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c      Wed Jul  4 20:29:16 2012        
(r238121)
+++ head/sys/netinet/sctp_output.c      Wed Jul  4 20:59:30 2012        
(r238122)
@@ -10971,8 +10971,9 @@ sctp_send_resp_msg(struct sockaddr *src,
                return;
        }
        SCTP_ATTACH_CHAIN(o_pak, mout, len);
+       switch (dst->sa_family) {
 #ifdef INET
-       if (ip != NULL) {
+       case AF_INET:
                if (port) {
                        if (V_udp_cksum) {
                                udp->uh_sum = in_pseudo(ip->ip_src.s_addr, 
ip->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP));
@@ -11006,10 +11007,10 @@ sctp_send_resp_msg(struct sockaddr *src,
                }
 #endif
                SCTP_IP_OUTPUT(ret, o_pak, NULL, NULL, vrf_id);
-       }
+               break;
 #endif
 #ifdef INET6
-       if (ip6 != NULL) {
+       case AF_INET6:
                ip6->ip6_plen = len - sizeof(struct ip6_hdr);
                if (port) {
 #if defined(SCTP_WITH_NO_CSUM)
@@ -11036,8 +11037,15 @@ sctp_send_resp_msg(struct sockaddr *src,
                }
 #endif
                SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id);
-       }
+               break;
 #endif
+       default:
+               SCTPDBG(SCTP_DEBUG_OUTPUT1, "Unknown protocol (TSNH) type %d\n",
+                   dst->sa_family);
+               sctp_m_freem(mout);
+               SCTP_LTRACE_ERR_RET_PKT(mout, NULL, NULL, NULL, 
SCTP_FROM_SCTP_OUTPUT, EFAULT);
+               return;
+       }
        SCTP_STAT_INCR(sctps_sendpackets);
        SCTP_STAT_INCR_COUNTER64(sctps_outpackets);
        SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to