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>

authored by Wei Yongjun and committed by Vlad Yasevich d99fa429 00f1c2df

+17 -14
+3 -2
net/sctp/sm_sideeffect.c
··· 1013 break; 1014 1015 case SCTP_DISPOSITION_VIOLATION: 1016 - printk(KERN_ERR "sctp protocol violation state %d " 1017 - "chunkid %d\n", state, subtype.chunk); 1018 break; 1019 1020 case SCTP_DISPOSITION_NOT_IMPL:
··· 1013 break; 1014 1015 case SCTP_DISPOSITION_VIOLATION: 1016 + if (net_ratelimit()) 1017 + printk(KERN_ERR "sctp protocol violation state %d " 1018 + "chunkid %d\n", state, subtype.chunk); 1019 break; 1020 1021 case SCTP_DISPOSITION_NOT_IMPL:
+14 -12
net/sctp/sm_statefuns.c
··· 1032 /* This should never happen, but lets log it if so. */ 1033 if (unlikely(!link)) { 1034 if (from_addr.sa.sa_family == AF_INET6) { 1035 - printk(KERN_WARNING 1036 - "%s association %p could not find address " 1037 - NIP6_FMT "\n", 1038 - __FUNCTION__, 1039 - asoc, 1040 - NIP6(from_addr.v6.sin6_addr)); 1041 } else { 1042 - printk(KERN_WARNING 1043 - "%s association %p could not find address " 1044 - NIPQUAD_FMT "\n", 1045 - __FUNCTION__, 1046 - asoc, 1047 - NIPQUAD(from_addr.v4.sin_addr.s_addr)); 1048 } 1049 return SCTP_DISPOSITION_DISCARD; 1050 }
··· 1032 /* This should never happen, but lets log it if so. */ 1033 if (unlikely(!link)) { 1034 if (from_addr.sa.sa_family == AF_INET6) { 1035 + if (net_ratelimit()) 1036 + printk(KERN_WARNING 1037 + "%s association %p could not find address " 1038 + NIP6_FMT "\n", 1039 + __FUNCTION__, 1040 + asoc, 1041 + NIP6(from_addr.v6.sin6_addr)); 1042 } else { 1043 + if (net_ratelimit()) 1044 + printk(KERN_WARNING 1045 + "%s association %p could not find address " 1046 + NIPQUAD_FMT "\n", 1047 + __FUNCTION__, 1048 + asoc, 1049 + NIPQUAD(from_addr.v4.sin_addr.s_addr)); 1050 } 1051 return SCTP_DISPOSITION_DISCARD; 1052 }