From 7c3d2e016a473c2c55c4bf073457dd1db7ae08de Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 11 Dec 2020 10:28:31 -0500 Subject: [PATCH] TT#105000 don't send STUN response in response to responses Change-Id: Ia45f96731a9b598c5e757848b5a70a3153c59266 --- daemon/stun.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/stun.c b/daemon/stun.c index 83580847d..63852a10f 100644 --- a/daemon/stun.c +++ b/daemon/stun.c @@ -630,11 +630,13 @@ int stun(const str *b, struct stream_fd *sfd, const endpoint_t *sin) { bad_req: ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "Received invalid STUN packet" SLF ": %s", SLP, err); - stun_error(sfd, sin, req, 400, "Bad request"); + if (class == STUN_CLASS_REQUEST) + stun_error(sfd, sin, req, 400, "Bad request"); return 0; unauth: ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "STUN authentication mismatch" SLF, SLP); - stun_error(sfd, sin, req, 401, "Unauthorized"); + if (class == STUN_CLASS_REQUEST) + stun_error(sfd, sin, req, 401, "Unauthorized"); return 0; ignore: ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "Not handling potential STUN packet" SLF ": %s", SLP, err);