- Timestamp:
- 12/21/10 16:01:36 (12 years ago)
- Location:
- trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r127 r144 58 58 int j = 0; 59 59 int pos = 0; 60 int jdos = 0; 61 int posdos = 0; 60 62 unsigned char buffer1; 61 63 unsigned char buffer2[2]; … … 75 77 #endif 76 78 struct AggCache agCache; 79 struct DoSCache dosCache; 77 80 int bool = 0; /* in IPV4 Agg mode enabled, we need to now if it's an IPv4 */ 78 81 int isIPv6 = 0; … … 330 333 agCache.bytes = *((unsigned long*)&buffer4); 331 334 if ( 332 ((unsigned long)((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) + ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) *10/100))335 ((unsigned long)((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) + ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue)/5)) 333 336 >= (*((unsigned long*)&buffer4))) 334 337 && 335 ( (unsigned long)((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) - ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) *10/100))338 ( (unsigned long)((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) - ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue)/5)) 336 339 <= (*((unsigned long*)&buffer4)) ) 337 340 ) … … 339 342 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 340 343 } 341 344 } 342 345 #if defined(IPV4AGGIDR) || defined(IPV4AGGIDSNMP) 343 346 if (pftmp->fieldType==10){ … … 369 372 } 370 373 #endif 374 if (pftmp->fieldType==1){ 375 dosCache.bytes = *((unsigned long*)&buffer4); 376 dosCache.sampling = *myPtrs->currentRouterPtr->sampled; 377 } 378 if (pftmp->fieldType==2){ 379 dosCache.pkts = *((unsigned long*)&buffer4); 380 } 371 381 break; 372 382 case 16: … … 633 643 } 634 644 #endif 645 if (pftmp->fieldType==1){ 646 dosCache.bytes = *((unsigned long*)&buffer4); 647 dosCache.sampling = *myPtrs->currentRouterPtr->sampled; 648 } 649 if (pftmp->fieldType==2){ 650 dosCache.pkts = *((unsigned long*)&buffer4); 651 } 635 652 break; 636 653 case 16: … … 1426 1443 } 1427 1444 isMplsFlow = 0; 1445 1446 /* DoS DETECTION */ 1447 if ( ( dosCache.packets*dosCache.sampling > MAX_PKTS_DOS ) 1448 && ((dosCache.packets)/(dosCache.bytes) < RATIO_DOS ) ) { 1449 jdos = 0; 1450 posdos = 69*MAX_RULES_PER_FIELD+jdos; 1451 while ( ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+jdos))) != NULL ) { 1452 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+posdos)))->check = 1; 1453 jdos++; 1454 } 1455 } 1456 1428 1457 /* 1429 1458 * … … 1465 1494 &tmp->sourceId, 1466 1495 sizeof(unsigned long) 1467 ), 1468 &tmp->templateFlowSetId, 1469 sizeof(tmp->templateFlowSetId) 1470 ), 1471 myPtrs->ptr_buffer+secondOffset, 1496 ), 1497 &tmp->templateFlowSetId, 1498 sizeof(tmp->templateFlowSetId) 1499 ), 1500 myPtrs->ptr_buffer+secondOffset, 1472 1501 flow_size 1473 1502 ); -
trunk/src/dataFlowSet.h
r127 r144 95 95 }; 96 96 97 struct DoSCache { 98 unsigned long bytes; 99 unsigned long pkts; 100 unsigned long sampling; 101 } 97 102 98 103 short -
trunk/src/renetcolParam.h
r128 r144 73 73 #define MAX_IPV6_PREFIX 500 74 74 #define MAX_IPV6_SUBNET 100 75 76 #define MAX_PKTS_DOS 30000 /* dos threshold */ 77 #define RATIO_DOS 200 /* packets average size */ 78 #define RATIO_FIELD 69 /* field 69 is a "reserved" field who is not used actualy. */ 75 79 76 80 /* -
trunk/src/renetcolSender.c
r127 r144 252 252 close (listenSock); 253 253 todo(clientSock, remoteHost); 254 if (!(pidFile = fopen("/ tmp/pidrenetcol.tmp", "r"))) {255 syslog (LOG_ERR, "error during / tmp/pidrenetcol.tmpopening : %s\n",254 if (!(pidFile = fopen("/var/run/renetcol.pid", "r"))) { 255 syslog (LOG_ERR, "error during /var/run/renetcol.pid opening : %s\n", 256 256 strerror(errno)); 257 257 exit(1); … … 404 404 buffer4[3]= *(myText+i); i++; 405 405 renetcolPID = *((pid_t *)&buffer4); 406 if (!(pidFile = fopen("/ tmp/pidrenetcol.tmp", "w"))) {407 syslog (LOG_ERR, "error during / tmp/pidrenetcol.tmpopening : %s\n",406 if (!(pidFile = fopen("/var/run/renetcol.pid", "w"))) { 407 syslog (LOG_ERR, "error during /var/run/renetcol.pid opening : %s\n", 408 408 strerror(errno)); 409 409 exit(1); -
trunk/web/inf/thks.php
r141 r144 3 3 print " <div id=\"contenu\"> <p> Thanks to : \n"; 4 4 print "<ul>"; 5 print "<li> Dany Vandromme (director of RENATER) and Franck SIMON (RENATER CTO 2007-2009). </li>"; 5 6 print "<li> CERT RENATER (for his daily usage of renetcolGUI)</li>"; 6 7 print "<li> Anthony Fisson (for the syslog section and many discussions about parallel computing options)</li>";