Closed Bug 830146 Opened 11 years ago Closed 11 years ago

Add logging for SCTP packets

Categories

(Core :: WebRTC: Networking, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: tuexen, Assigned: jesup)

References

Details

(Whiteboard: [WebRTC], [blocking-webrtc-], [qa-])

Attachments

(1 file, 2 obsolete files)

Attached file Patch implementing SCTP logging (obsolete) —
The attached patch adds a logging module called SCTP.
When using
SCTP:1
in NSPR_LOG_MODULES, all SCTP packets will be written to NSPR_LOG_FILE
in a way that
grep NSPR_LOG_FILE SCTP_PACKET | text2pcap -n -D -t '%H:%M:%S.' -l 248 - dumpfile.pcapng
will write a pcapng file, which can be read with wireshark. I will include the correct
time and whether the packet was received or sent by Firefox.
You need a recent developer version of wireshark and text2pcap.

When using
SCTP:4
in NSPR_LOG_MODULES, the SCTP debug output will be written to stdout, like it is done
currently when using
DataChannel:6
in NSPR_LOG_MODULES. A future patch will ensure that the debug output is also written to
NSPR_LOG_FILE.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [WebRTC], [blocking-webrtc-]
Attachment #701607 - Flags: review?(rjesup)
This patch also fixes the bug that SCTP logging was not saved in NSPR_LOG_FILE if set, but was written to stdout.
Attachment #701607 - Attachment is obsolete: true
Attachment #701607 - Flags: review?(rjesup)
Attachment #704105 - Flags: review?
Attachment #704105 - Flags: review? → review?(rjesup)
Comment on attachment 704105 [details]
Updated patch implementing SCTP logging

I'm don't think vsnprintf() is available on VS2010 or VS2008 (maybe not even VS2012).  See bug 554664, which is why we have internal functions the equivalent to them.  There are lots of "workaround snprintf" hacks in the tree; see media/webrtc/signaling for one set.

-        usrsctp_init(0, DataChannelConnection::SctpDtlsOutput);
+#ifdef PR_LOGGING
+        usrsctp_init(0, DataChannelConnection::SctpDtlsOutput, debug_printf);
+#else
+        usrsctp_init(0, DataChannelConnection::SctpDtlsOutput, nullptr);
+#endif

Please put just the argument in the #ifdef (repeat for a few of the other mods)

I'd prefer debugs on lower log levels, and packet dumps as the "higher" option.  If you need to dump without logs, have 1 be logs, 3 be packetdump, and 5 be both.  Or separate them.

r? to mcmanus as well (when you update the patch, please r? to him as well).
Attachment #704105 - Flags: review?(rjesup)
Attachment #704105 - Flags: review?(mcmanus)
Attachment #704105 - Flags: review-
This patch addresses Randell's comments:
* it uses vsnprintf_s() on Windows. Please note that I think the buffer is
  always zero terminated (at least on c99 and on Windows according to the
  documentation). Therefore I'm not adding a zero at the end as it is done
  in media/webrtc/signalling/src/common/csf_common.h
  If you want that added, I can add code...
* Only the argument is now #ifdef'ed as requested.
* My understanding was that higher NSPR loglevels include lower levels. The
  suggested values don't fit into this. So I changed the code to provide
  SCTP log messages when using PR_LOG_ALWAYS and dump packets when using
  PR_LOG_DEBUG. One can use grep SCTP_PACKET to extract the packets.
  My usage scenario might be different: Whenever I look at a problem related
  to SCTP or any of its upper layers, I start looking at a wireshark trace.
  So we are using SCTP:1,DataChannel:4 when trying to analyze problems with
  the data channel protocol. But I can live with the other settings (using
  grep SCTP_PACKET for the wireshark trace and ignoring the SCTP debug output),
  I guess my usage is a bit special.
Attachment #704205 - Flags: review?
Attachment #704205 - Flags: review?(rjesup)
Attachment #704205 - Flags: review?(bugmoz)
Attachment #704205 - Flags: review?
Attachment #704205 - Flags: review?(bugmoz) → review?(mcmanus)
Attachment #704105 - Flags: review?(mcmanus)
Attachment #704205 - Attachment is patch: true
Attachment #704105 - Attachment is obsolete: true
Comment on attachment 704205 [details] [diff] [review]
Updated patch addressing Randell's comments

Review of attachment 704205 [details] [diff] [review]:
-----------------------------------------------------------------

this is cool.
Attachment #704205 - Flags: review?(mcmanus) → review+
Attachment #704205 - Flags: review?(rjesup) → review+
Attachment #704205 - Flags: checkin?(rjesup)
Attachment #704205 - Flags: checkin?(rjesup) → checkin+
https://hg.mozilla.org/mozilla-central/rev/89390ab03128
Assignee: nobody → rjesup
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [WebRTC], [blocking-webrtc-] → [WebRTC], [blocking-webrtc-], [qa-]
Depends on: 869299
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: