Browse Source

TT#36759 rate limiting for ICE/STUN log messages

Change-Id: Iac172a52ac9a48d5ff62995454bda108680228d7
changes/91/21291/2
Richard Fuchs 8 years ago
parent
commit
9f3f24f3ef
2 changed files with 7 additions and 7 deletions
  1. +2
    -2
      daemon/ice.c
  2. +5
    -5
      daemon/stun.c

+ 2
- 2
daemon/ice.c View File

@ -1154,7 +1154,7 @@ int ice_request(struct stream_fd *sfd, const endpoint_t *src,
err_unlock: err_unlock:
mutex_unlock(&ag->lock); mutex_unlock(&ag->lock);
ilog(LOG_NOTICE, "%s (from %s on interface %s)", err, endpoint_print_buf(src),
ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "%s (from %s on interface %s)", err, endpoint_print_buf(src),
endpoint_print_buf(&sfd->socket.local)); endpoint_print_buf(&sfd->socket.local));
return 0; return 0;
} }
@ -1305,7 +1305,7 @@ err_unlock:
mutex_unlock(&ag->lock); mutex_unlock(&ag->lock);
err: err:
if (err) if (err)
ilog(LOG_NOTICE, "%s (from %s on interface %s)",
ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "%s (from %s on interface %s)",
err, endpoint_print_buf(src), endpoint_print_buf(&sfd->socket.local)); err, endpoint_print_buf(src), endpoint_print_buf(&sfd->socket.local));
if (pair && attrs->error_code) if (pair && attrs->error_code)


+ 5
- 5
daemon/stun.c View File

@ -227,7 +227,7 @@ static int stun_attributes(struct stun_attrs *out, str *s, u_int16_t *unknowns,
ilog(LOG_DEBUG, "Unknown STUN attribute: 0x%04x", type); ilog(LOG_DEBUG, "Unknown STUN attribute: 0x%04x", type);
break; break;
} }
ilog(LOG_NOTICE, "Unknown STUN attribute: 0x%04x", type);
ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "Unknown STUN attribute: 0x%04x", type);
unknowns[uc] = tlv->type; unknowns[uc] = tlv->type;
unknowns[++uc] = 0xffff; unknowns[++uc] = 0xffff;
if (uc >= UNKNOWNS_COUNT - 1) if (uc >= UNKNOWNS_COUNT - 1)
@ -583,7 +583,7 @@ int stun(const str *b, struct stream_fd *sfd, const endpoint_t *sin) {
err = "failed to parse attributes"; err = "failed to parse attributes";
if (unknowns[0] == 0xffff) if (unknowns[0] == 0xffff)
goto ignore; goto ignore;
ilog(LOG_WARNING, "STUN packet contained unknown "
ilog(LOG_WARNING | LOG_FLAG_LIMIT, "STUN packet contained unknown "
"\"comprehension required\" attribute(s)" SLF, SLP); "\"comprehension required\" attribute(s)" SLF, SLP);
stun_error_attrs(sfd, sin, req, 420, "Unknown attribute", stun_error_attrs(sfd, sin, req, 420, "Unknown attribute",
STUN_UNKNOWN_ATTRIBUTES, unknowns, STUN_UNKNOWN_ATTRIBUTES, unknowns,
@ -629,15 +629,15 @@ int stun(const str *b, struct stream_fd *sfd, const endpoint_t *sin) {
/* notreached */ /* notreached */
bad_req: bad_req:
ilog(LOG_NOTICE, "Received invalid STUN packet" SLF ": %s", SLP, err);
ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "Received invalid STUN packet" SLF ": %s", SLP, err);
stun_error(sfd, sin, req, 400, "Bad request"); stun_error(sfd, sin, req, 400, "Bad request");
return 0; return 0;
unauth: unauth:
ilog(LOG_NOTICE, "STUN authentication mismatch" SLF, SLP);
ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "STUN authentication mismatch" SLF, SLP);
stun_error(sfd, sin, req, 401, "Unauthorized"); stun_error(sfd, sin, req, 401, "Unauthorized");
return 0; return 0;
ignore: ignore:
ilog(LOG_NOTICE, "Not handling potential STUN packet" SLF ": %s", SLP, err);
ilog(LOG_NOTICE | LOG_FLAG_LIMIT, "Not handling potential STUN packet" SLF ": %s", SLP, err);
return -1; return -1;
} }


Loading…
Cancel
Save