Skip to content

Commit

Permalink
Dump malformed packets to trace, optionally to log
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Boasson <eb@ilities.com>
  • Loading branch information
eboasson committed Mar 22, 2024
1 parent d8f972f commit a95263f
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 36 deletions.
17 changes: 13 additions & 4 deletions docs/manual/config/config_file_reference.rst
Expand Up @@ -2591,7 +2591,7 @@ The default value is: ``false``
------------------------------------

One of:
* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, shm, trace
* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, malformed, trace
* Or empty

This element enables individual logging categories. These are enabled in addition to those enabled by Tracing/Verbosity. Recognised categories are:
Expand All @@ -2616,16 +2616,25 @@ This element enables individual logging categories. These are enabled in additio

* traffic: periodic reporting of total outgoing data

* throttle: tracing of throttling events

* whc: tracing of writer history cache changes

* rhc: tracing of reader history cache changes

* tcp: tracing of TCP-specific activity

* topic: tracing of topic definitions

* plist: tracing of discovery parameter list interpretation

* content: tracing of sample contents

* malformed: dump malformed full packet as warning



In addition, there is the keyword trace that enables all but radmin, topic, plist and whc.
In addition, there is the keyword trace that enables: fatal, error, warning, info, config, discovery, data, trace, timing, traffic, tcp, throttle, content..
The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is trace.

The default value is: ``<empty>``
Expand Down Expand Up @@ -2689,8 +2698,8 @@ The default value is: ``none``
..
generated from ddsi_config.h[6ffac6c47b890235276d70092a3c4c67d39ecb9e]
generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa]
generated from ddsi__cfgelems.h[5a1d209ad4154846ecba5c55c4a8e6efa6419d15]
generated from ddsi_config.c[0a59324bd889637ea7d04765da9b76bbe74997c1]
generated from ddsi__cfgelems.h[0cb58370775b404955d589e41627aa7046b44a41]
generated from ddsi_config.c[c2d649fd4c5f8502d4c3bb124e5f7f7728257fa1]
generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc]
generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65]
generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934]
Expand Down
17 changes: 13 additions & 4 deletions docs/manual/options.md
Expand Up @@ -1801,7 +1801,7 @@ The default value is: `false`

#### //CycloneDDS/Domain/Tracing/Category
One of:
* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, shm, trace
* Comma-separated list of: fatal, error, warning, info, config, discovery, data, radmin, timing, traffic, topic, tcp, plist, whc, throttle, rhc, content, malformed, trace
* Or empty

This element enables individual logging categories. These are enabled in addition to those enabled by Tracing/Verbosity. Recognised categories are:
Expand All @@ -1826,15 +1826,24 @@ This element enables individual logging categories. These are enabled in additio

* traffic: periodic reporting of total outgoing data

* throttle: tracing of throttling events

* whc: tracing of writer history cache changes

* rhc: tracing of reader history cache changes

* tcp: tracing of TCP-specific activity

* topic: tracing of topic definitions

* plist: tracing of discovery parameter list interpretation

In addition, there is the keyword trace that enables all but radmin, topic, plist and whc.
* content: tracing of sample contents

* malformed: dump malformed full packet as warning


In addition, there is the keyword trace that enables: fatal, error, warning, info, config, discovery, data, trace, timing, traffic, tcp, throttle, content..
The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is trace.

