- Timestamp:
- 11/07/08 16:20:00 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r83 r84 657 657 sizeof(struct PrefixV4), prefGlobalCmp); 658 658 if (res!=NULL){ 659 /* res is supernet or subnet ?*/659 /* WE HAVE FOUND SOURCE ADDRESS IN OUR LIST */ 660 660 if (res->hasSubnet == 1) { 661 661 resSub = NULL; … … 667 667 } 668 668 } 669 #ifdef DEBUG 670 fprintf(stderr,"S %lu.%lu.%lu.%lu/%hu %lu.%lu.%lu.%lu/%hu Rs %lu Ps %lu\n", 671 (agCache.v4AdS>>24), 672 (agCache.v4AdS<<8>>24), 673 (agCache.v4AdS<<16>>24), 674 (agCache.v4AdS<<24>>24), 675 (agCache.maskS), 676 (agCache.v4AdD>>24), 677 (agCache.v4AdD<<8>>24), 678 (agCache.v4AdD<<16>>24), 679 (agCache.v4AdD<<24>>24), 680 (agCache.maskD), 681 myPtrs->currentRouterPtr->sampled, 682 res->sampling); 683 #endif 669 684 #if defined(IPV4AGGIDR) 670 685 if ( myPtrs->routersID[res->routerNb] == agCache.routerAd ) { … … 672 687 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 673 688 #endif 674 675 689 /* OUT ("traffic from the prefix/subnet") */ 676 690 #if defined(MULTISAMPLING) … … 710 724 } 711 725 } 726 #ifdef DEBUG 727 fprintf(stderr,"S&D %lu.%lu.%lu.%lu/%hu %lu.%lu.%lu.%lu/%hu Rs %lu Ps %lu\n", 728 (agCache.v4AdS>>24), 729 (agCache.v4AdS<<8>>24), 730 (agCache.v4AdS<<16>>24), 731 (agCache.v4AdS<<24>>24), 732 (agCache.maskS), 733 (agCache.v4AdD>>24), 734 (agCache.v4AdD<<8>>24), 735 (agCache.v4AdD<<16>>24), 736 (agCache.v4AdD<<24>>24), 737 (agCache.maskD), 738 myPtrs->currentRouterPtr->sampled, 739 res3->sampling); 740 #endif 712 741 #if defined(MULTISAMPLING) 713 742 if (myPtrs->currentRouterPtr->sampled != res3->sampling ){ … … 772 801 } 773 802 #endif 774 } else { /* res==NULL, the prefix in source don't exist in your prefix list*/803 } else { /* SOURCE ADDRESS DOESN'T IN OUR LIST */ 775 804 prefixKey.beginning = agCache.v4AdD>>(32-agCache.maskD)<<(32-agCache.maskD); 776 805 res = bsearch(&prefixKey, V4PTab, nbPV4, 777 806 sizeof(struct PrefixV4), prefGlobalCmp); 778 807 if (res!=NULL){ 779 /* res is supernet or subnet ?*/808 /* DESTINATION ADDRESS IS IN OUR LIST */ 780 809 if (res->hasSubnet == 1) { 781 810 resSub = NULL; … … 787 816 } 788 817 } 818 #ifdef DEBUG 819 fprintf(stderr,"D %lu.%lu.%lu.%lu/%hu %lu.%lu.%lu.%lu/%hu Rs %lu Ps %lu R@ %lu.%lu.%lu.%lu\n", 820 (agCache.v4AdS>>24), 821 (agCache.v4AdS<<8>>24), 822 (agCache.v4AdS<<16>>24), 823 (agCache.v4AdS<<24>>24), 824 (agCache.maskS), 825 (agCache.v4AdD>>24), 826 (agCache.v4AdD<<8>>24), 827 (agCache.v4AdD<<16>>24), 828 (agCache.v4AdD<<24>>24), 829 (agCache.maskD), 830 myPtrs->currentRouterPtr->sampled, 831 res->sampling, 832 (myPtrs->pcktPtr->ipH->srcAdd>>24), 833 (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 834 (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 835 (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 836 #endif 789 837 #if defined(IPV4AGGIDSNMP) 790 838 if ( myPtrs->currentRouterPtr->snmpIndexList[agCache.inputSnmp] == 1 ) { 839 #if defined(MULTISAMPLING) 840 if (myPtrs->currentRouterPtr->sampled != res->sampling ){ 841 res->bytesNbIN += agCache.bytes*myPtrs->currentRouterPtr->sampled/res->sampling; 842 res->pktsNbIN += agCache.pkts*myPtrs->currentRouterPtr->sampled/res->sampling; 843 }else{ 844 res->bytesNbIN += agCache.bytes; 845 res->pktsNbIN += agCache.pkts; 846 (res->flowNbIN)++; 847 } 848 #else 791 849 if (myPtrs->currentRouterPtr->sampled != 0 ){ 792 850 /* IN ("traffic to the prefix/subnet") */ … … 795 853 (res->flowNbIN)++; 796 854 } 855 #endif 797 856 } 798 857 #endif … … 806 865 } 807 866 } 808 #endif809 867 if (res->sampling == 0 810 868 && myPtrs->currentRouterPtr->sampled != 0 ){ 811 869 res->sampling = myPtrs->currentRouterPtr->sampled; 812 870 } 871 #endif 813 872 } else { 814 873 /* UNKNOW SUBNET CASE */ … … 964 1023 #ifdef DEBUG 965 1024 fprintf(stderr,"<d id: %hu, lg %hu", (*myPtrs->currentFlowsetIdPtr), data_length); 966 #endif 1025 #endif 967 1026 for ( i=0; i<(tmpOpt->optionScopeLg/4); i++){ 968 1027 /* FIXME : today we skip the scope fields, it's bad :( */ … … 987 1046 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 988 1047 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 989 if (pftmp->fieldType==34 ){1048 if (pftmp->fieldType==34||pftmp->fieldType==50){ 990 1049 if ((*((unsigned long*)&buffer4)==1) 991 1050 || (*((unsigned long*)&buffer4)==10) … … 996 1055 fprintf(stderr,"\n SV (p) %lu != %lu (r)", *((unsigned long*)&buffer4), 997 1056 myPtrs->currentRouterPtr->sampled); 998 #endif 1057 #endif 999 1058 syslog(LOG_INFO,"Sampling value change for router : %lu.%lu.%lu.%lu, old: %lu, new: %lu", 1000 1059 (myPtrs->pcktPtr->ipH->srcAdd>>24), -
trunk/src/get_conf.c
r83 r84 335 335 pV4SubTabPtr[subNetIndex].mask = n4; 336 336 #if defined(MULTISAMPLING) 337 pV4 TabPtr[subNetIndex].sampling = n6;337 pV4SubTabPtr[subNetIndex].sampling = n6; 338 338 #else 339 pV4 TabPtr[subNetIndex].sampling = 0;339 pV4SubTabPtr[subNetIndex].sampling = 0; 340 340 #endif 341 341 #ifdef IPV4AGGIDR -
trunk/src/routers_mgmt.c
r80 r84 49 49 tmp->tplList = NULL; 50 50 tmp->tplOptList = NULL; 51 #if defined(MULTISAMPLING) 52 tmp->sampled = 1; 53 #else 51 54 tmp->sampled = 0; 55 #endif 52 56 tmp->next = routersList; 53 57 if (routersList!=NULL) { routersList->prev = tmp;}