Changeset 96 for trunk/src/renetcol.c

Show
Ignore:
Timestamp:
02/12/09 17:54:45 (14 years ago)
Author:
andreu
Message:

IPV6 links aggregation UP

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/renetcol.c

    r95 r96  
    101101 
    102102#if defined(IPV4AGGIDR) 
    103   fprintf(stderr, "renetcol compilation and execution with IPv4 Aggregation feature enable based on routers ID in %s file.\n", ROUTERS_LIST); 
     103  fprintf(stderr, "renetcol compilation and execution with IPv4 Prefixes Aggregation feature enable based on routers ID in %s file.\n", ROUTERS_LIST); 
    104104#endif 
    105105 
    106106#if defined(IPV4AGGIDSNMP) 
    107   fprintf(stderr, "renetcol compilation and execution with IPv4 Aggregation feature enable based on SNMP ID in %s file.\n", INTERFACES_TYPE_LIST); 
     107  fprintf(stderr, "renetcol compilation and execution with IPv4 Prefixes Aggregation feature enable based on SNMP ID in %s file.\n", INTERFACES_TYPE_LIST); 
    108108#endif 
    109109#if defined(IPV6AGGIDSNMP) 
    110   fprintf(stderr, "renetcol compilation and execution with IPv6 Aggregation feature enable based on SNMP ID in %s file.\n", INTERFACES_TYPE_LIST); 
     110  fprintf(stderr, "renetcol compilation and execution with IPv6 Prefixes Aggregation feature enable based on SNMP ID in %s file.\n", INTERFACES_TYPE_LIST); 
    111111#endif 
    112112#if defined(IPV6LINKAGG) 
     
    166166  } 
    167167#if defined(IPV6AGGIDSNMP) 
    168 fprintf(stderr, "ci0\n"); 
    169168  if ( (shmForAgg->v6PrefixNb =  
    170169        getPrefixV6(SUBNETS_V6_LIST,  
     
    184183    exit(1); 
    185184  } 
    186 fprintf(stderr, "ci00\n"); 
    187185#endif 
    188186 
     
    236234    exit(4); 
    237235  } 
    238 fprintf(stderr, " handler, SIGUSR1 from renetcolSender\n"); 
    239236  /* handler, SIGUSR1 from renetcolSender */ 
    240237  myAction.sa_handler = sigusr1Mgmt; 
     
    244241  sigaction (SIGUSR1, &myAction, NULL); 
    245242 
    246 fprintf(stderr, " Cache for fast rules access\n"); 
    247243  /* Cache for fast rules access */ 
    248244  setCache(myPtrs.rulesListPtr); 
    249245  myPtrs.rulesAddressPtr = (RuleDefPtr *)rulesAddress; 
    250 fprintf(stderr, "IPC messages queue init\n"); 
    251246  /* IPC messages queue init */ 
    252247  myKey = createKey(argv[0]); 
    253248  myQueue = createQueue(myKey); 
    254249  sendMyPid(myQueue); 
    255 fprintf(stderr, "get SNMP index information\n"); 
    256250  /* get SNMP index information */ 
    257251#ifdef IPV4AGGIDSNMP 
     
    272266  myPtrs.secondV4Tab = shmForAgg->prefixV4Tab[shmForAgg->secondTable]; 
    273267#ifdef IPV6AGGIDSNMP 
    274 fprintf(stderr, "ci1\n"); 
    275268  myPtrs.currentV6Tab = shmForAgg->prefixV6Tab[shmForAgg->currentTable]; 
    276269  myPtrs.secondV6Tab = shmForAgg->prefixV6Tab[shmForAgg->secondTable]; 
    277270#endif 
    278271#ifdef IPV6LINKAGG 
    279 fprintf(stderr, "ci2\n"); 
    280272  myPtrs.currentV6IndexTab = shmForAgg->indexV6Tab[shmForAgg->currentTable]; 
    281273  myPtrs.secondV6IndexTab = shmForAgg->indexV6Tab[shmForAgg->secondTable]; 
    282 fprintf(stderr, "ci3\n"); 
    283274#endif 
    284275#ifdef ASACC 
     
    306297  /* INIT IPV6 index TABLES */ 
    307298#ifdef IPV6LINKAGG 
    308 fprintf(stderr, "ci\n"); 
    309299  for (i=0; i<ROUTER_INDEX_MAX; i++){ 
    310300    for (j=0; j<MAX_INDEX_BY_ROUTER; j++) { 
     301      shmForAgg->indexV6Tab[0][i][j].hasStats = 0; 
     302      shmForAgg->indexV6Tab[0][i][j].sampling = 0; 
    311303      shmForAgg->indexV6Tab[0][i][j].bytesNbIN = 0; 
    312304      shmForAgg->indexV6Tab[0][i][j].pktsNbIN = 0; 
    313305      shmForAgg->indexV6Tab[0][i][j].flowNbIN = 0; 
     306      shmForAgg->indexV6Tab[0][i][j].bytesNbOUT = 0; 
     307      shmForAgg->indexV6Tab[0][i][j].pktsNbOUT = 0; 
     308      shmForAgg->indexV6Tab[0][i][j].flowNbOUT = 0; 
     309      shmForAgg->indexV6Tab[1][i][j].hasStats = 0; 
     310      shmForAgg->indexV6Tab[1][i][j].sampling = 0; 
     311      shmForAgg->indexV6Tab[1][i][j].bytesNbIN = 0; 
     312      shmForAgg->indexV6Tab[1][i][j].pktsNbIN = 0; 
     313      shmForAgg->indexV6Tab[1][i][j].flowNbIN = 0; 
    314314      shmForAgg->indexV6Tab[1][i][j].bytesNbOUT = 0; 
    315315      shmForAgg->indexV6Tab[1][i][j].pktsNbOUT = 0; 
     
    317317    } 
    318318  } 
    319 fprintf(stderr, "icci\n"); 
    320319#endif 
    321320 
     
    508507  int gardeFou = 0; 
    509508  time_t lastIPOutput, lastMPLSOutput; 
     509  RouterPtr tmp = routersListPtr;   
     510  int dd = 0; 
     511  FILE *TPLFILE; 
    510512 
    511513  now = time((time_t *)NULL); 
     
    533535#ifdef MATRIX 
    534536      myPtrs.matrixPOP = &(shmForAgg->matrixPOP[shmForAgg->currentTable][0][0]); 
     537#endif 
     538#ifdef IPV6LINKAGG 
     539      myPtrs.currentV6IndexTab = &(shmForAgg->indexV6Tab[shmForAgg->currentTable][0][0]); 
     540      myPtrs.secondV6IndexTab = &(shmForAgg->indexV6Tab[shmForAgg->secondTable][0][0]); 
     541      if (!(TPLFILE = fopen("/tmp/IPV6LINKAGG.txt", "w"))) { 
     542        syslog (LOG_ERR, "error during %s opening", "/tmp/IPV6LINKAGG.txt"); 
     543      } 
     544      tmp = routersListPtr; 
     545      for (; tmp; tmp=tmp->next) { 
     546        for (dd=0;dd<MAX_INDEX_BY_ROUTER;dd++) { 
     547          if ( tmp->snmpIndexType[dd] != 2) { 
     548            fprintf(TPLFILE, 
     549                    "router: %lu.%lu.%lu.%lu dd: %hu , indexSNMP : %hu , type : %hu ,total bytes IN : %llu, OUT : %llu\n", 
     550                    (tmp->IpAddress>>24), 
     551                    (tmp->IpAddress<<8>>24), 
     552                    (tmp->IpAddress<<16>>24), 
     553                    (tmp->IpAddress<<24>>24), 
     554                    dd, 
     555                    tmp->snmpIndexID[dd], 
     556                    tmp->snmpIndexType[dd], 
     557                    ((struct IndexV6 *)((myPtrs.secondV6IndexTab) 
     558                                        +((tmp->ID)*ROUTER_INDEX_MAX) 
     559                                        +(tmp->snmpIndexID[dd])))->bytesNbIN, 
     560                    ((struct IndexV6 *)((myPtrs.secondV6IndexTab) 
     561                                        +((tmp->ID)*ROUTER_INDEX_MAX) 
     562                                        +(tmp->snmpIndexID[dd])))->bytesNbOUT 
     563                    );  
     564          } 
     565        } 
     566      } 
     567      fclose(TPLFILE); 
    535568#endif 
    536569    }