diff options
author | Toni <matzeton@googlemail.com> | 2022-04-25 13:00:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 13:00:50 +0200 |
commit | bc2ad3407a1cf7f6d2913f113df31dfbf735c6f6 (patch) | |
tree | a06e65f5d38238a894dea0415b2b6584cd027e4f /src/lib/protocols/ssdp.c | |
parent | 075bce5f3de463975464472158dca980a45f48a3 (diff) |
Added generic user agent setter. (#1530)
* ndpiReader: Print user agent if one was set and not just for certain protocols.
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/lib/protocols/ssdp.c')
-rw-r--r-- | src/lib/protocols/ssdp.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/protocols/ssdp.c b/src/lib/protocols/ssdp.c index cc2eb2f71..9fb1d0eae 100644 --- a/src/lib/protocols/ssdp.c +++ b/src/lib/protocols/ssdp.c @@ -38,13 +38,9 @@ static void ssdp_parse_lines(struct ndpi_detection_module_struct /* Save user-agent for device discovery if available */ if(packet->user_agent_line.ptr != NULL && packet->user_agent_line.len != 0) { - if(flow->http.user_agent == NULL) { - flow->http.user_agent = ndpi_malloc(packet->user_agent_line.len + 1); - if(flow->http.user_agent) { - memcpy(flow->http.user_agent, - (char*)packet->user_agent_line.ptr, packet->user_agent_line.len); - flow->http.user_agent[packet->user_agent_line.len] = '\0'; - } + if (ndpi_user_agent_set(flow, packet->user_agent_line.ptr, packet->user_agent_line.len) == NULL) + { + NDPI_LOG_DBG2(ndpi_struct, "Could not set SSDP user agent\n"); } } } |