Changeset 22
- Timestamp:
- 01/17/07 18:37:59 (16 years ago)
- Location:
- trunk
- Files:
-
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.in
r20 r22 3 3 4 4 AC_PREREQ(2.59) 5 AC_INIT(RENETCOL, 0.0. 5, andreu@renater.fr)5 AC_INIT(RENETCOL, 0.0.7, andreu@renater.fr) 6 6 AC_CONFIG_SRCDIR(src/) 7 7 AC_PROG_MAKE_SET 8 8 AM_CONFIG_HEADER(config.h) 9 9 AM_INIT_AUTOMAKE 10 CFLAGS="-I/usr/local/include -g -ansi -Wall -D _SVID_SOURCE \ 11 -DSIGSETJMP_IS_BROKEN \ 12 -D _XOPEN_SOURCE \ 13 -pedantic \ 14 -pg" 10 CFLAGS="-I/usr/local/include -g -ansi -Wall -D _SVID_SOURCE -DSIGSETJMP_IS_BROKEN -D _XOPEN_SOURCE -pedantic -pg" 15 11 16 12 CFLAGS_CRIHAN="-DCRIHAN" 13 CFLAGS_IPV4AGG="-DIPV4AGG" 14 CFLAGS_DEBUGTPLDEF="-DDEBUGTPLDEF" 17 15 18 16 # Checks for programs. … … 35 33 fi 36 34 35 AC_ARG_ENABLE(ipv4agg,[ --enable-ipv4agg aggregation for IPv4 prefix=yes], 36 ipv4agg=$enableval,ipv4agg=yes) 37 if test $ipv4agg = yes ; then 38 CFLAGS="$CFLAGS $CFLAGS_IPV4AGG" 39 fi 40 41 AC_ARG_ENABLE(debugtpldef,[ --enable-debugtpldef Debug template definition=no], 42 debugtpldef=$enableval,debugtpldef=no) 43 if test $debugtpldef = yes ; then 44 CFLAGS="$CFLAGS $CFLAGS_DEBUGTPLDEF" 45 fi 46 37 47 AC_SUBST(CFLAGS) 38 48 -
trunk/src/Makefile.am
r20 r22 1 1 bin_PROGRAMS = renetcol renetcolSender renetcolMsgCtl 2 renetcol_SOURCES = renetcol.c template.c V9Header_mgmt.c msg_mgmt.c fields_mgmt.c\3 routers_mgmt.c tplflset_mgmt.c headers_mgmt.c renetcol.h template.h\4 V9Header_mgmt.h msg_mgmt.h fields_mgmt.h routers_mgmt.h \5 tplflset_mgmt.h headers_mgmt.h dataFlowSet.c dataFlowSet.h\6 7 remote_output.h remote_output.c8 renetcolSender_SOURCES = renetcolSender.c renetcolSender.h msg_mgmt.h msg_mgmt.c\9 rules_mgmt.c rules_mgmt.h remote_output.h remote_output.c\10 2 renetcol_SOURCES = renetcol.c template.c V9Header_mgmt.c msg_mgmt.c \ 3 fields_mgmt.c routers_mgmt.c tplflset_mgmt.c headers_mgmt.c \ 4 renetcol.h template.h V9Header_mgmt.h msg_mgmt.h fields_mgmt.h \ 5 routers_mgmt.h tplflset_mgmt.h headers_mgmt.h dataFlowSet.c \ 6 dataFlowSet.h get_conf.c get_conf.h rules_mgmt.c rules_mgmt.h \ 7 remote_output.h remote_output.c prefix_mgmt.h prefix_mgmt.c 8 renetcolSender_SOURCES = renetcolSender.c renetcolSender.h msg_mgmt.h \ 9 msg_mgmt.c rules_mgmt.c rules_mgmt.h remote_output.h \ 10 remote_output.c fields_mgmt.h fields_mgmt.c 11 11 renetcolMsgCtl_SOURCES = renetcolMsgCtl.c 12 12 BUILT_SOURCES = renetcol.o renetcolSender.o -
trunk/src/dataFlowSet.c
r20 r22 27 27 28 28 /* 29 * checkDataFlowSet29 * Check Data FlowSet 30 30 * 31 * @param shift Shift 32 * @param cr Current router pointer 33 * @param v9Ptr Pointer in the datagram ?? 34 * @param offv9 index in the datagram 35 * @param buf Pointer to the buffer 36 * @param cFNPtr Pointer on the current flowset number 37 * @param cFId Pointer on the current flowset ID 38 * @param pcktPtr Pointer on the datagram buffer 39 * @param rulesCache Pointer on the rules table (cache for the next param) 40 * @param rlPtr Pointer on the rules list 41 * @param myQueue FIXME : to erase/delete/suppress 42 * @param V4PTab Pointer on the IPv4 Prefix Table 43 * @param nbPV4 Previous table size 44 * @param ipCache Cache for all IP flow (for CRIHAN compilation option) 45 * @param mplsCache Cache for all MPLS flow (for CRIHAN compilation option) 46 * @param ipCounter Param to defined IP Cache size 47 * @param mplsCounter Param to defined MPLS Cache size 48 * @return shift (index in the datagram) FIXME 49 * 50 * FIXME to tune : just a param like a table ? 31 51 */ 32 52 unsigned short … … 65 85 struct PrefixV4 prefixKey, *res; /* for bsearch */ 66 86 struct AggCache agCache; 67 #ifdef CRIHAN 68 struct IPFLowCache ipFirstCache; /* CRI*/69 struct MPLSFlowCache mplsFirstCache; /* CRI */ 70 unsigned long firstTime = 0; /* CRI */71 unsigned long lastTime = 0; /* CRI */72 #endif /* CRIHAN */ 73 int bool = 0;87 int bool = 0; /* in IPV4 Agg mode enabled, we need to now if it's an IPv4 */ 88 /* flow, we test on the field and then put bool at 1 */ 89 #ifdef CRIHAN 90 struct IPFLowCache ipFirstCache; 91 struct MPLSFlowCache mplsFirstCache; 92 unsigned long firstTime = 0; 93 unsigned long lastTime = 0; 74 94 75 #ifdef CRIHAN76 95 ipFirstCache.ipProt = 0; 77 96 ipFirstCache.bytes = 0; … … 117 136 return (data_length+shift); 118 137 } 119 /* aggreg */ 120 /* agCache.routerAd = pcktPtr->ipH->srcAdd; */ 121 /* end aggreg */ 138 #ifdef IPV4AGG 139 agCache.routerAd = pcktPtr->ipH->srcAdd; 140 #endif 122 141 123 142 #ifdef CRIHAN … … 164 183 } 165 184 /* end rule check */ 166 /* aggregation */ 167 /* if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ */ 168 /* agCache.maskS = *((unsigned char*)&buffer1); */ 169 /* } */ 170 /* if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ */ 171 /* agCache.maskD = *((unsigned char*)&buffer1); */ 172 /* } */ 173 /* if (pftmp->fieldType==60){ */ 174 /* agCache.ipProt = *((unsigned char*)&buffer1); */ 175 /* } */ 176 /* if (pftmp->fieldType==4){ */ 177 /* agCache.tProt = *((unsigned char*)&buffer1); */ 178 /* } */ 179 /* if (pftmp->fieldType==61){ */ 180 /* agCache.sens = *((unsigned char*)&buffer1); */ 181 /* } */ 182 /* if (pftmp->fieldType==5){ */ 183 /* agCache.dscp = *((unsigned char*)&buffer1); */ 184 /* } */ 185 /* end aggregation */ 185 #ifdef IPV4AGG 186 if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 187 agCache.maskS = *((unsigned char*)&buffer1); 188 } 189 if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ 190 agCache.maskD = *((unsigned char*)&buffer1); 191 } 192 if (pftmp->fieldType==60){ 193 agCache.ipProt = *((unsigned char*)&buffer1); 194 } 195 if (pftmp->fieldType==4){ 196 agCache.tProt = *((unsigned char*)&buffer1); 197 } 198 if (pftmp->fieldType==61){ 199 agCache.sens = *((unsigned char*)&buffer1); 200 } 201 if (pftmp->fieldType==5){ 202 agCache.dscp = *((unsigned char*)&buffer1); 203 } 204 #endif 186 205 #ifdef CRIHAN 187 206 if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ … … 198 217 ipFirstCache.tProt = *((unsigned char*)&buffer1); 199 218 } 200 #endif /* CRIHAN */219 #endif 201 220 break; 202 221 case 2: … … 206 225 == *((unsigned short*)&buffer2)) 207 226 ((RuleDefPtr)(*(rulesCache+pos)))->check = 1; 208 /* aggregation */ 209 /* if (pftmp->fieldType==10){ */ 210 /* agCache.idSnmp = *((unsigned short*)&buffer2); */ 211 /* } */ 212 /* end aggregation */ 227 #ifdef IPV4AGG 228 if (pftmp->fieldType==10){ 229 agCache.idSnmp = *((unsigned short*)&buffer2); 230 } 231 #endif 213 232 #ifdef CRIHAN 214 233 if (pftmp->fieldType==10){ … … 224 243 ipFirstCache.dPort = *((unsigned short*)&buffer2); 225 244 } 226 #endif /* CRIHAN */245 #endif 227 246 break; 228 247 case 3: … … 240 259 mplsFirstCache.mplsLabel1 = (*((unsigned long*)&buffer4))>>4; 241 260 } 242 #endif /* CRIHAN */261 #endif 243 262 break; 244 263 case 4: … … 255 274 } 256 275 } 257 /* aggregation */ 258 /* if ((pftmp->fieldType==8)){ */ 259 /* agCache.v4AdS = *((unsigned long*)&buffer4); */ 260 /* } */ 261 /* if ((pftmp->fieldType==12)){ */ 262 /* agCache.v4AdD = *((unsigned long*)&buffer4); */ 263 /* } */ 264 /* if (pftmp->fieldType==1){ */ 265 /* agCache.bytes = *((unsigned long*)&buffer4); */ 266 /* } */ 267 /* if (pftmp->fieldType==2){ */ 268 /* agCache.pkts = *((unsigned long*)&buffer4); */ 269 /* } */ 270 /* end aggregation */ 276 #ifdef IPV4AGG 277 if ((pftmp->fieldType==8)){ 278 agCache.v4AdS = *((unsigned long*)&buffer4); 279 } 280 if ((pftmp->fieldType==12)){ 281 agCache.v4AdD = *((unsigned long*)&buffer4); 282 } 283 if (pftmp->fieldType==1){ 284 agCache.bytes = *((unsigned long*)&buffer4); 285 } 286 if (pftmp->fieldType==2){ 287 agCache.pkts = *((unsigned long*)&buffer4); 288 } 289 #endif 271 290 #ifdef CRIHAN 272 291 if (pftmp->fieldType==8){ … … 290 309 lastTime = *((unsigned long*)&buffer4); 291 310 } 292 #endif /* CRIHAN */311 #endif 293 312 break; 294 313 case 16: … … 415 434 } 416 435 moreIsNecessary = 1; 417 /* aggregation */436 /* aggregation for IPv6 flows */ 418 437 419 438 /* end aggregation */ … … 437 456 } else { 438 457 /* 439 * no rule within this field type, but we must read ingthe value458 * no rule within this field type, but we must read the value 440 459 */ 441 460 switch (field_size) { 442 461 case 1: 443 462 buffer1 = *(buf+(*offV9)); (*offV9)++; 444 /* aggregation */ 445 /* if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ */ 446 /* agCache.maskS = *((unsigned char*)&buffer1); */ 447 /* } */ 448 /* if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ */ 449 /* agCache.maskD = *((unsigned char*)&buffer1); */ 450 /* } */ 451 /* if (pftmp->fieldType==60){ */ 452 /* agCache.ipProt = *((unsigned char*)&buffer1); */ 453 /* } */ 454 /* if (pftmp->fieldType==4){ */ 455 /* agCache.tProt = *((unsigned char*)&buffer1); */ 456 /* } */ 457 /* if (pftmp->fieldType==61){ */ 458 /* agCache.sens = *((unsigned char*)&buffer1); */ 459 /* } */ 460 /* if (pftmp->fieldType==5){ */ 461 /* agCache.dscp = *((unsigned char*)&buffer1); */ 462 /* } */ 463 /* end aggregation */ 463 #ifdef IPV4AGG 464 if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ 465 agCache.maskS = *((unsigned char*)&buffer1); 466 } 467 if ((pftmp->fieldType==13)||(pftmp->fieldType==30)){ 468 agCache.maskD = *((unsigned char*)&buffer1); 469 } 470 if (pftmp->fieldType==60){ 471 agCache.ipProt = *((unsigned char*)&buffer1); 472 } 473 if (pftmp->fieldType==4){ 474 agCache.tProt = *((unsigned char*)&buffer1); 475 } 476 if (pftmp->fieldType==61){ 477 agCache.sens = *((unsigned char*)&buffer1); 478 } 479 if (pftmp->fieldType==5){ 480 agCache.dscp = *((unsigned char*)&buffer1); 481 } 482 #endif 464 483 #ifdef CRIHAN 465 484 if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ … … 476 495 ipFirstCache.tProt = *((unsigned char*)&buffer1); 477 496 } 478 #endif /* CRIHAN */497 #endif 479 498 break; 480 499 case 2: 481 500 buffer2[1]= *(buf+(*offV9)); (*offV9)++; 482 501 buffer2[0]= *(buf+(*offV9)); (*offV9)++; 483 /* aggregation */ 502 #ifdef IPV4AGG 484 503 if (pftmp->fieldType==10){ 485 504 agCache.idSnmp = *((unsigned short*)&buffer2); 486 505 } 487 /* end aggregation */ 506 #endif 488 507 #ifdef CRIHAN 489 508 if (pftmp->fieldType==10){ … … 499 518 ipFirstCache.dPort = *((unsigned short*)&buffer2); 500 519 } 501 #endif /* CRIHAN */520 #endif 502 521 break; 503 522 case 3: … … 512 531 mplsFirstCache.mplsLabel1 = (*((unsigned long*)&buffer4))>>4; 513 532 } 514 #endif /* CRIHAN */533 #endif 515 534 break; 516 535 case 4: … … 519 538 buffer4[1]= *(buf+(*offV9)); (*offV9)++; 520 539 buffer4[0]= *(buf+(*offV9)); (*offV9)++; 521 /* aggregation */ 522 /* if ((pftmp->fieldType==8)){ */ 523 /* bool = 1; */ 524 /* agCache.v4AdS = *((unsigned long*)&buffer4); */ 525 /* } else if ((pftmp->fieldType==12)){ */ 526 /* agCache.v4AdD = *((unsigned long*)&buffer4); */ 527 /* } else if (pftmp->fieldType==1){ */ 528 /* agCache.bytes = *((unsigned long*)&buffer4); */ 529 /* } else if (pftmp->fieldType==2){ */ 530 /* agCache.pkts = *((unsigned long*)&buffer4); */ 531 /* } */ 532 /* end aggregation */ 540 #ifdef IPV4AGG 541 if ((pftmp->fieldType==8)){ 542 bool = 1; 543 agCache.v4AdS = *((unsigned long*)&buffer4); 544 } else if ((pftmp->fieldType==12)){ 545 agCache.v4AdD = *((unsigned long*)&buffer4); 546 } else if (pftmp->fieldType==1){ 547 agCache.bytes = *((unsigned long*)&buffer4); 548 } else if (pftmp->fieldType==2){ 549 agCache.pkts = *((unsigned long*)&buffer4); 550 } 551 #endif 533 552 #ifdef CRIHAN 534 553 if (pftmp->fieldType==8){ … … 552 571 lastTime = *((unsigned long*)&buffer4); 553 572 } 554 #endif /* CRIHAN */573 #endif 555 574 break; 556 575 case 16: … … 561 580 buffer2[0]= *(buf+(*offV9)); (*offV9)++; 562 581 } 563 /* aggregation */582 /* aggregation IPv6 */ 564 583 /* end aggregation */ 565 584 break; … … 617 636 (*mplsCounter)++; 618 637 } 619 #endif /* CRIHAN */ 620 /* put aggregation cache information to tables */ 621 /* if (bool == 1){ */ 622 /* prefixKey.beginning = agCache.v4AdS>>(32-agCache.maskS)<<(32-agCache.maskS); */ 623 /* res = bsearch(&prefixKey, V4PTab, nbPV4, */ 624 /* sizeof(struct PrefixV4), prefCmp); */ 625 /* } */ 626 bool = 0; 627 /* end put */ 638 #endif 639 /* put aggregation cache information to IPv4 Prefixes table */ 640 #ifdef IPV4AGG 641 if (bool == 1){ 642 prefixKey.beginning = agCache.v4AdS>>(32-agCache.maskS)<<(32-agCache.maskS); 643 res = bsearch(&prefixKey, V4PTab, nbPV4, 644 sizeof(struct PrefixV4), prefCmp); 645 if (res!=NULL){ 646 res->bytesNb += agCache.bytes; 647 res->pktsNb += agCache.pkts; 648 res->flowNb += 1; 649 switch (agCache.ipProt) { 650 case 1: 651 res->icmpBytesNb += agCache.bytes; 652 res->icmpPktsNb += agCache.pkts; 653 res->icmpFlowNb += 1; 654 break; 655 case 6: 656 res->tcpBytesNb += agCache.bytes; 657 res->tcpPktsNb += agCache.pkts; 658 res->tcpFlowNb += 1; 659 break; 660 case 17: 661 res->udpBytesNb += agCache.bytes; 662 res->udpPktsNb += agCache.pkts; 663 res->udpFlowNb += 1; 664 break; 665 default: 666 res->othersBytesNb += agCache.bytes; 667 res->othersPktsNb += agCache.pkts; 668 res->othersFlowNb += 1; 669 } 670 } 671 /* if (res==NULL){ */ 672 /* fprintf(stderr, "IPv4_spoofing? "); */ 673 /* } */ 674 } 675 bool = 0; 676 #endif 628 677 /* 629 678 * Redirection if needed -
trunk/src/dataFlowSet.h
r20 r22 73 73 unsigned char tProt; 74 74 unsigned char ipProt; 75 unsigned char sens; /* In/out */75 unsigned char sens; /* In/out field 61 */ 76 76 unsigned short idSnmp; 77 77 unsigned long bytes; -
trunk/src/fields_mgmt.c
r2 r22 34 34 { 35 35 FieldPtr tmp = pf; 36 fprintf(stderr, "template definition: (field, size)\n");37 36 for (; tmp; tmp=tmp->next) { 38 37 fprintf(stderr, "(%hu,%hu) ", tmp->fieldType, tmp->fieldLength); … … 47 46 { 48 47 FieldPtr tmp = pf; 49 fprintf(stderr, "fields set (inv): \n");50 48 for (; tmp; tmp=tmp->prev) { 51 49 fprintf(stderr, " %hu %hu \n", tmp->fieldType, tmp->fieldLength); -
trunk/src/get_conf.c
r17 r22 141 141 unsigned char buffer4[4]; 142 142 int i = 0; 143 char prefixStrTab[ 10000][50];143 char prefixStrTab[MAX_IPV4_PREFIX][50]; 144 144 145 145 if (!(prefixFile = fopen(filename, "r"))) { … … 151 151 strcpy(prefixStrTab[counter], line); 152 152 counter++; 153 if (counter == 10000) {153 if (counter == MAX_IPV4_PREFIX) { 154 154 fprintf(stderr, "bufferoverflow in getPrefixV4 function (get_conf.c)\ 155 change the value of prefixStrTabdeclaration and recompile \n");155 change the value of MAX_IPV4_PREFIX declaration and recompile \n"); 156 156 exit(1); 157 157 } … … 172 172 pV4TabPtr[i].mask = n4; 173 173 pV4TabPtr[i].routerNb = n5; 174 pV4TabPtr[i].flowNb = 0; 175 pV4TabPtr[i].bytesNb = 0; 176 pV4TabPtr[i].pktsNb = 0; 177 pV4TabPtr[i].udpPktsNb = 0; 178 pV4TabPtr[i].tcpPktsNb = 0; 179 pV4TabPtr[i].icmpPktsNb = 0; 180 pV4TabPtr[i].othersPktsNb = 0; 181 pV4TabPtr[i].udpBytesNb = 0; 182 pV4TabPtr[i].tcpBytesNb = 0; 183 pV4TabPtr[i].icmpBytesNb = 0; 184 pV4TabPtr[i].othersBytesNb = 0; 174 185 } 175 186 if( fclose(prefixFile) == 0) { -
trunk/src/get_conf.h
r17 r22 2 2 * File: get_conf.h 3 3 * 4 * Authors: ANDREU Fran çois-Xavier4 * Authors: ANDREU Francois-Xavier 5 5 * 6 6 * Copyright (C) 2005 GIP RENATER … … 26 26 #define GET_CONF_H 27 27 28 #define MAX_IPV4_PREFIX 10000 29 28 30 struct PrefixV4{ 29 unsigned long beginning; 31 unsigned long beginning; /* FIXME to transform in start */ 30 32 unsigned long end; 31 unsigned short mask; 32 unsigned short routerNb; 33 unsigned short mask; /* prefix mask */ 34 unsigned short routerNb; /* router ID */ 35 unsigned long long flowNb; /* flow number accounting */ 36 unsigned long long bytesNb; /* bytes number accounting */ 37 unsigned long long pktsNb; /* packets number accounting */ 38 unsigned long long udpPktsNb; 39 unsigned long long tcpPktsNb; 40 unsigned long long icmpPktsNb; 41 unsigned long long othersPktsNb; 42 unsigned long long udpBytesNb; 43 unsigned long long tcpBytesNb; 44 unsigned long long icmpBytesNb; 45 unsigned long long othersBytesNb; 46 unsigned long long udpFlowNb; 47 unsigned long long tcpFlowNb; 48 unsigned long long icmpFlowNb; 49 unsigned long long othersFlowNb; 33 50 }; 34 51 -
trunk/src/renetcol.c
r20 r22 26 26 #include "renetcol.h" 27 27 28 #ifdef CRIHAN 28 /* #ifdef CRIHAN */ 29 29 struct IPFLowCache tabIP[MAX_IP_FLOW], *tabIPPtr = tabIP; 30 30 struct MPLSFlowCache tabMPLS[MAX_MPLS_FLOW], *tabMPLSPtr = tabMPLS; 31 unsigned long ipNb = 0; 32 unsigned long mplsNb = 0; 31 unsigned long ipNb = 0; /* counter of IP flows number */ 32 unsigned long mplsNb = 0; /* counter of MPLS flow number */ 33 33 unsigned long *ipNbPtr = &ipNb; 34 34 unsigned long *mplsNbPtr = &mplsNb; 35 unsigned short currentIPOutputFile = 0; 36 unsigned short currentMPLSOutputFile = 0; 35 unsigned short currentIPOutputFile = 0; /* index on the current IP file */ 36 unsigned short currentMPLSOutputFile = 0; /* index on the current MPLS file */ 37 37 char outputName[256]; 38 char cof_str[20]; 39 FILE *fIP; 40 FILE *fMPLS; 41 #endif /* CRIHAN*/42 43 char *rulesFileName; 44 char *configFileName; 45 char *prefixV4FileName; 46 struct sigaction myAction; 47 s igjmp_buf contextSigalrm;48 /* struct sigaction myAction; for timer */ 38 char cof_str[20]; /* current ouput file name */ 39 FILE *fIP; /* pointer on the IP output file */ 40 FILE *fMPLS; /* pointer on the MPLS output file */ 41 /* #endif */ 42 43 char *rulesFileName; /* file name of the rules (like acl) */ 44 char *configFileName; /* file name where routers list is */ 45 char *prefixV4FileName; /* IPv4 prefix list */ 46 47 struct sigaction myAction; /* handler for renetcolSender communication */ 48 sigjmp_buf contextSigalrm; /* '' */ 49 49 volatile sig_atomic_t sigusr1Up = 0; 50 /* V9 */ 51 unsigned short offsetV9 = 0; 50 /* struct sigaction myAction; for timer not used in this version */ 51 52 unsigned short currentIntervalle = 0; /* based on 5 min intervalles */ 53 54 unsigned short offsetV9 = 0; /* index in a neflow v9 packet */ 52 55 unsigned short *offsetV9Ptr = &offsetV9; 56 53 57 unsigned char buffer1; 54 58 unsigned char buffer2[2]; 55 59 unsigned char buffer4[4]; 56 60 unsigned char buffer6[6]; 61 57 62 short currentFlowsetNumber; 58 63 short *currentFlowsetNumberPtr = ¤tFlowsetNumber; 59 64 short currentFlowsetId; 60 65 short *currentFlowsetIdPtr = ¤tFlowsetId; 61 TplFlowSetPtr curTplFlSetPtr; 66 TplFlowSetPtr curTplFlSetPtr; /* current template flowset pointer */ 62 67 TplOptionPtr curTplOptionPtr; 63 68 RouterPtr routersListPtr; … … 66 71 unsigned long sortedRouterList[ROUTER_INDEX_MAX]; 67 72 unsigned long indexedRouterList[ROUTER_INDEX_MAX]; 68 int routerNb = 0; 69 unsigned short v4PrefixNb = 0; 70 struct PrefixV4 prefixV4Tab[ PREFIX_V4_MAX];71 RulesPtr rulesListPtr; 73 int routerNb = 0; /* routers number */ 74 unsigned short v4PrefixNb = 0; /* IPv4 prefix number */ 75 struct PrefixV4 prefixV4Tab[MAX_IPV4_PREFIX]; /* IPv4 prefix structure */ 76 RulesPtr rulesListPtr; /* Rules list */ 72 77 NetFlowV9HeaderPtr currentHeaderV9Ptr; 73 key_t myKey = 0; 74 int myQueue = 0; 75 RuleDefPtr rulesAddress[FIELD_TYPE_NUMBER+1][MAX_RULES_PER_FIELD]; 78 key_t myKey = 0; /* FIXME to delete in futur */ 79 int myQueue = 0; /* FIXME to delete in futur */ 80 81 /* Next structure used as cache in rules reading */ 82 RuleDefPtr rulesAddress[FIELD_TYPE_NUMBER+1][MAX_RULES_PER_FIELD]; 76 83 RuleDefPtr *rulesAddressPtr; 84 77 85 int reInitConf = 0; 78 /* ENDV9 */ 86 79 87 static unsigned long datagramNumber; 80 static time_t now; 88 89 static time_t lastRock; 90 static struct tm *tmPtr; 91 81 92 static unsigned long myHost; /* FIXME to erase */ 82 static struct tm *tmPtr;83 93 extern int errno; 84 94 static int inputSock; … … 112 122 } 113 123 124 #ifdef CRIHAN 125 fprintf(stderr, "renetcol compilation with CRIHAN feature enable\n"); 126 #endif 127 #ifdef IPV4AGG 128 fprintf(stderr, "renetcol compilation and execution with IPv4 Aggregation feature enable\n"); 129 #endif 130 114 131 openlog(argv[0], LOG_PID, LOG_USER); 115 132 116 133 configFileName = (char *) malloc((strlen(argv[1])+1) * sizeof(char)); 117 134 strcpy (configFileName, argv[1]); … … 156 173 sigaction (SIGUSR1, &myAction, NULL); 157 174 175 /* Pointer on rules Table */ 158 176 setCache(rulesListPtr); 159 177 rulesAddressPtr = (RuleDefPtr *)rulesAddress; … … 188 206 datagramNumber =0; /* FIXME : ???? */ 189 207 190 now = time((time_t *)NULL);191 tmPtr = localtime(&now);192 208 socketLoop(); /* all work on datagram is made here */ 193 209 closelog(); … … 314 330 { 315 331 static unsigned short n0, n1, n2, n3; 316 332 317 333 initSocket(); 318 334 if (sscanf(receptAddress,"%hu.%hu.%hu.%hu",&n0,&n1,&n2,&n3)==0) { … … 335 351 short version = 0; 336 352 int regRouter = 0; 337 /* CRI */338 353 time_t now = time((time_t *)NULL); 339 int iIP, iMPLS ;354 int iIP, iMPLS, i; 340 355 time_t lastIPOutput, lastMPLSOutput; 341 356 time_t receptionTime; 342 /* end */343 357 344 358 now = time((time_t *)NULL); 359 tmPtr = localtime(&now); 360 currentIntervalle = tmPtr->tm_min; 345 361 lastMPLSOutput = now; 346 362 lastIPOutput = now; 347 363 do { 364 if ( ((tmPtr->tm_min)%2 == 0) && (currentIntervalle != tmPtr->tm_min)){ 365 printf("We change the table, min : %d\n", tmPtr->tm_min); 366 currentIntervalle = tmPtr->tm_min; 367 } 348 368 if (sigusr1Up == 1){ 349 369 sigusr1Up = 0; … … 379 399 currentFlowsetNumberPtr, 380 400 myQueue); 381 /* showAllTplFlSet(); */ 401 /* FIXME : TplFlSet Def in a file before next release */ 402 /* showAllTplFlSet(); */ 382 403 } else if (currentFlowsetId == 1) { 383 404 shift = checkTemplateOption(currentRouterPtr, offsetV9Ptr, … … 400 421 break; 401 422 default: 423 /* FIXME : Uncomment before next release */ 402 424 /* syslog(LOG_INFO, */ 403 425 /* "NetFlow exp. version unknown: %hu, from router: %lu.%lu.%lu.%lu", */ … … 409 431 break; 410 432 } 433 /* for (i=0; i<v4PrefixNb; i++){ */ 434 /* fprintf(stderr, "%lu %llu flows\n", */ 435 /* prefixV4Tab[i].beginning, */ 436 /* prefixV4Tab[i].flowNb); */ 437 /* } */ 411 438 412 439 #ifdef CRIHAN … … 493 520 } 494 521 #endif /* CRIHAN */ 522 now = time((time_t *)NULL); 523 tmPtr = localtime(&now); 495 524 } while (1); 496 525 } … … 602 631 TplFlowSetPtr tmpFS; 603 632 TplOptionPtr tmpOP; 604 fprintf(stderr," All template definitions: (field, size) :\n");633 fprintf(stderr,"\n*********************************************\n* All template definitions: (field, size) : *\n*********************************************\n"); 605 634 for (; tmp; tmp=tmp->next) { 606 fprintf(stderr," router %lu.%lu.%lu.%lu :\n",635 fprintf(stderr,"----------------------\nrouter %lu.%lu.%lu.%lu : \n----------------------\n", 607 636 (tmp->IpAddress>>24), 608 637 (tmp->IpAddress<<8>>24), … … 611 640 tmpFS = tmp->tplList; 612 641 for (; tmpFS; tmpFS=tmpFS->next) { 613 fprintf(stderr,"ID %hu: ", tmpFS->templateFlowSetId); 642 fprintf(stderr,"TId %hu (sourceId: %lu):\n", 643 tmpFS->templateFlowSetId, 644 tmpFS->sourceId); 614 645 printFieldSet(tmpFS->fieldSet); 615 646 fprintf(stderr,"\n"); 616 647 } 617 648 if ((tmpOP = tmp->tplOptList) != NULL){ 618 fprintf(stderr,"template option: \n");619 649 for (; tmpOP; tmpOP=tmpOP->next) { 620 fprintf(stderr,"ID %hu: ", tmpOP->templateOptionId); 650 fprintf(stderr,"OpTId %hu (sourceId: %lu) >\n", 651 tmpOP->templateOptionId, 652 tmpOP->sourceId); 621 653 printFieldSet(tmpOP->fieldSet); 622 654 fprintf(stderr,"\n"); -
trunk/src/renetcol.h
r20 r22 70 70 71 71 #define ROUTER_INDEX_MAX 70 72 #define PREFIX_V4_MAX 400073 72 #define FIELD_TYPE_NUMBER 89 74 73 #define MAX_RULES_PER_FIELD 10 … … 80 79 #define MAX_IP_OUTPUT_FILES 3 81 80 #define MAX_MPLS_OUTPUT_FILES 3 82 #define MAX_IP_FLOW 1000083 #define MAX_MPLS_FLOW 20084 81 #define IP_TIME_THRESHOLD 60 /* in sec */ 85 82 #define MPLS_TIME_THRESHOLD 60 /* in sec */ 86 83 #endif /* CRIHAN */ 84 #define MAX_IP_FLOW 10000 85 #define MAX_MPLS_FLOW 200 87 86 88 87 void setCache(RulesPtr);