From 92a1ee9a7d8844bf255ea2e9ccce55c9cf6608db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Fri, 8 May 2020 16:25:43 +0200 Subject: [PATCH] upnpstun.c: Parse more fields from STUN packet These fields are sent by e.g. stun.ekiga.net --- miniupnpd/upnpstun.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/miniupnpd/upnpstun.c b/miniupnpd/upnpstun.c index 557a33e..5165765 100644 --- a/miniupnpd/upnpstun.c +++ b/miniupnpd/upnpstun.c @@ -352,16 +352,23 @@ static int parse_stun_response(unsigned char *buffer, size_t len, struct sockadd attr_len - 4, ptr + 4); } break; + case 0x0004: /* SOURCE-ADDRESS (RFC 3489) */ + case 0x0005: /* CHANGED-ADDRESS (RFC 3489) */ case 0x802b: /* RESPONSE-ORIGIN (RFC 5780) */ case 0x802c: /* OTHER-ADDRESS (RFC 5780) */ if (attr_len == 8 && ptr[1] == 1) { syslog(LOG_DEBUG, "%s: %s %hhu.%hhu.%hhu.%hhu:%hu", "parse_stun_response", + (attr_type == 0x0004) ? "SOURCE-ADDRESS" : + (attr_type == 0x0005) ? "CHANGED-ADDRESS" : (attr_type == 0x802b) ? "RESPONSE-ORIGIN" : "OTHER-ADDRESS", ptr[4], ptr[5], ptr[6], ptr[7], (uint16_t)((ptr[2] << 8) + ptr[3])); } break; + case 0x8022: /* SOFTWARE (RFC 5780) */ + syslog(LOG_DEBUG, "%s: SOFTWARE %.*s", "parse_stun_response", attr_len, ptr); + break; default: syslog(LOG_WARNING, "%s: unknown attribute type 0x%04x (len=%hu)", "parse_stun_response", attr_type, attr_len);