【现象】
view source
print?
1.Limiting open port RST response from 28 to 10 packets/sec
2.Limiting open port RST response from 28 to 10 packets/sec
3.Limiting open port RST response from 27 to 10 packets/sec
4.Limiting open port RST response from 29 to 10 packets/sec
5.Limiting open port RST response from 18 to 10 packets/sec
6.Limiting open port RST response from 84 to 10 packets/sec
涉及具体的代码如下:
view source
print?
01./*
02. * badport_bandlim() - check for ICMP bandwidth limit
03. *
04. * Return 0 if it is ok to send an ICMP error response, -1 if we have
05. * hit our bandwidth limit and it is not ok.
06. *
07. * If icmplim is <= 0, the feature is disabled and 0 is returned.
08. *
09. * For now we separate the TCP and UDP subsystems w/ different 'which'
10. * values. We may eventually remove this separation (and simplify the
11. * code further).
12. *
13. * Note that the printing of the error message is delayed so we can
14. * properly print the icmp error rate that the system was trying to do
15. * (i.e. 22000/100 pps, etc...). This can cause long delays in printing
16. * the 'final' error, but it doesn't make sense to solve the printing
17. * delay with more complex code.
18. */
19.
20.int
21.badport_bandlim(int which)
22.{
23. static int lticks[BANDLIM_MAX + 1];
24. static int lpackets[BANDLIM_MAX + 1];
25. int dticks;
26. const char *bandlimittype[] = {
27. "Limiting icmp unreach response",
28. "Limiting icmp ping response",
29. "Limiting icmp tstamp response",
30. "Limiting closed port RST response",
31. "Limiting open port RST response"
32. };
33.
34. /*
35. * Return ok status if feature disabled or argument out of
36. * ranage.
37. */
38.
39. if (icmplim <= 0 || which > BANDLIM_MAX || which < 0)
40. return(0);
41. dticks = ticks - lticks[which];
42.
43. /*
44. * reset stats when cumulative dt exceeds one second.
45. */
46.
47. if ((unsigned int)dticks > hz) {
48. if (lpackets[which] > icmplim && icmplim_output) {
49. printf("%s from %d to %d packets per second\n",
50. bandlimittype[which],
51. lpackets[which],
52. icmplim
53. );
54. }
55. lticks[which] = ticks;
56. lpackets[which] = 0;
57. }
58.
59. /*
60. * bump packet count .bump means add
61. */
62.
63. if (++lpackets[which] > icmplim) {
64. return(-1);
65. }
66. return(0);
67.}