SCTP: Use net_ratelimit to suppress error messages print too fast

When multi bundling SHUTDOWN-ACK message is received in ESTAB state,
this will cause "sctp protocol violation state" message print many times.
If SHUTDOWN-ACK is bundled 300 times in one packet, message will be
print 300 times. The same problem also exists when received unexpected
HEARTBEAT-ACK message which is bundled message times.

This patch used net_ratelimit() to suppress error messages print too fast.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
This commit is contained in:
Wei Yongjun 2007-08-27 11:19:24 +08:00 committed by Vlad Yasevich
parent 00f1c2df2a
commit d99fa42963
2 changed files with 17 additions and 14 deletions

View File

@ -1013,8 +1013,9 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
break; break;
case SCTP_DISPOSITION_VIOLATION: case SCTP_DISPOSITION_VIOLATION:
printk(KERN_ERR "sctp protocol violation state %d " if (net_ratelimit())
"chunkid %d\n", state, subtype.chunk); printk(KERN_ERR "sctp protocol violation state %d "
"chunkid %d\n", state, subtype.chunk);
break; break;
case SCTP_DISPOSITION_NOT_IMPL: case SCTP_DISPOSITION_NOT_IMPL:

View File

@ -1032,19 +1032,21 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
/* This should never happen, but lets log it if so. */ /* This should never happen, but lets log it if so. */
if (unlikely(!link)) { if (unlikely(!link)) {
if (from_addr.sa.sa_family == AF_INET6) { if (from_addr.sa.sa_family == AF_INET6) {
printk(KERN_WARNING if (net_ratelimit())
"%s association %p could not find address " printk(KERN_WARNING
NIP6_FMT "\n", "%s association %p could not find address "
__FUNCTION__, NIP6_FMT "\n",
asoc, __FUNCTION__,
NIP6(from_addr.v6.sin6_addr)); asoc,
NIP6(from_addr.v6.sin6_addr));
} else { } else {
printk(KERN_WARNING if (net_ratelimit())
"%s association %p could not find address " printk(KERN_WARNING
NIPQUAD_FMT "\n", "%s association %p could not find address "
__FUNCTION__, NIPQUAD_FMT "\n",
asoc, __FUNCTION__,
NIPQUAD(from_addr.v4.sin_addr.s_addr)); asoc,
NIPQUAD(from_addr.v4.sin_addr.s_addr));
} }
return SCTP_DISPOSITION_DISCARD; return SCTP_DISPOSITION_DISCARD;
} }