The default value is: `<empty>`
Expand Down Expand Up @@ -1883,8 +1892,8 @@ The categorisation of tracing output is incomplete and hence most of the verbosi
The default value is: `none`
<!--- generated from ddsi_config.h[6ffac6c47b890235276d70092a3c4c67d39ecb9e] -->
<!--- generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] -->
<!--- generated from ddsi__cfgelems.h[5a1d209ad4154846ecba5c55c4a8e6efa6419d15] -->
<!--- generated from ddsi_config.c[0a59324bd889637ea7d04765da9b76bbe74997c1] -->
<!--- generated from ddsi__cfgelems.h[0cb58370775b404955d589e41627aa7046b44a41] -->
<!--- generated from ddsi_config.c[c2d649fd4c5f8502d4c3bb124e5f7f7728257fa1] -->
<!--- generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] -->
<!--- generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] -->
<!--- generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934] -->
Expand Down
15 changes: 10 additions & 5 deletions etc/cyclonedds.rnc
Expand Up @@ -1258,15 +1258,20 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==<br>
<li><i>radmin</i>: receive buffer administration</li>
<li><i>timing</i>: periodic reporting of CPU loads per thread</li>
<li><i>traffic</i>: periodic reporting of total outgoing data</li>
<li><i>throttle</i>: tracing of throttling events</li>
<li><i>whc</i>: tracing of writer history cache changes</li>
<li><i>rhc</i>: tracing of reader history cache changes</li>
<li><i>tcp</i>: tracing of TCP-specific activity</li>
<li><i>topic</i>: tracing of topic definitions</li>
<li><i>plist</i>: tracing of discovery parameter list interpretation</li></ul>
<p>In addition, there is the keyword <i>trace</i> that enables all but <i>radmin</i>, <i>topic</i>, <i>plist</i> and <i>whc</i></p>.
<li><i>plist</i>: tracing of discovery parameter list interpretation</li>
<li><i>content</i>: tracing of sample contents</li>
<li><i>malformed</i>: dump malformed full packet as warning</li>
</ul>
<p>In addition, there is the keyword <i>trace</i> that enables: <i>fatal</i>, <i>error</i>, <i>warning</i>, <i>info</i>, <i>config</i>, <i>discovery</i>, <i>data</i>, <i>trace</i>, <i>timing</i>, <i>traffic</i>, <i>tcp</i>, <i>throttle</i>, <i>content</i>.</p>.
<p>The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is <i>trace</i>.</p>
<p>The default value is: <code>&lt;empty&gt;</code></p>""" ] ]
element Category {
xsd:token { pattern = "((fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|shm|trace)(,(fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|shm|trace))*)|" }
xsd:token { pattern = "((fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|malformed|trace)(,(fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|malformed|trace))*)|" }
}?
& [ a:documentation [ xml:lang="en" """
<p>This option specifies where the logging is printed to. Note that <i>stdout</i> and <i>stderr</i> are treated as special values, representing "standard out" and "standard error" respectively. No file is created unless logging categories are enabled using the Tracing/Verbosity or Tracing/EnabledCategory settings.</p>
Expand Down Expand Up @@ -1306,8 +1311,8 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==<br>
}
# generated from ddsi_config.h[6ffac6c47b890235276d70092a3c4c67d39ecb9e]
# generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa]
# generated from ddsi__cfgelems.h[5a1d209ad4154846ecba5c55c4a8e6efa6419d15]
# generated from ddsi_config.c[0a59324bd889637ea7d04765da9b76bbe74997c1]
# generated from ddsi__cfgelems.h[0cb58370775b404955d589e41627aa7046b44a41]
# generated from ddsi_config.c[c2d649fd4c5f8502d4c3bb124e5f7f7728257fa1]
# generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc]
# generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65]
# generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934]
Expand Down
15 changes: 10 additions & 5 deletions etc/cyclonedds.xsd
Expand Up @@ -1884,17 +1884,22 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==&lt;br&gt;
&lt;li&gt;&lt;i&gt;radmin&lt;/i&gt;: receive buffer administration&lt;/li&gt;
&lt;li&gt;&lt;i&gt;timing&lt;/i&gt;: periodic reporting of CPU loads per thread&lt;/li&gt;
&lt;li&gt;&lt;i&gt;traffic&lt;/i&gt;: periodic reporting of total outgoing data&lt;/li&gt;
&lt;li&gt;&lt;i&gt;throttle&lt;/i&gt;: tracing of throttling events&lt;/li&gt;
&lt;li&gt;&lt;i&gt;whc&lt;/i&gt;: tracing of writer history cache changes&lt;/li&gt;
&lt;li&gt;&lt;i&gt;rhc&lt;/i&gt;: tracing of reader history cache changes&lt;/li&gt;
&lt;li&gt;&lt;i&gt;tcp&lt;/i&gt;: tracing of TCP-specific activity&lt;/li&gt;
&lt;li&gt;&lt;i&gt;topic&lt;/i&gt;: tracing of topic definitions&lt;/li&gt;
&lt;li&gt;&lt;i&gt;plist&lt;/i&gt;: tracing of discovery parameter list interpretation&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In addition, there is the keyword &lt;i&gt;trace&lt;/i&gt; that enables all but &lt;i&gt;radmin&lt;/i&gt;, &lt;i&gt;topic&lt;/i&gt;, &lt;i&gt;plist&lt;/i&gt; and &lt;i&gt;whc&lt;/i&gt;&lt;/p&gt;.
&lt;li&gt;&lt;i&gt;plist&lt;/i&gt;: tracing of discovery parameter list interpretation&lt;/li&gt;
&lt;li&gt;&lt;i&gt;content&lt;/i&gt;: tracing of sample contents&lt;/li&gt;
&lt;li&gt;&lt;i&gt;malformed&lt;/i&gt;: dump malformed full packet as warning&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition, there is the keyword &lt;i&gt;trace&lt;/i&gt; that enables: &lt;i&gt;fatal&lt;/i&gt;, &lt;i&gt;error&lt;/i&gt;, &lt;i&gt;warning&lt;/i&gt;, &lt;i&gt;info&lt;/i&gt;, &lt;i&gt;config&lt;/i&gt;, &lt;i&gt;discovery&lt;/i&gt;, &lt;i&gt;data&lt;/i&gt;, &lt;i&gt;trace&lt;/i&gt;, &lt;i&gt;timing&lt;/i&gt;, &lt;i&gt;traffic&lt;/i&gt;, &lt;i&gt;tcp&lt;/i&gt;, &lt;i&gt;throttle&lt;/i&gt;, &lt;i&gt;content&lt;/i&gt;.&lt;/p&gt;.
&lt;p&gt;The categorisation of tracing output is incomplete and hence most of the verbosity levels and categories are not of much use in the current release. This is an ongoing process and here we describe the target situation rather than the current situation. Currently, the most useful is &lt;i&gt;trace&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;The default value is: &lt;code&gt;&amp;lt;empty&amp;gt;&lt;/code&gt;&lt;/p&gt;</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:pattern value="((fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|shm|trace)(,(fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|shm|trace))*)|"/>
<xs:pattern value="((fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|malformed|trace)(,(fatal|error|warning|info|config|discovery|data|radmin|timing|traffic|topic|tcp|plist|whc|throttle|rhc|content|malformed|trace))*)|"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Expand Down Expand Up @@ -1964,8 +1969,8 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==&lt;br&gt;
</xs:schema>
<!--- generated from ddsi_config.h[6ffac6c47b890235276d70092a3c4c67d39ecb9e] -->
<!--- generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] -->
<!--- generated from ddsi__cfgelems.h[5a1d209ad4154846ecba5c55c4a8e6efa6419d15] -->
<!--- generated from ddsi_config.c[0a59324bd889637ea7d04765da9b76bbe74997c1] -->
<!--- generated from ddsi__cfgelems.h[0cb58370775b404955d589e41627aa7046b44a41] -->
<!--- generated from ddsi_config.c[c2d649fd4c5f8502d4c3bb124e5f7f7728257fa1] -->
<!--- generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] -->
<!--- generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] -->
<!--- generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934] -->
Expand Down
4 changes: 2 additions & 2 deletions src/core/ddsi/defconfig.c
Expand Up @@ -101,8 +101,8 @@ void ddsi_config_init_default (struct ddsi_config *cfg)
}
/* generated from ddsi_config.h[6ffac6c47b890235276d70092a3c4c67d39ecb9e] */
/* generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] */
/* generated from ddsi__cfgelems.h[5a1d209ad4154846ecba5c55c4a8e6efa6419d15] */
/* generated from ddsi_config.c[0a59324bd889637ea7d04765da9b76bbe74997c1] */
/* generated from ddsi__cfgelems.h[0cb58370775b404955d589e41627aa7046b44a41] */
/* generated from ddsi_config.c[c2d649fd4c5f8502d4c3bb124e5f7f7728257fa1] */
/* generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] */
/* generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] */
/* generated from generate_rnc.c[b50e4b7ab1d04b2bc1d361a0811247c337b74934] */
Expand Down
14 changes: 10 additions & 4 deletions src/core/ddsi/src/ddsi__cfgelems.h
Expand Up @@ -2005,13 +2005,19 @@ static struct cfgelem tracing_cfgelems[] = {
"<li><i>radmin</i>: receive buffer administration</li>\n"
"<li><i>timing</i>: periodic reporting of CPU loads per thread</li>\n"
"<li><i>traffic</i>: periodic reporting of total outgoing data</li>\n"
"<li><i>throttle</i>: tracing of throttling events</li>\n"
"<li><i>whc</i>: tracing of writer history cache changes</li>\n"
"<li><i>rhc</i>: tracing of reader history cache changes</li>\n"
"<li><i>tcp</i>: tracing of TCP-specific activity</li>\n"
"<li><i>topic</i>: tracing of topic definitions</li>\n"
"<li><i>plist</i>: tracing of discovery parameter list interpretation</li>"
"<li><i>plist</i>: tracing of discovery parameter list interpretation</li>\n"
"<li><i>content</i>: tracing of sample contents</li>\n"
"<li><i>malformed</i>: dump malformed full packet as warning</li>\n"
"</ul>\n"
"<p>In addition, there is the keyword <i>trace</i> that enables all "
"but <i>radmin</i>, <i>topic</i>, <i>plist</i> and <i>whc</i></p>.\n"
"<p>In addition, there is the keyword <i>trace</i> that enables: "
"<i>fatal</i>, <i>error</i>, <i>warning</i>, <i>info</i>, <i>config</i>, "
"<i>discovery</i>, <i>data</i>, <i>trace</i>, <i>timing</i>, <i>traffic</i>, "
"<i>tcp</i>, <i>throttle</i>, <i>content</i>.</p>.\n"
"<p>The categorisation of tracing output is incomplete and hence most "
"of the verbosity levels and categories are not of much use in the "
"current release. This is an ongoing process and here we describe the "
Expand All @@ -2020,7 +2026,7 @@ static struct cfgelem tracing_cfgelems[] = {
VALUES(
"fatal","error","warning","info","config","discovery","data","radmin",
"timing","traffic","topic","tcp","plist","whc","throttle","rhc",
"content","shm","trace"
"content","malformed","trace"
)),
ENUM("Verbosity", NULL, 1, "none",
NOMEMBER,
Expand Down
4 changes: 2 additions & 2 deletions src/core/ddsi/src/ddsi_config.c
Expand Up @@ -1007,10 +1007,10 @@ GENERIC_ENUM_CTYPE (shm_loglevel, enum ddsi_shm_loglevel)

/* "trace" is special: it enables (nearly) everything */
static const char *tracemask_names[] = {
"fatal", "error", "warning", "info", "config", "discovery", "data", "radmin", "timing", "traffic", "topic", "tcp", "plist", "whc", "throttle", "rhc", "content", "trace", NULL
"fatal", "error", "warning", "info", "config", "discovery", "data", "radmin", "timing", "traffic", "topic", "tcp", "plist", "whc", "throttle", "rhc", "content", "malformed", "trace", NULL
};
static const uint32_t tracemask_codes[] = {
DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING, DDS_LC_INFO, DDS_LC_CONFIG, DDS_LC_DISCOVERY, DDS_LC_DATA, DDS_LC_RADMIN, DDS_LC_TIMING, DDS_LC_TRAFFIC, DDS_LC_TOPIC, DDS_LC_TCP, DDS_LC_PLIST, DDS_LC_WHC, DDS_LC_THROTTLE, DDS_LC_RHC, DDS_LC_CONTENT, DDS_LC_ALL
DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING, DDS_LC_INFO, DDS_LC_CONFIG, DDS_LC_DISCOVERY, DDS_LC_DATA, DDS_LC_RADMIN, DDS_LC_TIMING, DDS_LC_TRAFFIC, DDS_LC_TOPIC, DDS_LC_TCP, DDS_LC_PLIST, DDS_LC_WHC, DDS_LC_THROTTLE, DDS_LC_RHC, DDS_LC_CONTENT, DDS_LC_MALFORMED, DDS_LC_ALL
};

static enum update_result uf_tracemask (struct ddsi_cfgst *cfgst, UNUSED_ARG (void *parent), UNUSED_ARG (struct cfgelem const * const cfgelem), UNUSED_ARG (int first), const char *value)
Expand Down

0 comments on commit a95263f

Please sign in to comment.