Changeset 27

Show
Ignore:
Timestamp:
04/05/07 18:10:36 (16 years ago)
Author:
andreu
Message:

explicite output to find wrong definition bug - memory leak in renetcolAgg find

Location:
trunk
Files:
1 added
17 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dataFlowSet.c

    r25 r27  
    3030 * 
    3131 */ 
    32 unsigned short  
    33 checkDataFlowSet(unsigned short shift,  
     32short  
     33checkDataFlowSet(short shift,  
    3434                 struct MyPtrs *myPtrs, 
    3535                 int myQueue,  
     
    6666  int bool = 0; /* in IPV4 Agg mode enabled, we need to now if it's an IPv4 */ 
    6767                /* flow, we test on the field and then put bool at 1 */ 
     68  int isMplsFlow = 0; 
     69  int paddingCounter = 0; 
     70  int crazyCounter = 0; 
     71 
    6872#ifdef CRIHAN 
    6973  struct IPFLowCache ipFirstCache; 
     
    115119      return (data_length+shift); 
    116120    } 
     121    if ( data_length >= 1452 ) { 
     122      syslog(LOG_INFO, "data flowset length too raised; all next informations of this data flowset are not considered! flowset ID: %hu, from router: %lu.%lu.%lu.%lu", 
     123             (*myPtrs->currentFlowsetIdPtr), 
     124             (myPtrs->pcktPtr->ipH->srcAdd>>24), 
     125             (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 
     126             (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 
     127             (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 
     128      return (-1); 
     129    } 
    117130#ifdef IPV4AGG 
    118131    agCache.routerAd = myPtrs->pcktPtr->ipH->srcAdd;  
     
    136149       */ 
    137150      cpt++; 
    138       j=0; 
     151      j = 0; 
    139152      pos = (pftmp->fieldType)*10+j; 
    140153      field_size = (int) pftmp->fieldLength; 
     154       
     155      /* special case: check yes on all flows from one router (phantom field nb 0) */ 
     156      while ( ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j))) != NULL ) {   
     157        if  ( (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j)))->value->stor.lvalue) 
     158              == myPtrs->pcktPtr->ipH->srcAdd ) 
     159          { 
     160            ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+j)))->check = 1; 
     161          }      
     162        j++; 
     163      }     
     164      j = 0; 
     165       
    141166      /* 
    142167       * Comparaison between the field value and the rules 
    143168       * ... if one rule exist 
     169       * FIXME : warning, if no rules, no accounting ? 
    144170       */ 
    145171      if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos))) != NULL) { 
     
    153179                  (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->operator)){ 
    154180          case 2: 
     181            /* operator: "=" */  
    155182            switch (field_size) { 
    156183            case 1: 
     
    234261              /* aggregation */ 
    235262              /* end aggregation */ 
     263              if (pftmp->fieldType==70){ 
     264                isMplsFlow = 1; 
     265              } 
    236266#ifdef CRIHAN 
    237267              if (pftmp->fieldType==70){ 
     
    255285#ifdef IPV4AGG 
    256286              if ((pftmp->fieldType==8)){ 
     287                bool = 1; /* very important, test if we have an IPv4 flow for Agg */ 
    257288                agCache.v4AdS = *((unsigned long*)&buffer4); 
    258289              } 
     
    506537          /* aggregation */ 
    507538          /* end aggregation */ 
     539          if (pftmp->fieldType==70){ 
     540            isMplsFlow = 1; 
     541          } 
    508542#ifdef CRIHAN 
    509543          if (pftmp->fieldType==70){ 
     
    620654        /* first we must know if the address belong to our prefix   */ 
    621655#ifdef IPV4AGG 
    622         if (bool == 1){ 
     656        if ( (bool == 1) && (isMplsFlow == 0) ){ 
    623657          prefixKey.beginning = agCache.v4AdS>>(32-agCache.maskS)<<(32-agCache.maskS); 
    624658          res = bsearch(&prefixKey, V4PTab, nbPV4,  
    625                         sizeof(struct PrefixV4), prefCmp); 
    626           if (res!=NULL){  
    627             /* OUT ("traffic from the prefix/subnet")  */ 
    628             res->bytesNbOUT += agCache.bytes; 
    629             res->pktsNbOUT += agCache.pkts; 
    630             (res->flowNbOUT)++; 
    631             switch (agCache.tProt) { 
    632             case 1: 
    633               res->icmpBytesNbOUT += agCache.bytes; 
    634               res->icmpPktsNbOUT += agCache.pkts; 
    635               (res->icmpFlowNbOUT)++; 
    636               break; 
    637             case 6: 
    638               res->tcpBytesNbOUT += agCache.bytes; 
    639               res->tcpPktsNbOUT += agCache.pkts; 
    640               (res->tcpFlowNbOUT)++;           
    641               break; 
    642             case 17: 
    643               res->udpBytesNbOUT += agCache.bytes; 
    644               res->udpPktsNbOUT += agCache.pkts; 
    645               (res->udpFlowNbOUT)++; 
    646               break; 
    647             default: 
    648               res->othersBytesNbOUT += agCache.bytes; 
    649               res->othersPktsNbOUT += agCache.pkts; 
    650               (res->othersFlowNbOUT)++; 
     659                        sizeof(struct PrefixV4), prefGlobalCmp); 
     660          if (res!=NULL){ 
     661            if ( myPtrs->routersID[res->routerNb] == agCache.routerAd  ) { 
     662              /* OUT ("traffic from the prefix/subnet")  */ 
     663              res->bytesNbOUT += agCache.bytes; 
     664              res->pktsNbOUT += agCache.pkts; 
     665              (res->flowNbOUT)++; 
     666            } else { 
     667              /* doublon or bad reference in prefix list */ 
    651668            } 
    652669          } else { 
    653670            prefixKey.beginning = agCache.v4AdD>>(32-agCache.maskD)<<(32-agCache.maskD); 
    654671            res = bsearch(&prefixKey, V4PTab, nbPV4,  
    655                           sizeof(struct PrefixV4), prefCmp); 
    656             if (res!=NULL){ /* IN ("traffic to the prefix")  */ 
    657               res->bytesNbIN += agCache.bytes; 
    658               res->pktsNbIN += agCache.pkts; 
    659               (res->flowNbIN)++; 
    660               switch (agCache.tProt) { 
    661               case 1: 
    662                 res->icmpBytesNbIN += agCache.bytes; 
    663                 res->icmpPktsNbIN += agCache.pkts; 
    664                 (res->icmpFlowNbIN)++; 
    665                 break; 
    666               case 6: 
    667                 res->tcpBytesNbIN += agCache.bytes; 
    668                 res->tcpPktsNbIN += agCache.pkts; 
    669                 (res->tcpFlowNbIN)++; 
    670                 break; 
    671               case 17: 
    672                 res->udpBytesNbIN += agCache.bytes; 
    673                 res->udpPktsNbIN += agCache.pkts; 
    674                 (res->udpFlowNbIN)++; 
    675                 break; 
    676               default: 
    677                 res->othersBytesNbIN += agCache.bytes; 
    678                 res->othersPktsNbIN += agCache.pkts; 
    679                 (res->othersFlowNbIN)++; 
     672                          sizeof(struct PrefixV4), prefGlobalCmp); 
     673            if (res!=NULL){  
     674              if ( myPtrs->routersID[res->routerNb] == agCache.routerAd  ) { 
     675                /* IN ("traffic to the prefix")  */ 
     676                res->bytesNbIN += agCache.bytes; 
     677                res->pktsNbIN += agCache.pkts; 
     678                (res->flowNbIN)++; 
     679              } else { 
     680                /* doublon or bad reference in prefix list */ 
     681                 
     682/*              fprintf(stderr, "IN NC: %lu.%lu.%lu.%lu/%hu -> %lu.%lu.%lu.%lu/%hu R:%lu.%lu.%lu.%lu \n", */ 
     683/*                      (agCache.v4AdS>>24), */ 
     684/*                      (agCache.v4AdS<<8>>24),  */ 
     685/*                      (agCache.v4AdS<<16>>24),  */ 
     686/*                      (agCache.v4AdS<<24>>24),  */ 
     687/*                      (agCache.maskS),  */ 
     688/*                      (agCache.v4AdD>>24),  */ 
     689/*                      (agCache.v4AdD<<8>>24),  */ 
     690/*                      (agCache.v4AdD<<16>>24),  */ 
     691/*                      (agCache.v4AdD<<24>>24),  */ 
     692/*                      (agCache.maskD),  */ 
     693/*                      (myPtrs->pcktPtr->ipH->srcAdd>>24),  */ 
     694/*                      (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */ 
     695/*                      (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */ 
     696/*                      (myPtrs->pcktPtr->ipH->srcAdd<<24>>24) */ 
     697/*                      ); */ 
    680698              } 
    681699            } else { 
     
    706724        } 
    707725        bool = 0; 
     726        isMplsFlow = 0; 
    708727#endif 
    709728        /*  
    710729         * Redirection if needed  
    711730         * switch the rules definition (check & fieldToRecord),  
    712          * we send the flow or a part of the flow to a remote host or a file 
     731         * we send the flow or a part of the flow to a remote host or a file. 
     732         * In a first time (until release 0.0.7, the information was sent via 
     733         * the process renetcolSender with an IPC message queue. But, the perf 
     734         * of IPC Msg was very bad with a system compilation by default. 
     735         * So now, we send information directly from here. 
    713736         */ 
    714737        tmpRuleList = myPtrs->rulesListPtr; 
    715738        while (tmpRuleList){ 
     739          RulesPtr tmpRuleList_for_to = myPtrs->rulesListPtr; 
     740          RuleDefPtr tmpRuleDefList = tmpRuleList->def; 
    716741          unsigned short check = 1; 
    717           RuleDefPtr tmpRuleDefList = tmpRuleList->def; 
     742          int s=0; 
    718743          secondOffset = secondOldOffset; 
    719744          while (tmpRuleDefList){ 
     
    725750            /* msg building */ 
    726751            secondPftmp = tmp->lastField; 
    727 /*          memcpy(myMsg.text, (char*)(myPtrs->ptr_buffer+secondOffset),flow_size); */ 
    728752            msgTextIndex = mempcpy(mempcpy(mempcpy(myMsg.text,  
    729753                                                   &tplMsgType,  
     
    747771                                   );  
    748772            myMsg.type = 1; 
     773            /* OLD transfert type */ 
    749774            msgSend( myQueue, myMsg); 
     775            /* NEW transfert type */ 
     776/*          for ( ; tmpRuleList_for_to; tmpRuleList_for_to=tmpRuleList_for_to->next){ */ 
     777/*            fprintf(stderr, "?\n"); */ 
     778/*            if (tmpRuleList_for_to->id == tmpRuleList->id){ */ 
     779/*              fprintf(stderr, "y\n"); */ 
     780/*              s = sendMessage(tmpRuleList_for_to->host->sockId, &(myMsg.text), sizeof(myMsg.text), */ 
     781/*                              tmpRuleList_for_to->host->hostAddressPtr); */ 
     782/*              fprintf(stderr, "o\n"); */ 
     783/*            } */ 
     784/*          } */ 
     785            /* FIXME : perhaps check "s" */ 
    750786            noEnd = 1; 
    751787            secondCpt=0; 
     
    776812    (*myPtrs->offsetV9Ptr)+=(data_length-4); 
    777813    (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count; 
     814    fprintf(stderr, "\n unknown template \n"); 
    778815  } 
    779816  while ( ((*myPtrs->offsetV9Ptr)-48-shift) < data_length ) { 
    780817    (*myPtrs->offsetV9Ptr)++; /* if padding */ 
     818    paddingCounter++; 
     819    fprintf(stderr, "\n padding \n"); 
     820    if ( paddingCounter > 8 ) { 
     821      syslog(LOG_INFO,"padding too high: %d ", paddingCounter); 
     822      return (-1); 
     823    } 
    781824  } 
    782825  while ( (*myPtrs->offsetV9Ptr)-48-shift > data_length ) {  
    783826    (*myPtrs->offsetV9Ptr)--; /* crazy loop (when bug appears in template def) */ 
     827    crazyCounter++; 
    784828  } 
     829  if (crazyCounter!=0) { syslog(LOG_INFO,"crazyCounter: %d ", crazyCounter);} 
    785830  return (data_length+shift); 
    786831} 
  • trunk/src/dataFlowSet.h

    r23 r27  
    100100  unsigned long *ipNbPtr; 
    101101  unsigned long *mplsNbPtr; 
     102  unsigned long *routersID; 
    102103}; 
    103104 
    104 unsigned short  
    105 checkDataFlowSet(unsigned short,  
     105short  
     106checkDataFlowSet(short,  
    106107                 struct MyPtrs *, 
    107108                 int, 
  • trunk/src/fields_mgmt.c

    r23 r27  
    4343 * invPrintFieldSet 
    4444 */ 
    45 void invPrintFieldSet(FieldPtr pf) 
     45void invPrintFieldSet(FILE *file, FieldPtr pf) 
    4646{ 
    4747  FieldPtr tmp = pf; 
    4848  for (; tmp; tmp=tmp->prev) { 
    49     fprintf(stderr, " %hu %hu \n", tmp->fieldType, tmp->fieldLength); 
     49    fprintf(file, "(%hu,%hu) ", tmp->fieldType, tmp->fieldLength); 
    5050  } 
     51  fprintf(file,"\n"); 
    5152} 
    5253 
  • trunk/src/fields_mgmt.h

    r23 r27  
    3939int delField(unsigned short, unsigned short); 
    4040void printFieldSet(FILE *, FieldPtr); 
    41 void invPrintFieldSet(FieldPtr); 
     41void invPrintFieldSet(FILE *, FieldPtr); 
    4242void freeField(FieldPtr); 
    4343/*p_routers search_fields(unsigned short);*/ 
  • trunk/src/get_conf.c

    r23 r27  
    175175      pV4TabPtr[i].bytesNbIN = 0; 
    176176      pV4TabPtr[i].pktsNbIN = 0; 
    177       pV4TabPtr[i].udpPktsNbIN = 0; 
    178       pV4TabPtr[i].tcpPktsNbIN = 0; 
    179       pV4TabPtr[i].icmpPktsNbIN = 0; 
    180       pV4TabPtr[i].othersPktsNbIN = 0; 
    181       pV4TabPtr[i].udpBytesNbIN = 0; 
    182       pV4TabPtr[i].tcpBytesNbIN = 0; 
    183       pV4TabPtr[i].icmpBytesNbIN = 0; 
    184       pV4TabPtr[i].othersBytesNbIN = 0; 
    185       pV4TabPtr[i].udpFlowNbIN = 0; 
    186       pV4TabPtr[i].tcpFlowNbIN = 0; 
    187       pV4TabPtr[i].icmpFlowNbIN = 0; 
    188       pV4TabPtr[i].othersFlowNbIN = 0; 
    189177      pV4TabPtr[i].flowNbOUT = 0; 
    190178      pV4TabPtr[i].bytesNbOUT = 0; 
    191179      pV4TabPtr[i].pktsNbOUT = 0; 
    192       pV4TabPtr[i].udpPktsNbOUT = 0; 
    193       pV4TabPtr[i].tcpPktsNbOUT = 0; 
    194       pV4TabPtr[i].icmpPktsNbOUT = 0; 
    195       pV4TabPtr[i].othersPktsNbOUT = 0; 
    196       pV4TabPtr[i].udpBytesNbOUT = 0; 
    197       pV4TabPtr[i].tcpBytesNbOUT = 0; 
    198       pV4TabPtr[i].icmpBytesNbOUT = 0; 
    199       pV4TabPtr[i].othersBytesNbOUT = 0; 
    200       pV4TabPtr[i].udpFlowNbOUT = 0; 
    201       pV4TabPtr[i].tcpFlowNbOUT = 0; 
    202       pV4TabPtr[i].icmpFlowNbOUT = 0; 
    203       pV4TabPtr[i].othersFlowNbOUT = 0; 
     180      pV4TabPtr[i].firstCoSIN = 0; 
     181      pV4TabPtr[i].secondCoSIN = 0; 
     182      pV4TabPtr[i].thirdCoSIN = 0; 
     183      pV4TabPtr[i].fourthCoSIN = 0; 
     184      pV4TabPtr[i].firstCoSOUT = 0; 
     185      pV4TabPtr[i].secondCoSOUT = 0; 
     186      pV4TabPtr[i].thirdCoSOUT = 0; 
     187      pV4TabPtr[i].fourthCoSOUT = 0; 
    204188    } 
    205189  if( fclose(prefixFile) == 0) { 
  • trunk/src/get_conf.h

    r23 r27  
    3333  unsigned short mask;     /* prefix mask  */ 
    3434  unsigned short routerNb; /* router ID */ 
    35   unsigned long long flowNbIN;  
    36   unsigned long long bytesNbIN;  
     35  unsigned long long flowNbIN;  /* WARNING !!! */ 
     36  unsigned long long bytesNbIN; /* Here, IN means "to the prefix" */ 
    3737  unsigned long long pktsNbIN;  
    38   unsigned long long udpPktsNbIN;   /* WARNING !!! */ 
    39   unsigned long long tcpPktsNbIN;   /* Here, IN means "to the prefix" */ 
    40   unsigned long long icmpPktsNbIN;  /* or "prefix in destination address */ 
    41   unsigned long long othersPktsNbIN; 
    42   unsigned long long udpBytesNbIN; 
    43   unsigned long long tcpBytesNbIN; 
    44   unsigned long long icmpBytesNbIN; 
    45   unsigned long long othersBytesNbIN; 
    46   unsigned long long udpFlowNbIN; 
    47   unsigned long long tcpFlowNbIN; 
    48   unsigned long long icmpFlowNbIN; 
    49   unsigned long long othersFlowNbIN; 
    5038  unsigned long long flowNbOUT;  /* WARNING !!! */ 
    5139  unsigned long long bytesNbOUT;  /* Here, OUT means "from the prefix" */ 
    52   unsigned long long pktsNbOUT;  /* or "prefix in source address */ 
    53   unsigned long long udpPktsNbOUT; 
    54   unsigned long long tcpPktsNbOUT; 
    55   unsigned long long icmpPktsNbOUT; 
    56   unsigned long long othersPktsNbOUT; 
    57   unsigned long long udpBytesNbOUT; 
    58   unsigned long long tcpBytesNbOUT; 
    59   unsigned long long icmpBytesNbOUT; 
    60   unsigned long long othersBytesNbOUT; 
    61   unsigned long long udpFlowNbOUT; 
    62   unsigned long long tcpFlowNbOUT; 
    63   unsigned long long icmpFlowNbOUT; 
    64   unsigned long long othersFlowNbOUT; 
     40  unsigned long long pktsNbOUT; 
     41  unsigned long long firstCoSIN; /* only the bytes for CoS */ 
     42  unsigned long long secondCoSIN; 
     43  unsigned long long thirdCoSIN; 
     44  unsigned long long fourthCoSIN; 
     45  unsigned long long firstCoSOUT; 
     46  unsigned long long secondCoSOUT; 
     47  unsigned long long thirdCoSOUT; 
     48  unsigned long long fourthCoSOUT; 
    6549}; 
    6650 
  • trunk/src/msg_mgmt.h

    r2 r27  
    2828typedef struct {   
    2929  long type; 
    30   char text [512]; 
     30  unsigned char text [512]; 
    3131} msgType; 
    3232 
  • trunk/src/renetcol.c

    r25 r27  
    6969unsigned long indexedRouterList[ROUTER_INDEX_MAX]; 
    7070int routerNb = 0;                                  /* routers number */ 
    71 /* unsigned short v4PrefixNb = 0;                      IPv4 prefix number */  
    72 /* struct PrefixV4 prefixV4Tab[2][MAX_IPV4_PREFIX];       IPv4 prefix structure */ 
     71/* unsigned short v4PrefixNb = 0;                    IPv4 prefix number */  
     72/* struct PrefixV4 prefixV4Tab[2][MAX_IPV4_PREFIX];  IPv4 prefix structure */ 
    7373 
    7474 
     
    208208  myPtrs.ipNbPtr =  &ipNb; 
    209209  myPtrs.mplsNbPtr =  &mplsNb; 
    210    
     210  myPtrs.routersID = &indexedRouterList; 
     211  
    211212  if (myPtrs.pcktPtr==NULL) { 
    212213    fprintf(stderr, "ERROR in struct Datagram allocation\n"); 
     
    378379socketLoop() 
    379380{ 
    380   unsigned short shift; 
     381  short shift; 
    381382  short version = 0; 
    382383  int regRouter = 0; 
     
    384385  int iIP, iMPLS, i; 
    385386  int loopNb = 0; 
     387  int gardeFou = 0; 
    386388  time_t lastIPOutput, lastMPLSOutput; 
    387389  time_t receptionTime; 
     
    393395  lastIPOutput = now; 
    394396  do { 
     397    fprintf (stderr, "socket loop \n"); 
    395398    if ( ((tmPtr->tm_min)%STEP == 0) && (currentIntervalle != tmPtr->tm_min)){ 
    396399      currentIntervalle = tmPtr->tm_min; 
     
    401404      } 
    402405      shmForAgg->readed = 1; 
    403       printf("We change the table, min : %d, ct: %hu\n", tmPtr->tm_min, 
    404              shmForAgg->currentTable); 
    405406    } 
    406407    if (sigusr1Up == 1){ 
     
    429430      currentFlowsetNumber = 0; 
    430431      shift = 0; 
     432      gardeFou=0; 
    431433      while ((currentFlowsetNumber < myPtrs.currentHeaderV9Ptr->count)) { 
     434        gardeFou++; 
    432435        curTplFlSetPtr = NULL; 
    433436        currentFlowsetId=getFlowsetId(currentFlowsetNumber,  
    434437                                      myPtrs.offsetV9Ptr, myPtrs.ptr_buffer); 
    435438        if ( currentFlowsetId == 0 ) { 
    436           shift = checkTemplateFlowSet(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr,  
    437                                        myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 
    438                                        curTplFlSetPtr, 
    439                                        myPtrs.currentFlowsetNumberPtr, 
    440                                        myQueue); 
     439          if ( (shift = checkTemplateFlowSet(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr,  
     440                                             myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 
     441                                             curTplFlSetPtr, 
     442                                             myPtrs.currentFlowsetNumberPtr, 
     443                                             myQueue)) < 0 ) { 
     444            fprintf(stderr, "\nShift < 0 \n"); 
     445            currentFlowsetNumber = myPtrs.currentHeaderV9Ptr->count + 1; 
     446          }; 
     447          writeAllTplFlSet(); 
    441448        } else if (currentFlowsetId == 1) { 
    442           shift = checkTemplateOption(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr,  
     449          if ( (shift = checkTemplateOption(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr,  
    443450                                      myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 
    444451                                      curTplOptionPtr, 
    445                                       myPtrs.currentFlowsetNumberPtr); 
     452                                            myPtrs.currentFlowsetNumberPtr) ) < 0 ) { 
     453            fprintf(stderr, "\nShift Option < 0 \n"); 
     454            currentFlowsetNumber = myPtrs.currentHeaderV9Ptr->count + 1; 
     455          } 
    446456        } else { 
    447           shift = checkDataFlowSet(shift, 
    448                                    &myPtrs, 
    449                                    myQueue,  
    450                                    shmForAgg->prefixV4Tab[shmForAgg->currentTable], 
    451                                    (size_t) shmForAgg->v4PrefixNb 
    452                                    ); 
     457          if ( (shift = checkDataFlowSet(shift, 
     458                                         &myPtrs, 
     459                                         myQueue,  
     460                                         shmForAgg->prefixV4Tab[shmForAgg->currentTable], 
     461                                         (size_t) shmForAgg->v4PrefixNb 
     462                                         ) ) < 0 ) { 
     463            fprintf(stderr, "\nShift check < 0 \n"); 
     464            currentFlowsetNumber = myPtrs.currentHeaderV9Ptr->count + 1; 
     465          } 
    453466        } 
     467        if ( gardeFou > 200) { exit(-1); } 
    454468      } /* end while flowset exist */ 
    455469      break; 
     
    467481      /* FIXME perhaps call this function via the compilation options */ 
    468482      writeAllTplFlSet(); 
    469 /*       for (i=0; i<shmForAgg->v4PrefixNb; i++){ */ 
    470 /*      fprintf(stderr, "%lu \n %llu flows,\t %llu bytes,\t %llu pkts\n Pkts (udp tcp icmp others): %llu \t %llu \t %llu \t %llu\n Bytes (udp tcp icmp others): %llu \t %llu \t %llu \t %llu\n Flows (udp tcp icmp others): %llu \t %llu \t %llu \t %llu\n \n %llu flows,\t %llu bytes,\t %llu pkts\n Pkts (udp tcp icmp others): %llu \t %llu \t %llu \t %llu\n Bytes (udp tcp icmp others): %llu \t %llu \t %llu \t %llu\n Flows (udp tcp icmp others): %llu \t %llu \t %llu \t %llu\n \n", */ 
    471 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].beginning, */ 
    472 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].flowNbIN, */ 
    473 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].bytesNbIN, */ 
    474 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].pktsNbIN, */ 
    475 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].udpPktsNbIN, */ 
    476 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].tcpPktsNbIN, */ 
    477 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].icmpPktsNbIN, */ 
    478 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].othersPktsNbIN, */ 
    479 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].udpBytesNbIN, */ 
    480 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].tcpBytesNbIN, */ 
    481 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].icmpBytesNbIN, */ 
    482 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].othersBytesNbIN, */ 
    483 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].udpFlowNbIN, */ 
    484 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].tcpFlowNbIN, */ 
    485 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].icmpFlowNbIN, */ 
    486 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].othersFlowNbIN, */ 
    487 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].flowNbOUT, */ 
    488 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].bytesNbOUT, */ 
    489 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].pktsNbOUT, */ 
    490 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].udpPktsNbOUT, */ 
    491 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].tcpPktsNbOUT, */ 
    492 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].icmpPktsNbOUT, */ 
    493 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].othersPktsNbOUT, */ 
    494 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].udpBytesNbOUT, */ 
    495 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].tcpBytesNbOUT, */ 
    496 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].icmpBytesNbOUT, */ 
    497 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].othersBytesNbOUT, */ 
    498 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].udpFlowNbOUT, */ 
    499 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].tcpFlowNbOUT, */ 
    500 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].icmpFlowNbOUT, */ 
    501 /*              shmForAgg->prefixV4Tab[shmForAgg->currentTable][i].othersFlowNbOUT */ 
    502 /*              ); */ 
    503 /*       } */ 
     483      fprintf(stderr, " loop %d \n", loopNb); 
    504484      loopNb = 0; 
    505485    } 
     
    763743    if ((tmpOP = tmp->tplOptList) != NULL){ 
    764744      for (; tmpOP; tmpOP=tmpOP->next) { 
    765         fprintf(TPLFILE,"OpTId %hu (sourceId: %lu) >\n",  
     745        fprintf(TPLFILE,"OpTId %hu (sourceId: %lu) >\n lg: %hu, opScopeLg: %hu, opLg: %hu\n",  
    766746                tmpOP->templateOptionId, 
    767                 tmpOP->sourceId); 
     747                tmpOP->sourceId, 
     748                tmpOP->length, 
     749                tmpOP->optionScopeLg, 
     750                tmpOP->optionLg); 
    768751        printFieldSet(TPLFILE, tmpOP->fieldSet); 
    769752        fprintf(TPLFILE,"\n"); 
     
    773756  } 
    774757  fclose(TPLFILE); 
    775 } 
     758  fprintf (stderr, "end write file def template \n"); 
     759} 
  • trunk/src/renetcol.h

    r24 r27  
    8686#define MAX_MPLS_FLOW 200 
    8787 
    88 #define SHMSIZE 3000000 
     88#define SHMSIZE 33554432 
    8989 
    9090#define STEP 5  /* in min */ 
  • trunk/src/renetcolAgg.c

    r26 r27  
    2424 */ 
    2525 
     26/* 
     27 * In this file, I use directly the C rrd librairy to create and update 
     28 * the rrd files which contain the statistique for each subnet. 
     29 * When your system (CPU+MEM+HD) is too fast and the number of your subnet too big 
     30 * (> 1024), the create and update process can be too fast and before the  
     31 * creation end the maximum number of files which can be opened for one process 
     32 * in the same time is reached. So we must temporize. 
     33 */ 
     34 
    2635#include "renetcolAgg.h" 
    2736 
     
    3241{ 
    3342  int shmid; 
    34   int i, index; 
     43  int i, j, index; 
     44  int rrd_update_er_ct = 0; 
     45  int rrd_update_ok_ct = 0; 
     46  int rrd_already_created_ct = 0; 
     47  int rrd_create_er_ct = 0; 
     48  int rrd_create_ok_ct = 0; 
     49  int rrd_ct = 0; 
    3550  key_t key; 
    3651  static char buf[2048]; 
     
    3853  static char ipStr[20]; 
    3954  static char createstr[2048]; 
     55  char *opt[27]; 
     56  char *optUpdate[3]; 
    4057  int res_rrd = 0; 
    4158  FILE *fp; 
    42   static time_t now; 
    43  
     59  static time_t now, now2; 
     60   
    4461  key = 8765; 
    4562  if ((shmid = shmget(key, SHMSIZE, 0666)) < 0) { 
     
    7592        buf[0] = '\0'; 
    7693        strcat(name, RRD_LOCATION); 
    77         sprintf(ipStr, "%lu", shmForAgg->prefixV4Tab[index][i].beginning);  
     94        sprintf(ipStr, "%lu_%lu_%lu_%lu_%hu",  
     95                shmForAgg->prefixV4Tab[index][i].beginning>>24, 
     96                shmForAgg->prefixV4Tab[index][i].beginning<<8>>24, 
     97                shmForAgg->prefixV4Tab[index][i].beginning<<16>>24, 
     98                shmForAgg->prefixV4Tab[index][i].beginning<<24>>24, 
     99                shmForAgg->prefixV4Tab[index][i].mask 
     100                );  
    78101        strcat(name, ipStr); 
    79102        /*      strcat(name, SAMPLING_HERE); */ 
    80103        strcat(name, RRD_EXTENSION); 
    81         fprintf(stderr, "%s\n", name); 
    82104        if ( (fp=fopen(name,"r")) == NULL ){ 
    83           strcat(createstr, name); 
    84           strcat(createstr, END_RRD_CREATE); 
    85           fprintf(stderr, "%s\n", createstr); 
    86           res_rrd = wrap_rrd_create(createstr); 
    87         }else{ 
     105          opt[0]= (char *) malloc((strlen(RRD_PARAM_0) + 1) * sizeof(char)); 
     106          strcpy(opt[0], RRD_PARAM_0); 
     107          opt[1]= (char *) malloc((strlen(name) + 1) * sizeof(char)); 
     108          strcpy(opt[1], name); 
     109          opt[2]= (char *) malloc((strlen(RRD_PARAM_1) + 1) * sizeof(char)); 
     110          strcpy(opt[2], RRD_PARAM_1); 
     111          opt[3]= (char *) malloc((strlen(RRD_PARAM_2) + 1) * sizeof(char)); 
     112          strcpy(opt[3], RRD_PARAM_2); 
     113          opt[4]= (char *) malloc((strlen(RRD_PARAM_3) + 1) * sizeof(char)); 
     114          strcpy(opt[4], RRD_PARAM_3); 
     115          opt[5]= (char *) malloc((strlen(RRD_PARAM_4) + 1) * sizeof(char)); 
     116          strcpy(opt[5], RRD_PARAM_4); 
     117          opt[6]= (char *) malloc((strlen(RRD_PARAM_5) + 1) * sizeof(char)); 
     118          strcpy(opt[6], RRD_PARAM_5); 
     119          opt[7]= (char *) malloc((strlen(RRD_PARAM_6) + 1) * sizeof(char)); 
     120          strcpy(opt[7], RRD_PARAM_6); 
     121          opt[8]= (char *) malloc((strlen(RRD_PARAM_7) + 1) * sizeof(char)); 
     122          strcpy(opt[8], RRD_PARAM_7); 
     123          opt[9]= (char *) malloc((strlen(RRD_PARAM_8) + 1) * sizeof(char)); 
     124          strcpy(opt[9], RRD_PARAM_8); 
     125          opt[10]= (char *) malloc((strlen(RRD_PARAM_9) + 1) * sizeof(char)); 
     126          strcpy(opt[10], RRD_PARAM_9); 
     127          opt[12]= (char *) malloc((strlen(RRD_PARAM_10) + 1) * sizeof(char)); 
     128          strcpy(opt[11], RRD_PARAM_10); 
     129          opt[12]= (char *) malloc((strlen(RRD_PARAM_11) + 1) * sizeof(char)); 
     130          strcpy(opt[12], RRD_PARAM_11); 
     131          opt[13]= (char *) malloc((strlen(RRD_PARAM_12) + 1) * sizeof(char)); 
     132          strcpy(opt[13], RRD_PARAM_12); 
     133          opt[14]= (char *) malloc((strlen(RRD_PARAM_13) + 1) * sizeof(char)); 
     134          strcpy(opt[14], RRD_PARAM_13); 
     135          opt[15]= (char *) malloc((strlen(RRD_PARAM_14) + 1) * sizeof(char)); 
     136          strcpy(opt[15], RRD_PARAM_14); 
     137          opt[16]= (char *) malloc((strlen(RRD_PARAM_15) + 1) * sizeof(char)); 
     138          strcpy(opt[16], RRD_PARAM_15); 
     139          opt[17]= (char *) malloc((strlen(RRD_PARAM_16) + 1) * sizeof(char)); 
     140          strcpy(opt[17], RRD_PARAM_16); 
     141          opt[18]= (char *) malloc((strlen(RRD_PARAM_17) + 1) * sizeof(char)); 
     142          strcpy(opt[18], RRD_PARAM_17); 
     143          opt[19]= (char *) malloc((strlen(RRD_PARAM_18) + 1) * sizeof(char)); 
     144          strcpy(opt[19], RRD_PARAM_18); 
     145          opt[20]= (char *) malloc((strlen(RRD_PARAM_19) + 1) * sizeof(char)); 
     146          strcpy(opt[20], RRD_PARAM_19); 
     147          opt[21]= (char *) malloc((strlen(RRD_PARAM_20) + 1) * sizeof(char)); 
     148          strcpy(opt[21], RRD_PARAM_20); 
     149          opt[22]= (char *) malloc((strlen(RRD_PARAM_21) + 1) * sizeof(char)); 
     150          strcpy(opt[22], RRD_PARAM_21); 
     151          opt[23]= (char *) malloc((strlen(RRD_PARAM_22) + 1) * sizeof(char)); 
     152          strcpy(opt[23], RRD_PARAM_22); 
     153          opt[24]= (char *) malloc((strlen(RRD_PARAM_23) + 1) * sizeof(char)); 
     154          strcpy(opt[24], RRD_PARAM_23); 
     155          opt[25]= (char *) malloc((strlen(RRD_PARAM_24) + 1) * sizeof(char)); 
     156          strcpy(opt[25], RRD_PARAM_24); 
     157          opt[26]= (char *) malloc((strlen(RRD_PARAM_25) + 1) * sizeof(char)); 
     158          strcpy(opt[26], RRD_PARAM_25); 
     159          optind = opterr = 0; 
     160          rrd_clear_error(); 
     161          if ( rrd_create(27,opt) < 0) { 
     162            syslog(LOG_ERR, "RRD create file %s, error: %s\n", name, rrd_get_error()); 
     163            rrd_create_er_ct++; 
     164          } else { 
     165            rrd_create_ok_ct++; 
     166          } 
     167          for ( j=0; j<27; j++) { 
     168            free(opt[j]); 
     169            opt[j] = NULL; 
     170          } 
     171        }else{  
    88172          fclose(fp); 
    89         } 
    90      
    91         snprintf(buf, 2048, "%s%s%s %lu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu",  
    92                  RRD_LOCATION,  
    93                  ipStr, 
    94                  RRD_EXTENSION,  
    95                  now-300,  /* or ctime(&now) with %s */ 
    96                  shmForAgg->prefixV4Tab[index][i].flowNbIN,  /* 1  */ 
    97                  shmForAgg->prefixV4Tab[index][i].flowNbOUT, 
    98                  shmForAgg->prefixV4Tab[index][i].bytesNbIN, 
    99                  shmForAgg->prefixV4Tab[index][i].bytesNbOUT, 
    100                  shmForAgg->prefixV4Tab[index][i].pktsNbIN,  /* 5 */ 
    101                  shmForAgg->prefixV4Tab[index][i].pktsNbOUT, 
    102                  shmForAgg->prefixV4Tab[index][i].udpPktsNbIN, 
    103                  shmForAgg->prefixV4Tab[index][i].udpPktsNbOUT, 
    104                  shmForAgg->prefixV4Tab[index][i].tcpPktsNbIN, 
    105                  shmForAgg->prefixV4Tab[index][i].tcpPktsNbOUT, /* 10 */ 
    106                  shmForAgg->prefixV4Tab[index][i].icmpPktsNbIN, 
    107                  shmForAgg->prefixV4Tab[index][i].icmpPktsNbOUT, 
    108                  shmForAgg->prefixV4Tab[index][i].othersPktsNbIN, 
    109                  shmForAgg->prefixV4Tab[index][i].othersPktsNbOUT, 
    110                  shmForAgg->prefixV4Tab[index][i].udpBytesNbIN,  /* 15 */ 
    111                  shmForAgg->prefixV4Tab[index][i].udpBytesNbOUT, 
    112                  shmForAgg->prefixV4Tab[index][i].tcpBytesNbIN, 
    113                  shmForAgg->prefixV4Tab[index][i].tcpBytesNbOUT, 
    114                  shmForAgg->prefixV4Tab[index][i].icmpBytesNbIN, 
    115                  shmForAgg->prefixV4Tab[index][i].icmpBytesNbOUT,  /*  20 */ 
    116                  shmForAgg->prefixV4Tab[index][i].othersBytesNbIN, 
    117                  shmForAgg->prefixV4Tab[index][i].othersBytesNbOUT, 
    118                  shmForAgg->prefixV4Tab[index][i].udpFlowNbIN, 
    119                  shmForAgg->prefixV4Tab[index][i].udpFlowNbOUT, 
    120                  shmForAgg->prefixV4Tab[index][i].tcpFlowNbIN, /* 25 */ 
    121                  shmForAgg->prefixV4Tab[index][i].tcpFlowNbOUT, 
    122                  shmForAgg->prefixV4Tab[index][i].icmpFlowNbIN, 
    123                  shmForAgg->prefixV4Tab[index][i].icmpFlowNbOUT, 
    124                  shmForAgg->prefixV4Tab[index][i].othersFlowNbIN, 
    125                  shmForAgg->prefixV4Tab[index][i].othersFlowNbOUT  /* 30 */ 
    126                  ); 
    127         printf("\n%s\n", buf);  
    128         if ( (res_rrd = wrap_rrd_update(buf)) < 0 ) {  
    129           syslog(LOG_ERR, "wrap_rrd_update return : %d, param were : %s", res_rrd, buf); 
     173          rrd_already_created_ct++; 
     174          snprintf(buf,  
     175                   2048,  
     176                   "%lu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu",   
     177                   now-300,  /* or ctime(&now) with %s */ 
     178                   shmForAgg->prefixV4Tab[index][i].flowNbIN,  /* 1 */ 
     179                   shmForAgg->prefixV4Tab[index][i].flowNbOUT, 
     180                   shmForAgg->prefixV4Tab[index][i].bytesNbIN, 
     181                   shmForAgg->prefixV4Tab[index][i].bytesNbOUT, 
     182                   shmForAgg->prefixV4Tab[index][i].pktsNbIN,  /* 5 */ 
     183                   shmForAgg->prefixV4Tab[index][i].pktsNbOUT, 
     184                   shmForAgg->prefixV4Tab[index][i].firstCoSIN, 
     185                   shmForAgg->prefixV4Tab[index][i].firstCoSOUT, 
     186                   shmForAgg->prefixV4Tab[index][i].secondCoSIN, 
     187                   shmForAgg->prefixV4Tab[index][i].secondCoSOUT, 
     188                   shmForAgg->prefixV4Tab[index][i].thirdCoSIN, 
     189                   shmForAgg->prefixV4Tab[index][i].thirdCoSOUT, 
     190                   shmForAgg->prefixV4Tab[index][i].fourthCoSIN, 
     191                   shmForAgg->prefixV4Tab[index][i].fourthCoSOUT 
     192                   ); 
     193          optUpdate[0]= (char *) malloc((strlen(RRD_UPDATE_0) + 1) * sizeof(char)); 
     194          strcpy(optUpdate[0], RRD_UPDATE_0); 
     195          optUpdate[1]= (char *) malloc((strlen(name) + 1) * sizeof(char)); 
     196          strcpy(optUpdate[1], name); 
     197          optUpdate[2]= (char *) malloc((strlen(buf) + 1) * sizeof(char)); 
     198          strcpy(optUpdate[2], buf); 
     199          optind = opterr = 0;  
     200          rrd_clear_error(); 
     201          if ( rrd_update(3, optUpdate) < 0 ) {  
     202            syslog(LOG_ERR, "RRD update file %s, error: %s\n", name, rrd_get_error()); 
     203            rrd_update_er_ct++; 
     204          } else { 
     205            rrd_update_ok_ct++; 
     206          } 
     207          for ( j=0; j<3; j++) { 
     208            free(optUpdate[j]); 
     209            optUpdate[j] = NULL; 
     210          } 
    130211        } 
    131212        /* Reinit the shared table */ 
     
    133214        shmForAgg->prefixV4Tab[index][i].bytesNbIN = 0; 
    134215        shmForAgg->prefixV4Tab[index][i].pktsNbIN = 0; 
    135         shmForAgg->prefixV4Tab[index][i].udpPktsNbIN = 0; 
    136         shmForAgg->prefixV4Tab[index][i].tcpPktsNbIN = 0; 
    137         shmForAgg->prefixV4Tab[index][i].icmpPktsNbIN = 0; 
    138         shmForAgg->prefixV4Tab[index][i].othersPktsNbIN = 0; 
    139         shmForAgg->prefixV4Tab[index][i].udpBytesNbIN = 0; 
    140         shmForAgg->prefixV4Tab[index][i].tcpBytesNbIN = 0; 
    141         shmForAgg->prefixV4Tab[index][i].icmpBytesNbIN = 0; 
    142         shmForAgg->prefixV4Tab[index][i].othersBytesNbIN = 0; 
    143         shmForAgg->prefixV4Tab[index][i].udpFlowNbIN = 0; 
    144         shmForAgg->prefixV4Tab[index][i].tcpFlowNbIN = 0; 
    145         shmForAgg->prefixV4Tab[index][i].icmpFlowNbIN = 0; 
    146         shmForAgg->prefixV4Tab[index][i].othersFlowNbIN = 0; 
    147216        shmForAgg->prefixV4Tab[index][i].flowNbOUT = 0; 
    148217        shmForAgg->prefixV4Tab[index][i].bytesNbOUT = 0; 
    149218        shmForAgg->prefixV4Tab[index][i].pktsNbOUT = 0; 
    150         shmForAgg->prefixV4Tab[index][i].udpPktsNbOUT = 0; 
    151         shmForAgg->prefixV4Tab[index][i].tcpPktsNbOUT = 0; 
    152         shmForAgg->prefixV4Tab[index][i].icmpPktsNbOUT = 0; 
    153         shmForAgg->prefixV4Tab[index][i].othersPktsNbOUT = 0; 
    154         shmForAgg->prefixV4Tab[index][i].udpBytesNbOUT = 0; 
    155         shmForAgg->prefixV4Tab[index][i].tcpBytesNbOUT = 0; 
    156         shmForAgg->prefixV4Tab[index][i].icmpBytesNbOUT = 0; 
    157         shmForAgg->prefixV4Tab[index][i].othersBytesNbOUT = 0; 
    158         shmForAgg->prefixV4Tab[index][i].udpFlowNbOUT = 0; 
    159         shmForAgg->prefixV4Tab[index][i].tcpFlowNbOUT = 0; 
    160         shmForAgg->prefixV4Tab[index][i].icmpFlowNbOUT = 0; 
    161         shmForAgg->prefixV4Tab[index][i].othersFlowNbOUT = 0;    
     219        shmForAgg->prefixV4Tab[index][i].firstCoSIN = 0; 
     220        shmForAgg->prefixV4Tab[index][i].secondCoSIN = 0; 
     221        shmForAgg->prefixV4Tab[index][i].thirdCoSIN = 0; 
     222        shmForAgg->prefixV4Tab[index][i].fourthCoSIN = 0; 
     223        shmForAgg->prefixV4Tab[index][i].firstCoSOUT = 0; 
     224        shmForAgg->prefixV4Tab[index][i].secondCoSOUT = 0; 
     225        shmForAgg->prefixV4Tab[index][i].thirdCoSOUT = 0; 
     226        shmForAgg->prefixV4Tab[index][i].fourthCoSOUT = 0; 
    162227      } 
     228      now2 = time((time_t *)NULL); 
     229      fprintf(stderr, "IPv4 subnet managment (rrd update) : \n %d sec, %d files updated, %d errors, total %d\n %d rrd file already created, %d errors in creation, %d new rrd file creations", 
     230              now2-now, 
     231              rrd_update_ok_ct, 
     232              rrd_update_er_ct, 
     233              rrd_update_ok_ct+rrd_update_er_ct, 
     234              rrd_already_created_ct, 
     235              rrd_create_er_ct, 
     236              rrd_create_ok_ct); 
     237      rrd_update_ok_ct = 0; 
     238      rrd_update_er_ct = 0; 
     239      rrd_already_created_ct = 0; 
     240      rrd_create_er_ct = 0; 
     241      rrd_create_ok_ct = 0; 
     242      rrd_clear_error(); 
    163243    } 
    164244    sleep(5); 
  • trunk/src/renetcolAgg.h

    r25 r27  
    3838#include <sys/sem.h> 
    3939 
     40#include "rrd.h" 
    4041#include "rrdwrap.h" 
    4142#include "dataFlowSet.h" 
    4243 
    43 #define RRD_LOCATION "" 
     44#define RRD_LOCATION "/home/maintenance/RRD/" 
    4445#define RRD_EXTENSION ".rrd" 
    45 #define END_RRD_CREATE " --start 1106560200 DS:inFlows:GAUGE:600:U:U DS:outFlows:GAUGE:600:U:U DS:inBytes:GAUGE:600:U:U DS:outBytes:GAUGE:600:U:U DS:inPkts:GAUGE:600:U:U DS:outPkts:GAUGE:600:U:U DS:inUdpPkts:GAUGE:600:U:U DS:outUdpPkts:GAUGE:600:U:U DS:inTcpPkts:GAUGE:600:U:U DS:outTcpPkts:GAUGE:600:U:U DS:inIcmpPkts:GAUGE:600:U:U DS:outIcmpPkts:GAUGE:600:U:U DS:inOthersPkts:GAUGE:600:U:U DS:outOthersPkts:GAUGE:600:U:U DS:inUdpBytes:GAUGE:600:U:U DS:outUdpBytes:GAUGE:600:U:U DS:inTcpBytes:GAUGE:600:U:U DS:outTcpBytes:GAUGE:600:U:U DS:inIcmpBytes:GAUGE:600:U:U DS:outIcmpBytes:GAUGE:600:U:U DS:inOthersBytes:GAUGE:600:U:U DS:outOthersBytes:GAUGE:600:U:U DS:inUdpFlows:GAUGE:600:U:U DS:outUdpFlows:GAUGE:600:U:U DS:inTcpFlows:GAUGE:600:U:U DS:outTcpFlows:GAUGE:600:U:U DS:inIcmpFlows:GAUGE:600:U:U DS:outIcmpFlows:GAUGE:600:U:U DS:inOthersFlows:GAUGE:600:U:U DS:outOthersFlows:GAUGE:600:U:U RRA:AVERAGE:0.5:1:2100 RRA:AVERAGE:0.5:24:1550 RRA:AVERAGE:0.5:288:1594 RRA:AVERAGE:0.5:2016:1040 RRA:MAX:0.5:1:2100 RRA:MAX:0.5:24:1550 RRA:MAX:0.5:288:1594 RRA:MAX:0.5:2016:1040" 
    46 #define SHMSIZE 3000000 
     46 
     47#define RRD_PARAM_0 "rrdcreate" 
     48#define RRD_PARAM_1 "--start" 
     49#define RRD_PARAM_2 "1106560200" 
     50#define RRD_PARAM_3 "--step" 
     51#define RRD_PARAM_4 "300" 
     52#define RRD_PARAM_5 "DS:inFlows:GAUGE:600:U:U" 
     53#define RRD_PARAM_6 "DS:outFlows:GAUGE:600:U:U" 
     54#define RRD_PARAM_7 "DS:inBytes:GAUGE:600:U:U" 
     55#define RRD_PARAM_8 "DS:outBytes:GAUGE:600:U:U" 
     56#define RRD_PARAM_9 "DS:inPkts:GAUGE:600:U:U" 
     57#define RRD_PARAM_10 "DS:outPkts:GAUGE:600:U:U" 
     58#define RRD_PARAM_11 "DS:inFirstCoS:GAUGE:600:U:U" 
     59#define RRD_PARAM_12 "DS:outFirstCoS:GAUGE:600:U:U" 
     60#define RRD_PARAM_13 "DS:inSecondCoS:GAUGE:600:U:U" 
     61#define RRD_PARAM_14 "DS:outSecondCoS:GAUGE:600:U:U" 
     62#define RRD_PARAM_15 "DS:inThirdCoS:GAUGE:600:U:U" 
     63#define RRD_PARAM_16 "DS:outThirdCoS:GAUGE:600:U:U" 
     64#define RRD_PARAM_17 "DS:inFourthCoS:GAUGE:600:U:U" 
     65#define RRD_PARAM_18 "DS:outFourthCoS:GAUGE:600:U:U" 
     66#define RRD_PARAM_19 "RRA:AVERAGE:0.5:1:2100" 
     67#define RRD_PARAM_20 "RRA:AVERAGE:0.5:24:1550" 
     68#define RRD_PARAM_21 "RRA:AVERAGE:0.5:288:1594" 
     69#define RRD_PARAM_22 "RRA:AVERAGE:0.5:2016:1040" 
     70#define RRD_PARAM_23 "RRA:MAX:0.5:1:2100" 
     71#define RRD_PARAM_24 "RRA:MAX:0.5:24:1550" 
     72#define RRD_PARAM_25 "RRA:MAX:0.5:288:1594" 
     73 
     74#define RRD_UPDATE_0 "rrdupdate" 
     75 
     76#define SHMSIZE 33554432 /* FIXME get from another file ? */ 
    4777 
    4878struct SHMForAgg { 
  • trunk/src/routers_mgmt.c

    r2 r27  
    2929{ 
    3030  RouterPtr tmp = rL; 
     31  int i = 0; 
    3132  for ( ; tmp; tmp=tmp->next) { 
     33    i++; 
    3234    if ( tmp->IpAddress == address ){ 
     35/*       fprintf (stderr, "ExistRouter %d parcours %lu.%lu.%lu.%lu\ \n",  */ 
     36/*             i, */ 
     37/*             address>>24, */ 
     38/*             address<<8>>24, */ 
     39/*             address<<16>>24, */ 
     40/*             address<<24>>24 */ 
     41/*             ); */ 
    3342      return tmp; 
    3443    } 
    3544  } 
     45/*   fprintf (stderr, "notExistRouter %lu.%lu.%lu.%lu\n", */ 
     46/*         address>>24, */ 
     47/*         address<<8>>24, */ 
     48/*         address<<16>>24, */ 
     49/*         address<<24>>24); */ 
    3650  return NULL; 
    3751} 
     
    4256  RouterPtr tmp = (RouterPtr) malloc(sizeof(struct Router)); 
    4357  if (tmp==NULL) { 
     58    /* FIXME : syslog here */ 
    4459    fprintf(stderr, "ERROR in malloc in add_routers function\n"); 
    4560    exit(1); 
     
    7489  if (ptpl) { 
    7590    while ( ptpl->fieldSet != NULL ){ 
     91/*       fprintf(stderr, "deleteTplFlSet\n"); */ 
    7692      if (!(ptpl->lastField->prev)) { 
    7793        freeField(ptpl->lastField); 
     
    111127  if (ptplo) { 
    112128    while ( ptplo->fieldSet != NULL ){ 
     129/*       fprintf(stderr, "deleteTplFlSet\n"); */ 
    113130      if (!(ptplo->lastField->prev)) { 
    114131        freeField(ptplo->lastField); 
  • trunk/src/rrdwrap.c

    r17 r27  
    22 
    33/*      Contributed by Antony Clothier */ 
     4 
     5/*  Ligne 152 commented FXA*/ 
    46 
    57#include "rrdwrap.h" 
     
    148150      opterr=0; /* no error messages */ 
    149151       
    150       i = rrd_graph(argc, argv, prdata, &xsize, &ysize); 
     152/*       i = rrd_graph(argc, argv, prdata, &xsize, &ysize); */ 
    151153       
    152154      /*        free up the memory*/ 
  • trunk/src/rules_mgmt.c

    r17 r27  
    8282      printHostDef(rPtr->host); 
    8383    } 
    84     invPrintFieldSet(rPtr->fieldToRecord); 
     84/*     invPrintFieldSet(rPtr->fieldToRecord); */ 
    8585    printRule(rPtr->next); 
    8686  } 
     
    174174  int cptLine; 
    175175   
    176   if (!(ruleFile = fopen(filename, "r"))) { 
     176  if ((ruleFile = fopen(filename, "r")) == NULL) { 
    177177    syslog(LOG_ERR, "error during %s opening\n", filename); 
    178178    exit(1); 
     
    469469      if ((ft==1) || (ft==25)){ 
    470470          tmp->value = addValue(tmp->value, operatorToNumber, value); 
    471       } else if ( (ft==8) || (ft==12) || (ft==15) || (ft==18) ){ 
     471      } else if ( (ft==0) || (ft==8) || (ft==12) || (ft==15) || (ft==18) ){ 
    472472          tmp->value = addAddress(tmp->value, operatorToNumber, value); 
    473473      } else if ( (ft==27) || (ft==28) || (ft==62) || (ft==63) ){ 
  • trunk/src/template.c

    r23 r27  
    5353 * it can exist many templates definitions in a template flowset 
    5454 */ 
    55 unsigned short  
     55short  
    5656checkTemplateFlowSet(RouterPtr cr, unsigned short *offV9,  
    5757                     unsigned char *buf,  
     
    6969  unsigned short getFlowsetId = 0; 
    7070  unsigned short length = 0; 
    71   TplFlowSetPtr ptpltmp; 
     71  TplFlowSetPtr ptpltmp = NULL; 
    7272  /* for msg sending: */ 
    7373  msgType myMsg; 
     
    7575  char *msgTextIndex; 
    7676  unsigned short tplMsgType = 1; 
     77  unsigned short badFieldNumber = 0; 
     78  unsigned short badFieldLength = 0; 
    7779 
    7880  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    8385  length = *((unsigned short*)&buffer2); 
    8486  do { 
     87    fprintf (stderr, " TD \n"); 
     88    badFieldNumber = 0; 
     89    badFieldLength = 0; 
    8590    buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    8691    buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    102107        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    103108        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    104         fldPtr->fieldType = *((unsigned short*)&buffer2); 
    105         buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    106         buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    107         fldPtr->fieldLength = *((unsigned short*)&buffer2); 
     109        if ( (fldPtr->fieldType = *((unsigned short*)&buffer2) ) > 89) { 
     110          badFieldNumber = 1; 
     111        } 
     112        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     113        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     114        if ( (fldPtr->fieldLength = *((unsigned short*)&buffer2) ) > 16) { 
     115          badFieldLength = 1; 
     116        } 
    108117        fldPtr->next = cTFSPtr->fieldSet; 
    109118        fldPtr->prev = NULL; 
     
    114123        } 
    115124        cpt_fields++; 
    116         if ( cpt_fields > 40 ) { /* FIXME : declarer une constante pour cela */ 
    117           fprintf(stderr,"IP: %lu \n",cr->IpAddress); 
    118           fprintf (stderr, "cTFSPtr->templateFlowSetId: %hu\n",  
     125        if ( (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { /* FIXME : constante pour cela */ 
     126          fprintf(stderr,"\n IP: %lu.%lu.%lu.%lu, %d,%d\n", 
     127                  cr->IpAddress>>24, 
     128                  cr->IpAddress<<8>>24, 
     129                  cr->IpAddress<<16>>24, 
     130                  cr->IpAddress<<24>>24, 
     131                  badFieldNumber, 
     132                  badFieldLength 
     133                  ); 
     134          fprintf (stderr, "\n cTFSPtr->templateFlowSetId: %hu\n",  
    119135                   cTFSPtr->templateFlowSetId); 
    120136          while ( ((*offV9))> (index)){ 
     
    125141          } 
    126142          syslog (LOG_INFO,  
    127                   "fields nb too large, bug collector or wrong template def");  
    128           cTFSPtr = deleteTplFlSet(cTFSPtr); 
    129         } 
     143                  "in new template: field nb gt 89, field lg gt 16 or too many fields, bad template definition possibility"); 
     144          fprintf(stderr,  
     145                  "\n in new template function: too many fields, bug collector or wrong template def \n");  
     146          ptpltmp = cTFSPtr; 
     147          if (ptpltmp->prev == NULL) { 
     148            cr->tplList = ptpltmp->next; 
     149            if (cr->tplList) { 
     150              cr->tplList->prev = NULL; 
     151            } 
     152          } else { 
     153            ptpltmp->prev->next = ptpltmp->next; 
     154            if (ptpltmp->next) { 
     155              ptpltmp->next->prev = ptpltmp->prev; 
     156            } 
     157          } 
     158          deleteTplFlSet(ptpltmp); 
     159          cTFSPtr = NULL; 
     160          return (-1); 
     161        } 
     162        fprintf (stderr, "t for new \n"); 
    130163      } 
    131164    } else { /*update*/ 
     
    158191        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    159192        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    160         fldPtr->fieldType = *((unsigned short*)&buffer2); 
    161         buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    162         buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    163         fldPtr->fieldLength = *((unsigned short*)&buffer2); 
     193        if ( (fldPtr->fieldType = *((unsigned short*)&buffer2) ) > 89) { 
     194          badFieldNumber = 1; 
     195        } 
     196        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     197        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     198        if ( (fldPtr->fieldLength = *((unsigned short*)&buffer2) ) > 16) { 
     199          badFieldLength = 1; 
     200        } 
    164201        fldPtr->next = cTFSPtr->fieldSet; 
    165202        fldPtr->prev = NULL; 
     
    172209        } 
    173210        cpt_fields++; 
    174         if ( cpt_fields > 40 ) { /* FIXME : declarer une constante pour cela */ 
     211        if ( (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { /* FIXME : declarer une constante pour cela */ 
    175212          while ( ((*offV9))> (index)){ 
    176213            buffer2[1]= *(buf+index); index++; 
     
    180217          } 
    181218          syslog (LOG_INFO,  
    182                   "fields nb too large, bug collector or wrong template def");  
    183           cTFSPtr = deleteTplFlSet(cTFSPtr); 
    184         } 
     219                  "in update template function: too many fields, bug collector or wrong template def in template update"); 
     220          fprintf(stderr, 
     221                  "\nin update template function: too many fields, bug collector or wrong template def in template update\n"); 
     222          ptpltmp = cTFSPtr; 
     223          if (ptpltmp->prev == NULL) { 
     224            cr->tplList = ptpltmp->next; 
     225            if (cr->tplList) { 
     226              cr->tplList->prev = NULL; 
     227            } 
     228          } else { 
     229            ptpltmp->prev->next = ptpltmp->next; 
     230            if (ptpltmp->next) { 
     231              ptpltmp->next->prev = ptpltmp->prev; 
     232            } 
     233          } 
     234          deleteTplFlSet(ptpltmp); 
     235          cTFSPtr = NULL; 
     236          return (-1);     
     237        } 
     238        fprintf (stderr, "t for up \n"); 
    185239      } 
    186240    } /* end if template creation or update */ 
     
    232286 * 
    233287 */ 
    234 unsigned short  
     288short  
    235289checkTemplateOption(RouterPtr cr, unsigned short *offV9,  
    236290                    unsigned char *buf, NetFlowV9HeaderPtr v9Ptr, 
     
    244298  unsigned char buffer2[2]; 
    245299  TplOptionPtr ptplotmp; 
     300  unsigned short badFieldNumber = 0; 
     301  unsigned short badFieldLength = 0; 
     302  int cpt_fields = 0; 
    246303 
    247304  buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    252309  length = *((unsigned short*)&buffer2); 
    253310  do { 
     311    fprintf (stderr, " TO \n"); 
     312    badFieldNumber = 0; 
     313    badFieldLength = 0; 
    254314    buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    255315    buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     
    269329      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    270330      cTOPtr->optionLg = *((unsigned short*)&buffer2); 
     331      cpt_fields = 0; 
    271332      for ( i=0; i<(((cTOPtr->optionScopeLg)+(cTOPtr->optionLg))/4); i++) { 
    272333        FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 
    273334        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    274335        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    275         tmp->fieldType = *((unsigned short*)&buffer2); 
    276         buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    277         buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    278         tmp->fieldLength = *((unsigned short*)&buffer2); 
     336        if ( (tmp->fieldType = *((unsigned short*)&buffer2) ) > 89) { 
     337          badFieldNumber = 1; 
     338        } 
     339        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     340        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     341        if ( (tmp->fieldLength = *((unsigned short*)&buffer2) ) > 16) { 
     342          badFieldLength = 1; 
     343        } 
    279344        tmp->next = cTOPtr->fieldSet; 
    280345        tmp->prev = NULL; 
     
    284349          cTOPtr->lastField = tmp; 
    285350        } 
     351        cpt_fields++; 
     352        if ( (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { 
     353          syslog (LOG_INFO,  
     354                  "in option template function: too many fields, bug collector or wrong template def in template update"); 
     355          fprintf(stderr, 
     356                  "\nin option template function: too many fields, bug collector or wrong template def in template update\n"); 
     357          ptplotmp = cTOPtr; 
     358          if (ptplotmp->prev == NULL) { 
     359            cr->tplOptList = ptplotmp->next; 
     360            if (cr->tplOptList) { 
     361              cr->tplOptList->prev = NULL; 
     362            } 
     363          } else { 
     364            ptplotmp->prev->next = ptplotmp->next; 
     365            if (ptplotmp->next) { 
     366              ptplotmp->next->prev = ptplotmp->prev; 
     367            } 
     368          } 
     369          deleteTplOption(ptplotmp); 
     370          cTOPtr = NULL; 
     371          return (-1); 
     372        } 
     373        fprintf (stderr, "to for new \n"); 
    286374      } 
    287375      while ((*offV9)%4 != 0) { 
    288376        (*offV9)++; cpt++; 
     377        fprintf (stderr, " TO new padding \n"); 
    289378      } /*padding case*/ 
    290379    } else { /*update */ 
     
    315404      buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    316405      cTOPtr->optionLg = *((unsigned short*)&buffer2); 
     406      cpt_fields = 0; 
    317407      for ( i=0; i<(((cTOPtr->optionScopeLg)+(cTOPtr->optionLg))/4); i++) { 
    318408        FieldPtr tmp = (FieldPtr) malloc(sizeof(struct Field)); 
    319409        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    320410        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    321         tmp->fieldType = *((unsigned short*)&buffer2); 
    322         buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    323         buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
    324         tmp->fieldLength = *((unsigned short*)&buffer2); 
     411        if ( (tmp->fieldType = *((unsigned short*)&buffer2) ) > 89) { 
     412          badFieldNumber = 1; 
     413        } 
     414        buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     415        buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 
     416        if ( (tmp->fieldLength = *((unsigned short*)&buffer2) ) > 16) { 
     417          badFieldLength = 1; 
     418        } 
    325419        tmp->next = cTOPtr->fieldSet; 
    326420        tmp->prev = NULL; 
     
    330424          cTOPtr->lastField = tmp; 
    331425        } 
     426        cpt_fields++; 
     427        if ( (cpt_fields > 40) || (badFieldNumber == 1) || badFieldLength == 1) { 
     428          syslog (LOG_INFO,  
     429                  "in update option tpl function: too many fields, bug collector or wrong template def in template update"); 
     430          fprintf(stderr, 
     431                  "\nin update option tpl function: too many fields, bug collector or wrong template def in template update\n"); 
     432          ptplotmp = cTOPtr; 
     433          if (ptplotmp->prev == NULL) { 
     434            cr->tplOptList = ptplotmp->next; 
     435            if (cr->tplOptList) { 
     436              cr->tplOptList->prev = NULL; 
     437            } 
     438          } else { 
     439            ptplotmp->prev->next = ptplotmp->next; 
     440            if (ptplotmp->next) { 
     441              ptplotmp->next->prev = ptplotmp->prev; 
     442            } 
     443          } 
     444          deleteTplOption(ptplotmp); 
     445          cTOPtr = NULL; 
     446          return (-1); 
     447        } 
     448        fprintf (stderr, "to for up \n"); 
    332449      } 
    333450      while ((*offV9)%4 != 0) { 
    334451        (*offV9)++; cpt++; 
     452        fprintf (stderr, " TO update padding \n"); 
    335453      } /*padding case*/ 
    336454    } 
     
    338456  } while ((cpt) < (length-2)); 
    339457/*   show_all_tplFlSet(); */ 
     458  fprintf (stderr, "to return %d \n", length); 
    340459  return length; 
    341460} 
  • trunk/src/template.h

    r2 r27  
    3434 
    3535short getFlowsetId(short, unsigned short *, unsigned char *); 
    36 unsigned short checkTemplateFlowSet(RouterPtr, unsigned short *, 
     36short checkTemplateFlowSet(RouterPtr, unsigned short *, 
    3737                                    unsigned char *, 
    3838                                    NetFlowV9HeaderPtr, 
    3939                                    TplFlowSetPtr, short *, int); 
    40 unsigned short checkTemplateOption(RouterPtr, unsigned short *,  
     40short checkTemplateOption(RouterPtr, unsigned short *,  
    4141                                   unsigned char *,  
    4242                                   NetFlowV9HeaderPtr, 
  • trunk/tool/renetcolGUI_0_0_3.py

    r18 r27  
    589589            coll_hbox.set_border_width(5) 
    590590            coll_frame.add(coll_hbox) 
    591             button = gtk.CheckButton(" router ") 
     591##            button = gtk.CheckButton(" router ") 
    592592            button.connect("toggled", callback_check_rule, None) 
    593593            coll_hbox.pack_start(button, False, False, 0) 
    594             mainTT.set_tip(button, "Check it to capture all flows from one router and enter the IPv4 address of this router. NOT SUPPORTED IN THIS RELEASE") 
    595             button.show() 
     594            mainTT.set_tip(button, "Check it to capture all flows from one router and enter the IPv4 address of this router. IN TEST") 
     595##            button.show() 
    596596            coll_pbbox = gtk.HButtonBox() 
    597597            coll_hbox.pack_start(coll_pbbox, False, True, 5) 
    598             prefix_entry(45, "Required Format : \n <field> <operation> <address>\nlike 8 = 10.0.0.1 \nor 8 = 10.0.1.0/24 \nor 27 = 2001::1 \nor 27 = 2001::/64 (IPv6 address only on Linux system)\nonly '=' operator for the moment\n------------------------------\nIn this version 0.0.2, you can compare the following fields:\nIPV4_SRC_ADDR: 8\nIPV4_DST_ADDR: 12\nIPV4_NEXT_HOP: 15\nBGP_IPV4_NEXT_HOP: 18\nIPV6_SRC_ADDR: 27\nIPV6_DST_ADDR: 28\nIPV6_NEXT_HOP: 62\nBPG_IPV6_NEXT_HOP: 63\nIP_PROTOCOL_VERSION: 60\n---------------------------", coll_pbbox, "", 0) 
     598            prefix_entry(45, "Required Format : \n <field> <operation> <address>\nlike 8 = 10.0.0.1 \nor 8 = 10.0.1.0/24 \nor 27 = 2001::1 \nor 27 = 2001::/64 (IPv6 address only on Linux system)\nonly '=' operator for the moment\n------------------------------\nIn this version 0.0.7, you can compare the following fields:\nROUTER_SRC_ADDR: 0\nIPV4_SRC_ADDR: 8\nIPV4_DST_ADDR: 12\nIPV4_NEXT_HOP: 15\nBGP_IPV4_NEXT_HOP: 18\nIPV6_SRC_ADDR: 27\nIPV6_DST_ADDR: 28\nIPV6_NEXT_HOP: 62\nBPG_IPV6_NEXT_HOP: 63\nIP_PROTOCOL_VERSION: 60\n---------------------------", coll_pbbox, "", 0) 
    599599            coll_frame2 = gtk.Frame("Disable rules") 
    600600            coll_vbox.pack_start(coll_frame2, False, False, 5) 
     
    724724            operator = rule[1] 
    725725            value = rule[2] 
    726             if (field=='8' or field=='12' or field=='15' or field=='18' or field=='47'): 
     726            if (field=='0' or field=='8' or field=='12' or field=='15' or field=='18' or field=='47'): 
    727727                if (re.match('^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?$',value)): 
    728728                    splitter = value.split('/') 
     
    992992 
    993993    print "---------------------------------------------------------------" 
    994     print "In this version 0.0.3, you can apply rules on the collector based on the following fields:" 
     994    print "In this version 0.0.7, you can apply rules on the collector based on the following fields:" 
    995995    print "IPV4_SRC_ADDR: 8," 
    996996    print "IPV4_DST_ADDR: 12," 
     
    10021002    print "IPV6_NEXT_HOP: 62," 
    10031003    print "BPG_IPV6_NEXT_HOP: 63," 
    1004     print "IP_PROTOCOL_VERSION: 60" 
     1004    print "IP_PROTOCOL_VERSION: 60, please note that the IPv4 template don't have this field" 
     1005    print "ROUTER_SRC_ADDR: 0, here it's not a real number for a field" 
    10051006    print "----------------------------------------------------------------" 
    10061007