svn commit: r252922 - stable/9/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sun Jul 7 11:10:16 UTC 2013


Author: tuexen
Date: Sun Jul  7 11:10:15 2013
New Revision: 252922
URL: http://svnweb.freebsd.org/changeset/base/252922

Log:
  MFC r238122:
  Use consistent method to determine IPV4_OUTPUT/IPV6_OUTPUT.

Modified:
  stable/9/sys/netinet/sctp_output.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/sctp_output.c
==============================================================================
--- stable/9/sys/netinet/sctp_output.c	Sun Jul  7 09:22:03 2013	(r252921)
+++ stable/9/sys/netinet/sctp_output.c	Sun Jul  7 11:10:15 2013	(r252922)
@@ -10981,8 +10981,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));
@@ -11016,10 +11017,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)
@@ -11046,8 +11047,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);


More information about the svn-src-stable-9 mailing list