Changeset 30
- Timestamp:
- 04/20/07 16:31:36 (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r29 r30 38 38 ) 39 39 { 40 TplFlowSetPtr tmp ;41 TplOptionPtr tmpOpt ;42 FieldPtr pftmp ;43 FieldPtr secondPftmp ;40 TplFlowSetPtr tmp = NULL; 41 TplOptionPtr tmpOpt = NULL; 42 FieldPtr pftmp = NULL; 43 FieldPtr secondPftmp = NULL; 44 44 unsigned short data_length = 0; 45 45 unsigned short flow_size = 0; … … 104 104 buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 105 105 data_length = *((unsigned short*)&buffer2); 106 106 107 if ( (tmp=existTplId(myPtrs->currentRouterPtr, myPtrs->currentHeaderV9Ptr->sourceId, 107 108 (*myPtrs->currentFlowsetIdPtr)))!=NULL ) { 108 109 #ifdef DEBUG 109 fprintf(stderr,"{d"); 110 fprintf(stderr,"{d id: %hu, lg %hu", (*myPtrs->currentFlowsetIdPtr), data_length); 111 if ( (*myPtrs->currentFlowsetIdPtr) > 270 ) { 112 /* fprintf(stderr,"Bad TID from router: %lu.%lu.%lu.%lu\n", */ 113 /* (*myPtrs->currentFlowsetIdPtr), */ 114 /* (myPtrs->pcktPtr->ipH->srcAdd>>24), */ 115 /* (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */ 116 /* (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */ 117 /* (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); */ 118 /* fprintf(stderr," Bytes : \n"); */ 119 /* while ( ( myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr) ) > (myPtrs->ptr_buffer+1416) ){ */ 120 /* buffer1= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; */ 121 /* tmp = *((unsigned char*)&buffer1); */ 122 /* fprintf (stderr, " %s ", tmp); */ 123 /* } */ 124 /* exit(-1); */ 125 return (data_length+shift); 126 } 110 127 #endif 111 128 pftmp = tmp->lastField; … … 741 758 tmpRuleList = myPtrs->rulesListPtr; 742 759 while (tmpRuleList){ 743 RulesPtr tmpRuleList_for_to = myPtrs->rulesListPtr; 760 /* RulesPtr tmpRuleList_for_to = myPtrs->rulesListPtr; */ 744 761 RuleDefPtr tmpRuleDefList = tmpRuleList->def; 745 762 unsigned short check = 1; 746 int s=0; 763 /* int s=0; */ 747 764 secondOffset = secondOldOffset; 748 765 while (tmpRuleDefList){ … … 810 827 } 811 828 } /* end of the while on one flow record */ 829 830 /* new place */ 831 832 while ( ((*myPtrs->offsetV9Ptr)-48-shift) < data_length ) { 833 (*myPtrs->offsetV9Ptr)++; /* if padding */ 834 paddingCounter++; 835 if ( paddingCounter > 8 ) { 836 #ifdef DEBUG 837 fprintf(stderr," padding too high: %d ", paddingCounter); 838 #endif 839 syslog(LOG_INFO,"padding too high: %d ", paddingCounter); 840 return (-1); 841 } 842 } 843 while ( (*myPtrs->offsetV9Ptr)-48-shift > data_length ) { 844 (*myPtrs->offsetV9Ptr)--; /* crazy loop (when bug appears in template def) */ 845 crazyCounter++; 846 } 847 #ifdef DEBUG 848 if (crazyCounter != 0){ fprintf(stderr," crazyCounter: %d ", crazyCounter); } 849 #endif 850 if (crazyCounter!=0) { syslog(LOG_INFO,"crazyCounter: %d ", crazyCounter);} 851 812 852 #ifdef DEBUG 813 853 fprintf(stderr,"}"); 814 854 #endif 855 856 return (data_length+shift); 857 /* end new place */ 858 815 859 }else{ 816 /* 817 * Optional template 818 */ 819 #ifdef DEBUG 820 fprintf(stderr,"<d"); 821 #endif 860 /* 861 * 862 * 863 * Optional template 864 * 865 * 866 */ 822 867 if ((tmpOpt=existTplOptId(myPtrs->currentRouterPtr, myPtrs->currentHeaderV9Ptr->sourceId, 823 868 (*myPtrs->currentFlowsetIdPtr)))!=NULL) { 824 869 #ifdef DEBUG 870 fprintf(stderr,"<d id: %hu, lg %hu", (*myPtrs->currentFlowsetIdPtr), data_length); 871 #endif 825 872 for ( i=0; i<(tmpOpt->optionScopeLg/4); i++){ 826 873 /* FIXME : today we skip the scope fields, it's bad :( */ 827 if ( pftmp=tmpOpt->lastField) {874 if ((pftmp=tmpOpt->lastField)!=NULL) { 828 875 for (j=0; j<pftmp->fieldLength; j++) { 829 876 (*myPtrs->offsetV9Ptr)++; … … 847 894 if (pftmp->fieldType==34){ 848 895 if (myPtrs->currentRouterPtr->sampled != *((unsigned long*)&buffer4) ) { 896 #ifdef DEBUGAGG 897 fprintf(stderr,"SV (p) %lu != %lu (r)\n", *((unsigned long*)&buffer4), 898 myPtrs->currentRouterPtr->sampled); 899 #endif 849 900 myPtrs->currentRouterPtr->sampled = *((unsigned long*)&buffer4); 850 901 for (i=0; i<nbPV4; i++) { … … 853 904 V4PTab[i].sampling = *((unsigned long*)&buffer4); 854 905 myPtrs->secondV4Tab[i].sampling = *((unsigned long*)&buffer4); 855 #ifdef DEBUGAGG856 fprintf(stderr," SV %lu ", *((unsigned long*)&buffer4));857 #endif858 906 } 859 907 } … … 866 914 while ((*myPtrs->offsetV9Ptr)%4 != 0) { 867 915 (*myPtrs->offsetV9Ptr)++; 916 #ifdef DEBUG 917 fprintf(stderr," p "); 918 #endif 868 919 } 869 920 } else { … … 873 924 fprintf(stderr,">"); 874 925 #endif 875 /* (*myPtrs->offsetV9Ptr)+=(data_length-4); */ 876 /* (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count; */ 926 return (data_length+shift); 877 927 } else { 878 928 /* … … 891 941 ); 892 942 #endif 943 return (data_length+shift); 893 944 } 894 945 } 895 while ( ((*myPtrs->offsetV9Ptr)-48-shift) < data_length ) { 896 (*myPtrs->offsetV9Ptr)++; /* if padding */ 897 paddingCounter++; 898 if ( paddingCounter > 8 ) { 899 #ifdef DEBUG 900 fprintf(stderr," padding too high: %d ", paddingCounter); 901 #endif 902 syslog(LOG_INFO,"padding too high: %d ", paddingCounter); 903 return (-1); 904 } 905 } 906 while ( (*myPtrs->offsetV9Ptr)-48-shift > data_length ) { 907 (*myPtrs->offsetV9Ptr)--; /* crazy loop (when bug appears in template def) */ 908 crazyCounter++; 909 } 910 #ifdef DEBUG 911 if (crazyCounter != 0){ fprintf(stderr," crazyCounter: %d ", crazyCounter); } 912 #endif 913 if (crazyCounter!=0) { syslog(LOG_INFO,"crazyCounter: %d ", crazyCounter);} 914 return (data_length+shift); 946 /* old place */ 947 915 948 } -
trunk/src/renetcol.c
r29 r30 442 442 myPtrs.currentFlowsetNumberPtr, 443 443 myQueue)) < 0 ) { 444 #ifdef DEBUG 444 #ifdef DEBUG 445 445 fprintf (stderr, "w>\n"); 446 446 #endif … … 453 453 curTplOptionPtr, 454 454 myPtrs.currentFlowsetNumberPtr) ) < 0 ) { 455 #ifdef DEBUG 455 #ifdef DEBUG 456 456 fprintf (stderr, "wo>\n"); 457 #endif 457 #endif 458 458 currentFlowsetNumber = myPtrs.currentHeaderV9Ptr->count + 1; 459 459 } 460 } else {460 } else if (currentFlowsetId > 255) { 461 461 if ( (shift = checkDataFlowSet(shift, 462 462 &myPtrs, … … 470 470 currentFlowsetNumber = myPtrs.currentHeaderV9Ptr->count + 1; 471 471 } 472 } else { 473 #ifdef DEBUG 474 fprintf (stderr, "1<<255\n"); 475 #endif 476 currentFlowsetNumber = myPtrs.currentHeaderV9Ptr->count + 1; 472 477 } 473 478 if ( gardeFou > 200) { exit(-1); } -
trunk/src/renetcolAgg.c
r29 r30 95 95 for (j=0; j<strlen(buf); j++) {buf[j] = '\0';} 96 96 strcat(name, RRD_LOCATION); 97 fprintf(stderr," SPL : %lu\n ",shmForAgg->prefixV4Tab[index][i].sampling);98 97 sprintf(ipStr, "%lu_%lu_%lu_%lu_%hu_%lu", 99 98 shmForAgg->prefixV4Tab[index][i].beginning>>24, … … 107 106 strcat(name, RRD_EXTENSION); 108 107 if ( (fp=fopen(name,"r")) == NULL ){ 109 #ifdef DEBUGAGG110 fprintf(stderr, "Creation %s ... ", name);111 #endif112 108 opt[0]= (char *) malloc((strlen(RRD_PARAM_0) + 1) * sizeof(char)); 113 109 strcpy(opt[0], RRD_PARAM_0); … … 176 172 opt[j] = NULL; 177 173 } 178 #ifdef DEBUGAGG179 fprintf(stderr, "end creation \n", name);180 #endif181 174 }else{ 182 175 fclose(fp); 183 #ifdef DEBUGAGG184 fprintf(stderr, "Update %s \n", name);185 #endif186 176 rrd_already_created_ct++; 187 177 snprintf(buf, -
trunk/src/renetcolSender.c
r28 r30 309 309 strcpy (rulesFileName, argv[3]); 310 310 rulesListPtr = NULL; 311 fprintf(stderr, "renetcolSender: reading the rules...\n");312 311 rulesListPtr = getRules(rulesListPtr, rulesFileName); 313 fprintf(stderr, "renetcolSender: OK\n");314 312 /* we delete rules which are not type socket */ 315 313 tmp = rulesListPtr; -
trunk/src/routers_mgmt.c
r28 r30 75 75 TplFlowSetPtr tmp = (TplFlowSetPtr) malloc(sizeof(struct TemplateFlowSet)); 76 76 tmp->sourceId = 0; 77 tmp->templateFlowSetId = 0;77 tmp->templateFlowSetId = 99; 78 78 tmp->fieldCount = 0; 79 79 tmp->fieldSet = NULL; … … 89 89 if (ptpl) { 90 90 while ( ptpl->fieldSet != NULL ){ 91 /* fprintf(stderr, "deleteTplFlSet\n"); */92 91 if (!(ptpl->lastField->prev)) { 93 92 freeField(ptpl->lastField); … … 104 103 ptpl = NULL; 105 104 } 106 return NULL; /* FIXME I don't known */105 return NULL; 107 106 } 108 107 … … 111 110 TplOptionPtr tmp = (TplOptionPtr) malloc(sizeof(struct TemplateOption)); 112 111 tmp->sourceId = 0; 113 tmp->templateOptionId = 0;112 tmp->templateOptionId = 66; 114 113 tmp->length = 0; 115 114 tmp->optionScopeLg = 0; … … 127 126 if (ptplo) { 128 127 while ( ptplo->fieldSet != NULL ){ 129 /* fprintf(stderr, "deleteTplFlSet\n"); */130 128 if (!(ptplo->lastField->prev)) { 131 129 freeField(ptplo->lastField); -
trunk/src/template.c
r29 r30 67 67 unsigned char buffer2[2]; 68 68 unsigned short tmp = 0; 69 unsigned short getFlowsetId = 0;69 unsigned short flowsetId = 0; 70 70 unsigned short length = 0; 71 71 TplFlowSetPtr ptpltmp = NULL; … … 77 77 unsigned short badFieldNumber = 0; 78 78 unsigned short badFieldLength = 0; 79 unsigned short badFieldCount = 0; 79 80 80 81 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 81 82 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 82 getFlowsetId = *((unsigned short*)&buffer2);83 flowsetId = *((unsigned short*)&buffer2); 83 84 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 84 85 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 90 91 badFieldNumber = 0; 91 92 badFieldLength = 0; 93 badFieldCount = 0; 92 94 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 93 95 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 103 105 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 104 106 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 105 cTFSPtr->fieldCount = *((unsigned short*)&buffer2); 107 if ( (cTFSPtr->fieldCount = *((unsigned short*)&buffer2) ) == 0 ) { 108 badFieldCount = 1; 109 ptpltmp = cTFSPtr; 110 if (ptpltmp->prev == NULL) { 111 cr->tplList = ptpltmp->next; 112 if (cr->tplList) { 113 cr->tplList->prev = NULL; 114 } 115 } else { 116 ptpltmp->prev->next = ptpltmp->next; 117 if (ptpltmp->next) { 118 ptpltmp->next->prev = ptpltmp->prev; 119 } 120 } 121 deleteTplFlSet(ptpltmp); 122 cTFSPtr = NULL; 123 return (-1); 124 } 106 125 cpt_fields = 0; 107 126 for ( i=0; i<cTFSPtr->fieldCount; i++) { … … 125 144 } 126 145 cpt_fields++; 127 if ( (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { /* FIXME : constante pour cela */ 146 if ( (cTFSPtr->templateFlowSetId < 256 ) 147 || (cpt_fields > 40) 148 || (badFieldNumber == 1) 149 || badFieldLength == 1 150 || (badFieldCount == 1)) { 128 151 fprintf(stderr,"\n IP: %lu.%lu.%lu.%lu, %d,%d\n", 129 152 cr->IpAddress>>24, … … 177 200 } 178 201 deleteTplFlSet(ptpltmp); 202 ptpltmp = NULL; 179 203 cTFSPtr = NULL; 180 204 cTFSPtr = newRouterTplList(); … … 186 210 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 187 211 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 188 cTFSPtr->fieldCount = *((unsigned short*)&buffer2); 212 if ( (cTFSPtr->fieldCount = *((unsigned short*)&buffer2) ) == 0 ) { 213 badFieldCount = 1; 214 ptpltmp = cTFSPtr; 215 if (ptpltmp->prev == NULL) { 216 cr->tplList = ptpltmp->next; 217 if (cr->tplList) { 218 cr->tplList->prev = NULL; 219 } 220 } else { 221 ptpltmp->prev->next = ptpltmp->next; 222 if (ptpltmp->next) { 223 ptpltmp->next->prev = ptpltmp->prev; 224 } 225 } 226 deleteTplFlSet(ptpltmp); 227 cTFSPtr = NULL; 228 return (-1); 229 } 189 230 cpt_fields = 0; 190 231 for ( i=0; i<cTFSPtr->fieldCount; i++) { … … 210 251 } 211 252 cpt_fields++; 212 if ( (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { /* FIXME : declarer une constante pour cela */ 253 if ( (cTFSPtr->templateFlowSetId < 256 ) 254 || (cpt_fields > 40) 255 || (badFieldNumber == 1) 256 || badFieldLength == 1 257 || (badFieldCount == 1)) { 213 258 while ( ((*offV9))> (index)){ 214 259 buffer2[1]= *(buf+index); index++; … … 355 400 } 356 401 cpt_fields++; 357 if ( (c pt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) {402 if ( (cTOPtr->templateOptionId < 256) || (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { 358 403 syslog (LOG_INFO, 359 404 "in option template function: too many fields, bug collector or wrong template def in template update"); … … 430 475 } 431 476 cpt_fields++; 432 if ( (c pt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) {477 if ( (cTOPtr->templateOptionId < 256) || (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { 433 478 syslog (LOG_INFO, 434 479 "in update option tpl function: too many fields, bug collector or wrong template def in template update");