svn commit: r252879 - in stable/9/sys: netinet netinet6

Michael Tuexen tuexen at FreeBSD.org
Sat Jul 6 09:04:57 UTC 2013


Author: tuexen
Date: Sat Jul  6 09:04:55 2013
New Revision: 252879
URL: http://svnweb.freebsd.org/changeset/base/252879

Log:
  MFC r237540:
  Do packet logging in a consistent way.

Modified:
  stable/9/sys/netinet/sctp_bsd_addr.c
  stable/9/sys/netinet/sctp_bsd_addr.h
  stable/9/sys/netinet/sctp_input.c
  stable/9/sys/netinet/sctp_os_bsd.h
  stable/9/sys/netinet/sctp_output.c
  stable/9/sys/netinet6/sctp6_usrreq.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- stable/9/sys/netinet/sctp_bsd_addr.c	Sat Jul  6 09:03:02 2013	(r252878)
+++ stable/9/sys/netinet/sctp_bsd_addr.c	Sat Jul  6 09:04:55 2013	(r252879)
@@ -422,11 +422,12 @@ sctp_get_mbuf_for_msg(unsigned int space
 
 #ifdef SCTP_PACKET_LOGGING
 void
-sctp_packet_log(struct mbuf *m, int length)
+sctp_packet_log(struct mbuf *m)
 {
 	int *lenat, thisone;
 	void *copyto;
 	uint32_t *tick_tock;
+	int length;
 	int total_len;
 	int grabbed_lock = 0;
 	int value, newval, thisend, thisbegin;
@@ -436,6 +437,7 @@ sctp_packet_log(struct mbuf *m, int leng
 	 * (value) -ticks of log      (ticks) o -ip packet o -as logged -
 	 * where this started (thisbegin) x <--end points here
 	 */
+	length = SCTP_HEADER_LEN(m);
 	total_len = SCTP_SIZE32((length + (4 * sizeof(int))));
 	/* Log a packet to the buffer. */
 	if (total_len > SCTP_PACKET_LOG_SIZE) {

Modified: stable/9/sys/netinet/sctp_bsd_addr.h
==============================================================================
--- stable/9/sys/netinet/sctp_bsd_addr.h	Sat Jul  6 09:03:02 2013	(r252878)
+++ stable/9/sys/netinet/sctp_bsd_addr.h	Sat Jul  6 09:04:55 2013	(r252879)
@@ -53,7 +53,7 @@ void sctp_gather_internal_ifa_flags(stru
 
 #ifdef  SCTP_PACKET_LOGGING
 
-void sctp_packet_log(struct mbuf *m, int length);
+void sctp_packet_log(struct mbuf *m);
 int sctp_copy_out_packet_log(uint8_t * target, int length);
 
 #endif

Modified: stable/9/sys/netinet/sctp_input.c
==============================================================================
--- stable/9/sys/netinet/sctp_input.c	Sat Jul  6 09:03:02 2013	(r252878)
+++ stable/9/sys/netinet/sctp_input.c	Sat Jul  6 09:04:55 2013	(r252879)
@@ -5930,9 +5930,9 @@ sctp_input_with_port(struct mbuf *i_pak,
 		}
 	}
 #endif
-#ifdef  SCTP_PACKET_LOGGING
+#ifdef SCTP_PACKET_LOGGING
 	if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
-		sctp_packet_log(m, mlen);
+		sctp_packet_log(m);
 #endif
 	if (m->m_flags & M_FLOWID) {
 		mflowid = m->m_pkthdr.flowid;

Modified: stable/9/sys/netinet/sctp_os_bsd.h
==============================================================================
--- stable/9/sys/netinet/sctp_os_bsd.h	Sat Jul  6 09:03:02 2013	(r252878)
+++ stable/9/sys/netinet/sctp_os_bsd.h	Sat Jul  6 09:04:55 2013	(r252879)
@@ -365,7 +365,7 @@ typedef struct callout sctp_os_timer_t;
  */
 #define SCTP_HEADER_TO_CHAIN(m) (m)
 #define SCTP_DETACH_HEADER_FROM_CHAIN(m)
-#define SCTP_HEADER_LEN(m) (m->m_pkthdr.len)
+#define SCTP_HEADER_LEN(m) ((m)->m_pkthdr.len)
 #define SCTP_GET_HEADER_FOR_OUTPUT(o_pak) 0
 #define SCTP_RELEASE_HEADER(m)
 #define SCTP_RELEASE_PKT(m)	sctp_m_freem(m)

Modified: stable/9/sys/netinet/sctp_output.c
==============================================================================
--- stable/9/sys/netinet/sctp_output.c	Sat Jul  6 09:03:02 2013	(r252878)
+++ stable/9/sys/netinet/sctp_output.c	Sat Jul  6 09:04:55 2013	(r252879)
@@ -4114,10 +4114,6 @@ sctp_lowlevel_chunk_output(struct sctp_i
 				sctp_m_freem(m);
 				return (ENOMEM);
 			}
-#ifdef  SCTP_PACKET_LOGGING
-			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
-				sctp_packet_log(m, packet_length);
-#endif
 			SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
 			if (port) {
 #if defined(SCTP_WITH_NO_CSUM)
@@ -4138,6 +4134,10 @@ sctp_lowlevel_chunk_output(struct sctp_i
 				SCTP_STAT_INCR(sctps_sendhwcrc);
 #endif
 			}
+#ifdef SCTP_PACKET_LOGGING
+			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
+				sctp_packet_log(o_pak);
+#endif
 			/* send it out.  table id is taken from stcb */
 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
 			if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) {
@@ -4463,10 +4463,6 @@ sctp_lowlevel_chunk_output(struct sctp_i
 				SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
 				return (ENOMEM);
 			}
-#ifdef  SCTP_PACKET_LOGGING
-			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
-				sctp_packet_log(m, packet_length);
-#endif
 			SCTP_ATTACH_CHAIN(o_pak, m, packet_length);
 			if (port) {
 #if defined(SCTP_WITH_NO_CSUM)
@@ -4494,6 +4490,10 @@ sctp_lowlevel_chunk_output(struct sctp_i
 				SCTP_SOCKET_UNLOCK(so, 0);
 			}
 #endif
+#ifdef SCTP_PACKET_LOGGING
+			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
+				sctp_packet_log(o_pak);
+#endif
 			SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id);
 #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
 			if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) {
@@ -11068,11 +11068,6 @@ sctp_send_resp_msg(struct mbuf *m, struc
 			}
 		}
 		iph_out->ip_len = len;
-#ifdef SCTP_PACKET_LOGGING
-		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
-			sctp_packet_log(mout, len);
-		}
-#endif
 		if (port) {
 #if defined(SCTP_WITH_NO_CSUM)
 			SCTP_STAT_INCR(sctps_sendnocrc);
@@ -11092,17 +11087,17 @@ sctp_send_resp_msg(struct mbuf *m, struc
 			SCTP_STAT_INCR(sctps_sendhwcrc);
 #endif
 		}
+#ifdef SCTP_PACKET_LOGGING
+		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
+			sctp_packet_log(o_pak);
+		}
+#endif
 		SCTP_IP_OUTPUT(ret, o_pak, NULL, NULL, vrf_id);
 	}
 #endif
 #ifdef INET6
 	if (ip6_out != NULL) {
 		ip6_out->ip6_plen = len - sizeof(struct ip6_hdr);
-#ifdef  SCTP_PACKET_LOGGING
-		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
-			sctp_packet_log(mout, len);
-		}
-#endif
 		if (port) {
 #if defined(SCTP_WITH_NO_CSUM)
 			SCTP_STAT_INCR(sctps_sendnocrc);
@@ -11122,6 +11117,11 @@ sctp_send_resp_msg(struct mbuf *m, struc
 			SCTP_STAT_INCR(sctps_sendhwcrc);
 #endif
 		}
+#ifdef SCTP_PACKET_LOGGING
+		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
+			sctp_packet_log(o_pak);
+		}
+#endif
 		SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id);
 	}
 #endif

Modified: stable/9/sys/netinet6/sctp6_usrreq.c
==============================================================================
--- stable/9/sys/netinet6/sctp6_usrreq.c	Sat Jul  6 09:03:02 2013	(r252878)
+++ stable/9/sys/netinet6/sctp6_usrreq.c	Sat Jul  6 09:04:55 2013	(r252879)
@@ -101,10 +101,12 @@ sctp6_input(struct mbuf **i_pak, int *of
 		return (-1);
 	}
 	m = SCTP_HEADER_TO_CHAIN(*i_pak);
-	pkt_len = SCTP_HEADER_LEN((*i_pak));
+	pkt_len = SCTP_HEADER_LEN(*i_pak);
 
-#ifdef  SCTP_PACKET_LOGGING
-	sctp_packet_log(m, pkt_len);
+#ifdef SCTP_PACKET_LOGGING
+	if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
+		sctp_packet_log(m);
+	}
 #endif
 	if (m->m_flags & M_FLOWID) {
 		mflowid = m->m_pkthdr.flowid;


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