Changeset 58 for trunk/src/dataFlowSet.c
- Timestamp:
- 10/09/07 12:01:26 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r57 r58 153 153 field_size = (int) pftmp->fieldLength; 154 154 155 /* special case: check yes on all flows from one router (phantom field nb 0) */ 155 /* special case: check yes on all flows from one router */ 156 /* (phantom field nb 0) */ 156 157 /* FIXME : this code is repeated, perhaps past before */ 157 158 while ( ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j))) != NULL ) { … … 222 223 #ifdef IPV4AGG 223 224 if (pftmp->fieldType==10){ 224 agCache.idSnmp = *((unsigned short*)&buffer2); 225 agCache.inputSnmp = *((unsigned short*)&buffer2); 226 } 227 if (pftmp->fieldType==14){ 228 agCache.outputSnmp = *((unsigned short*)&buffer2); 225 229 } 226 230 #endif … … 472 476 #ifdef IPV4AGG 473 477 if (pftmp->fieldType==10){ 474 agCache.idSnmp = *((unsigned short*)&buffer2); 478 agCache.inputSnmp = *((unsigned short*)&buffer2); 479 } 480 if (pftmp->fieldType==14){ 481 agCache.outputSnmp = *((unsigned short*)&buffer2); 475 482 } 476 483 #endif … … 547 554 sizeof(struct PrefixV4), prefGlobalCmp); 548 555 if (res!=NULL){ 549 if ( myPtrs->routersID[res->routerNb] == agCache.routerAd ) { 556 /* if ( myPtrs->routersID[res->routerNb] == agCache.routerAd ) { */ 557 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 550 558 /* OUT ("traffic from the prefix/subnet") */ 551 559 res->bytesNbOUT += agCache.bytes; 552 560 res->pktsNbOUT += agCache.pkts; 553 561 (res->flowNbOUT)++; 562 if (res->sampling == 0) { 563 res->sampling = myPtrs->currentRouterPtr->sampled; 564 } else if (res->sampling != myPtrs->currentRouterPtr->sampled) { 565 syslog(LOG_INFO, 566 "2 sampling values for 1 subnet: %lu.%lu.%lu.%lu % from router %lu.%lu.%lu.%lu", 567 agCache.v4AdS>>24, 568 agCache.v4AdS<<8>>24, 569 agCache.v4AdS<<16>>24, 570 agCache.v4AdS<<24>>24, 571 (myPtrs->pcktPtr->ipH->srcAdd>>24), 572 (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 573 (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 574 (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 575 } 554 576 /* inter-pop matrix Accounting */ 555 577 prefixKey.beginning = agCache.v4AdD>>(32-agCache.maskD)<<(32-agCache.maskD); 556 578 res2 = bsearch(&prefixKey, V4PTab, nbPV4, 557 579 sizeof(struct PrefixV4), prefGlobalCmp); 558 if (res2!=NULL){ 580 if (res2!=NULL){ 559 581 ((struct POP *)((myPtrs->matrixPOP) 560 582 +((res->routerNb)*ROUTER_INDEX_MAX) … … 588 610 res = bsearch(&prefixKey, V4PTab, nbPV4, 589 611 sizeof(struct PrefixV4), prefGlobalCmp); 590 if (res!=NULL){ 591 if ( myPtrs-> routersID[res->routerNb] == agCache.routerAd ) {592 /* IN ("traffic to the prefix ") */612 if (res!=NULL){ 613 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 614 /* IN ("traffic to the prefix/subnet") */ 593 615 res->bytesNbIN += agCache.bytes; 594 616 res->pktsNbIN += agCache.pkts; 595 (res->flowNbIN)++; 596 } else { 617 (res->flowNbIN)++; 618 /* if ( myPtrs->routersID[res->routerNb] == agCache.routerAd ) { */ 619 /* IN ("traffic to the prefix") */ 620 /* res->bytesNbIN += agCache.bytes; */ 621 /* res->pktsNbIN += agCache.pkts; */ 622 /* (res->flowNbIN)++; */ 623 /* if (res->sampling == 0) { */ 624 /* res->sampling = myPtrs->currentRouterPtr->sampled; */ 625 /* } else if (res->sampling != myPtrs->currentRouterPtr->sampled) { */ 626 /* syslog(LOG_INFO, */ 627 /* "2 sampling values for 1 /: %lu.%lu.%lu.%lu % from router %lu.%lu.%lu.%lu", */ 628 /* agCache.v4AdS>>24, */ 629 /* agCache.v4AdS<<8>>24, */ 630 /* agCache.v4AdS<<16>>24, */ 631 /* agCache.v4AdS<<24>>24, */ 632 /* (myPtrs->pcktPtr->ipH->srcAdd>>24), */ 633 /* (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */ 634 /* (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */ 635 /* (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); */ 636 /* } */ 637 /* } else { */ 597 638 /* doublon or bad reference in prefix list */ 598 599 /* fprintf(stderr, "IN NC: %lu.%lu.%lu.%lu/%hu -> %lu.%lu.%lu.%lu/%hu R:%lu.%lu.%lu.%lu \n", */600 /* (agCache.v4AdS>>24), */601 /* (agCache.v4AdS<<8>>24), */602 /* (agCache.v4AdS<<16>>24), */603 /* (agCache.v4AdS<<24>>24), */604 /* (agCache.maskS), */605 /* (agCache.v4AdD>>24), */606 /* (agCache.v4AdD<<8>>24), */607 /* (agCache.v4AdD<<16>>24), */608 /* (agCache.v4AdD<<24>>24), */609 /* (agCache.maskD), */610 /* (myPtrs->pcktPtr->ipH->srcAdd>>24), */611 /* (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */612 /* (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */613 /* (myPtrs->pcktPtr->ipH->srcAdd<<24>>24) */614 /* ); */615 639 } 616 640 } else { … … 788 812 if (pftmp->fieldType==34){ 789 813 if ((*((unsigned long*)&buffer4)==1) 790 || (*((unsigned long*)&buffer4)==10) 814 || (*((unsigned long*)&buffer4)==10) 815 || (*((unsigned long*)&buffer4)==100) 791 816 || (*((unsigned long*)&buffer4)==1000)) { 792 817 if (myPtrs->currentRouterPtr->sampled != *((unsigned long*)&buffer4) ) { … … 795 820 myPtrs->currentRouterPtr->sampled); 796 821 #endif 822 syslog(LOG_INFO,"Sampling value change for router : %lu.%lu.%lu.%lu, old: %lu, new: %lu", 823 (myPtrs->pcktPtr->ipH->srcAdd>>24), 824 (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 825 (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 826 (myPtrs->pcktPtr->ipH->srcAdd<<24>>24), 827 myPtrs->currentRouterPtr->sampled, 828 *((unsigned long*)&buffer4) 829 ); 797 830 myPtrs->currentRouterPtr->sampled = *((unsigned long*)&buffer4); 798 for (i=0; i<nbPV4; i++) {799 /* we update the PrefixV4 structure with the sampled information */800 if ( myPtrs->currentRouterPtr->IpAddress == myPtrs->routersID[V4PTab[i].routerNb]) {801 V4PTab[i].sampling = *((unsigned long*)&buffer4);802 myPtrs->secondV4Tab[i].sampling = *((unsigned long*)&buffer4);803 }804 }805 }831 } 832 }else{ 833 syslog(LOG_INFO,"Sampling value not standard for router : %lu.%lu.%lu.%lu", 834 (myPtrs->pcktPtr->ipH->srcAdd>>24), 835 (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 836 (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 837 (myPtrs->pcktPtr->ipH->srcAdd<<24>>24) 838 ); 806 839 } 807 840 }