Changeset 23
- Timestamp:
- 02/05/07 17:50:16 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 10 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dataFlowSet.c
r22 r23 29 29 * Check Data FlowSet 30 30 * 31 * @param shift Shift32 * @param cr Current router pointer33 * @param v9Ptr Pointer in the datagram ??34 * @param offv9 index in the datagram35 * @param buf Pointer to the buffer36 * @param cFNPtr Pointer on the current flowset number37 * @param cFId Pointer on the current flowset ID38 * @param pcktPtr Pointer on the datagram buffer39 * @param rulesCache Pointer on the rules table (cache for the next param)40 * @param rlPtr Pointer on the rules list41 * @param myQueue FIXME : to erase/delete/suppress42 * @param V4PTab Pointer on the IPv4 Prefix Table43 * @param nbPV4 Previous table size44 * @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 size47 * @param mplsCounter Param to defined MPLS Cache size48 * @return shift (index in the datagram) FIXME49 *50 * FIXME to tune : just a param like a table ?51 31 */ 52 32 unsigned short 53 checkDataFlowSet(unsigned short shift, RouterPtr cr, NetFlowV9HeaderPtr v9Ptr, 54 unsigned short *offV9, unsigned char *buf, short *cFNPtr, 55 short *cFId, DatagramPtr pcktPtr, RuleDefPtr *rulesCache, 56 RulesPtr rlPtr, int myQueue, struct PrefixV4 *V4PTab, 57 size_t nbPV4, 58 struct IPFLowCache *ipCache, struct MPLSFlowCache *mplsCache, 59 unsigned long *ipCounter, unsigned long *mplsCounter) 33 checkDataFlowSet(unsigned short shift, 34 struct MyPtrs *myPtrs, 35 int myQueue, 36 struct PrefixV4 *V4PTab, 37 size_t nbPV4 38 ) 60 39 { 61 40 TplFlowSetPtr tmp; … … 64 43 unsigned short data_length = 0; 65 44 unsigned short flow_size = 0; 66 unsigned short oldOffset = * offV9;45 unsigned short oldOffset = *myPtrs->offsetV9Ptr; 67 46 unsigned short secondOffset = 0; 68 47 unsigned short secondOldOffset = 0; … … 79 58 unsigned char buffer2[2]; 80 59 unsigned char buffer4[4]; 81 RulesPtr tmpRuleList = rlPtr;60 RulesPtr tmpRuleList = myPtrs->rulesListPtr; 82 61 msgType myMsg; 83 62 char *msgTextIndex; … … 114 93 #endif /* CRIHAN */ 115 94 116 buffer2[1] = *( buf+(*offV9));(*offV9)++;117 buffer2[0] = *( buf+(*offV9));(*offV9)++;118 (* cFId) = *((unsigned short*)&buffer2);119 buffer2[1] = *( buf+(*offV9));(*offV9)++;120 buffer2[0] = *( buf+(*offV9));(*offV9)++;95 buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 96 buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 97 (*myPtrs->currentFlowsetIdPtr) = *((unsigned short*)&buffer2); 98 buffer2[1] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 99 buffer2[0] = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr));(*myPtrs->offsetV9Ptr)++; 121 100 data_length = *((unsigned short*)&buffer2); 122 if ((tmp=existTplId( cr, v9Ptr->sourceId,123 (* cFId)))!=NULL) {101 if ((tmp=existTplId(myPtrs->currentRouterPtr, myPtrs->currentHeaderV9Ptr->sourceId, 102 (*myPtrs->currentFlowsetIdPtr)))!=NULL) { 124 103 pftmp = tmp->lastField; 125 104 for (; pftmp; pftmp = pftmp->prev) { … … 127 106 } 128 107 if ( data_length%flow_size >= 9 ) { 129 (* cFNPtr) = v9Ptr->count;108 (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count; 130 109 syslog(LOG_INFO, "data flowset length not match with length from template definition, wrong template definition suspected; all next informations of this data flowset are not considered! flowset ID: %hu, from router: %lu.%lu.%lu.%lu", 131 (* cFId),132 ( pcktPtr->ipH->srcAdd>>24),133 ( pcktPtr->ipH->srcAdd<<8>>24),134 ( pcktPtr->ipH->srcAdd<<16>>24),135 ( pcktPtr->ipH->srcAdd<<24>>24));110 (*myPtrs->currentFlowsetIdPtr), 111 (myPtrs->pcktPtr->ipH->srcAdd>>24), 112 (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), 113 (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), 114 (myPtrs->pcktPtr->ipH->srcAdd<<24>>24)); 136 115 return (data_length+shift); 137 116 } 138 117 #ifdef IPV4AGG 139 agCache.routerAd = pcktPtr->ipH->srcAdd;118 agCache.routerAd = myPtrs->pcktPtr->ipH->srcAdd; 140 119 #endif 141 120 142 121 #ifdef CRIHAN 143 ipFirstCache.routerAd = pcktPtr->ipH->srcAdd;144 mplsFirstCache.routerAd = pcktPtr->ipH->srcAdd;122 ipFirstCache.routerAd = myPtrs->pcktPtr->ipH->srcAdd; 123 mplsFirstCache.routerAd = myPtrs->pcktPtr->ipH->srcAdd; 145 124 #endif /* CRIHAN */ 146 125 147 126 pftmp = tmp->lastField; 148 127 secondPftmp = tmp->lastField; 149 secondOffset = * offV9;128 secondOffset = *myPtrs->offsetV9Ptr; 150 129 secondOldOffset = secondOffset; 151 while ( (((* offV9)-48-shift) <= data_length) && (overflow!=1) ) {130 while ( (((*myPtrs->offsetV9Ptr)-48-shift) <= data_length) && (overflow!=1) ) { 152 131 /* 153 132 * progression in a flow Set … … 164 143 * ... if one rule exist 165 144 */ 166 if (((RuleDefPtr)(*( rulesCache+pos))) != NULL) {167 oldOffset = * offV9;168 while (((RuleDefPtr)(*( rulesCache+pos))) != NULL){145 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos))) != NULL) { 146 oldOffset = *myPtrs->offsetV9Ptr; 147 while (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos))) != NULL){ 169 148 /* 170 149 * while on one cache table line 171 150 */ 172 * offV9= oldOffset;151 *myPtrs->offsetV9Ptr = oldOffset; 173 152 switch ((int) 174 (((RuleDefPtr)(*( rulesCache+pos)))->operator)){153 (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->operator)){ 175 154 case 2: 176 155 switch (field_size) { 177 156 case 1: 178 buffer1 = *( buf+(*offV9)); (*offV9)++;157 buffer1 = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 179 158 /* rule check */ 180 if (((RuleDefPtr)(*( rulesCache+pos)))->value->stor.cvalue159 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.cvalue 181 160 == *((unsigned char*)&buffer1)) { 182 ((RuleDefPtr)(*( rulesCache+pos)))->check = 1;161 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 183 162 } 184 163 /* end rule check */ … … 220 199 break; 221 200 case 2: 222 buffer2[1]= *( buf+(*offV9)); (*offV9)++;223 buffer2[0]= *( buf+(*offV9)); (*offV9)++;224 if (((RuleDefPtr)(*( rulesCache+pos)))->value->stor.svalue201 buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 202 buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 203 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.svalue 225 204 == *((unsigned short*)&buffer2)) 226 ((RuleDefPtr)(*( rulesCache+pos)))->check = 1;205 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 227 206 #ifdef IPV4AGG 228 207 if (pftmp->fieldType==10){ … … 247 226 case 3: 248 227 buffer4[3]= 0; 249 buffer4[2]= *( buf+(*offV9)); (*offV9)++;250 buffer4[1]= *( buf+(*offV9)); (*offV9)++;251 buffer4[0]= *( buf+(*offV9)); (*offV9)++;252 if (((RuleDefPtr)(*( rulesCache+pos)))->value->stor.lvalue228 buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 229 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 230 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 231 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue 253 232 == *((unsigned long*)&buffer4)) 254 ((RuleDefPtr)(*( rulesCache+pos)))->check = 1;233 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 255 234 /* aggregation */ 256 235 /* end aggregation */ … … 262 241 break; 263 242 case 4: 264 buffer4[3]= *( buf+(*offV9)); (*offV9)++;265 buffer4[2]= *( buf+(*offV9)); (*offV9)++;266 buffer4[1]= *( buf+(*offV9)); (*offV9)++;267 buffer4[0]= *( buf+(*offV9)); (*offV9)++;243 buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 244 buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 245 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 246 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 268 247 /* FIXME : here , add a check on the field type */ 269 248 if ((pftmp->fieldType==8)||(pftmp->fieldType==12)){ 270 if ((((RuleDefPtr)(*( rulesCache+pos)))->value->stor.lvalue)271 == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*( rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask) )249 if ((((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.lvalue) 250 == (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask)<<(32-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask) ) 272 251 { 273 ((RuleDefPtr)(*( rulesCache+pos)))->check = 1;252 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 274 253 } 275 254 } … … 313 292 case 16: 314 293 for (i=0; i<4; i++) { 315 buffer4[3]= *( buf+(*offV9)); (*offV9)++;316 buffer4[2]= *( buf+(*offV9)); (*offV9)++;317 buffer4[1]= *( buf+(*offV9)); (*offV9)++;318 buffer4[0]= *( buf+(*offV9)); (*offV9)++;294 buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 295 buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 296 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 297 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 319 298 if (1==moreIsNecessary){ 320 299 switch(i){ 321 300 case 0: 322 if (((RuleDefPtr)(*( rulesCache+pos)))->value->mask <= 32){323 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])301 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask <= 32){ 302 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 324 303 == 325 (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*( rulesCache+pos)))->value->mask)<<(32-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)304 (*((unsigned long*)&buffer4))>>(32-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask)<<(32-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask) 326 305 ) 327 306 { 328 ((RuleDefPtr)(*( rulesCache+pos)))->check = 1;307 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 329 308 moreIsNecessary = 0; 330 309 } else { 331 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;310 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 332 311 moreIsNecessary = 0; 333 312 } 334 313 } else { 335 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])314 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 336 315 == 337 316 (*((unsigned long*)&buffer4)) 338 317 ) 339 318 { 340 ((RuleDefPtr)(*( rulesCache+pos)))->check = 1;319 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 1; 341 320 } else { 342 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;321 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 343 322 moreIsNecessary = 0; 344 323 } … … 346 325 break; 347 326 case 1: 348 if (((RuleDefPtr)(*( rulesCache+pos)))->value->mask <= 64){349 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])327 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask <= 64){ 328 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 350 329 == 351 (*((unsigned long*)&buffer4))>>(64-((RuleDefPtr)(*( rulesCache+pos)))->value->mask)<<(64-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)330 (*((unsigned long*)&buffer4))>>(64-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask)<<(64-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask) 352 331 ) 353 332 { 354 ((RuleDefPtr)(*( rulesCache+pos)))->check =355 ((RuleDefPtr)(*( rulesCache+pos)))->check && 1;333 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 334 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check && 1; 356 335 moreIsNecessary = 0; 357 336 } else { 358 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;337 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 359 338 moreIsNecessary = 0; 360 339 } 361 340 } else { 362 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])341 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 363 342 == 364 343 (*((unsigned long*)&buffer4)) 365 344 ) 366 345 { 367 ((RuleDefPtr)(*( rulesCache+pos)))->check =368 ((RuleDefPtr)(*( rulesCache+pos)))->check && 1;346 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 347 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check && 1; 369 348 } else { 370 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;349 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 371 350 moreIsNecessary = 0; 372 351 } … … 374 353 break; 375 354 case 2: 376 if (((RuleDefPtr)(*( rulesCache+pos)))->value->mask <= 96){377 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])355 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask <= 96){ 356 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 378 357 == 379 (*((unsigned long*)&buffer4))>>(96-((RuleDefPtr)(*( rulesCache+pos)))->value->mask)<<(96-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)358 (*((unsigned long*)&buffer4))>>(96-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask)<<(96-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask) 380 359 ) 381 360 { 382 ((RuleDefPtr)(*( rulesCache+pos)))->check =383 ((RuleDefPtr)(*( rulesCache+pos)))->check && 1;361 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 362 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check && 1; 384 363 moreIsNecessary = 0; 385 364 } else { 386 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;365 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 387 366 moreIsNecessary = 0; 388 367 } 389 368 } else { 390 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])369 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 391 370 == 392 371 (*((unsigned long*)&buffer4)) 393 372 ) 394 373 { 395 ((RuleDefPtr)(*( rulesCache+pos)))->check =396 ((RuleDefPtr)(*( rulesCache+pos)))->check && 1;374 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 375 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check && 1; 397 376 } else { 398 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;377 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 399 378 moreIsNecessary = 0; 400 379 } … … 402 381 break; 403 382 case 3: 404 if (((RuleDefPtr)(*( rulesCache+pos)))->value->mask <= 128){405 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])383 if (((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask <= 128){ 384 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 406 385 == 407 (*((unsigned long*)&buffer4))>>(128-((RuleDefPtr)(*( rulesCache+pos)))->value->mask)<<(128-((RuleDefPtr)(*(rulesCache+pos)))->value->mask)386 (*((unsigned long*)&buffer4))>>(128-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask)<<(128-((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->mask) 408 387 ) 409 388 { 410 ((RuleDefPtr)(*( rulesCache+pos)))->check =411 ((RuleDefPtr)(*( rulesCache+pos)))->check && 1;389 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 390 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check && 1; 412 391 } else { 413 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;392 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 414 393 moreIsNecessary = 0; 415 394 } 416 395 } else { 417 if (ntohl(((RuleDefPtr)(*( rulesCache+pos)))->value->stor.tabAdd6[i])396 if (ntohl(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->value->stor.tabAdd6[i]) 418 397 == 419 398 (*((unsigned long*)&buffer4)) 420 399 ) 421 400 { 422 ((RuleDefPtr)(*( rulesCache+pos)))->check =423 ((RuleDefPtr)(*( rulesCache+pos)))->check && 1;401 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 402 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check && 1; 424 403 } else { 425 ((RuleDefPtr)(*( rulesCache+pos)))->check = 0;404 ((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->check = 0; 426 405 moreIsNecessary = 0; 427 406 } … … 441 420 syslog(LOG_INFO, "Field size not known: %d\n", field_size); 442 421 for (i=0; i<field_size; i++){ 443 (* offV9)++;422 (*myPtrs->offsetV9Ptr)++; 444 423 } 445 424 break; … … 448 427 default: 449 428 syslog(LOG_INFO, "Operator not known: %d\n", 450 (int)(((RuleDefPtr)(*( rulesCache+pos)))->operator));429 (int)(((RuleDefPtr)(*(myPtrs->rulesAddressPtr+pos)))->operator)); 451 430 break; 452 431 } 453 432 j++; 454 433 pos = (pftmp->fieldType)*10+j; 455 } /* end while rulesCache*/434 } /* end while myPtrs->rulesAddressPtr */ 456 435 } else { 457 436 /* … … 460 439 switch (field_size) { 461 440 case 1: 462 buffer1 = *( buf+(*offV9)); (*offV9)++;441 buffer1 = *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 463 442 #ifdef IPV4AGG 464 443 if ((pftmp->fieldType==9)||(pftmp->fieldType==29)){ … … 498 477 break; 499 478 case 2: 500 buffer2[1]= *( buf+(*offV9)); (*offV9)++;501 buffer2[0]= *( buf+(*offV9)); (*offV9)++;479 buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 480 buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 502 481 #ifdef IPV4AGG 503 482 if (pftmp->fieldType==10){ … … 522 501 case 3: 523 502 buffer4[3]= 0; 524 buffer4[2]= *( buf+(*offV9)); (*offV9)++;525 buffer4[1]= *( buf+(*offV9)); (*offV9)++;526 buffer4[0]= *( buf+(*offV9)); (*offV9)++;503 buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 504 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 505 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 527 506 /* aggregation */ 528 507 /* end aggregation */ … … 534 513 break; 535 514 case 4: 536 buffer4[3]= *( buf+(*offV9)); (*offV9)++;537 buffer4[2]= *( buf+(*offV9)); (*offV9)++;538 buffer4[1]= *( buf+(*offV9)); (*offV9)++;539 buffer4[0]= *( buf+(*offV9)); (*offV9)++;515 buffer4[3]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 516 buffer4[2]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 517 buffer4[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 518 buffer4[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 540 519 #ifdef IPV4AGG 541 520 if ((pftmp->fieldType==8)){ … … 575 554 case 16: 576 555 for (i=0; i<4; i++) { 577 buffer2[1]= *( buf+(*offV9)); (*offV9)++;578 buffer2[0]= *( buf+(*offV9)); (*offV9)++;579 buffer2[1]= *( buf+(*offV9)); (*offV9)++;580 buffer2[0]= *( buf+(*offV9)); (*offV9)++;556 buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 557 buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 558 buffer2[1]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 559 buffer2[0]= *(myPtrs->ptr_buffer+(*myPtrs->offsetV9Ptr)); (*myPtrs->offsetV9Ptr)++; 581 560 } 582 561 /* aggregation IPv6 */ … … 586 565 syslog(LOG_INFO,"UNKNOWN FIELDS LENGTH: %d ", field_size); 587 566 for (i=0; i<field_size; i++){ 588 (* offV9)++;567 (*myPtrs->offsetV9Ptr)++; 589 568 } 590 569 } … … 596 575 #ifdef CRIHAN 597 576 if ( mplsFirstCache.mplsLabel1 == 0 ) { 598 ( ipCache+(*ipCounter))->ipProt = ipFirstCache.ipProt;577 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->ipProt = ipFirstCache.ipProt; 599 578 ipFirstCache.ipProt = 0; 600 ( ipCache+(*ipCounter))->bytes = ipFirstCache.bytes;579 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->bytes = ipFirstCache.bytes; 601 580 ipFirstCache.bytes = 0; 602 ( ipCache+(*ipCounter))->pkts = ipFirstCache.pkts;581 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->pkts = ipFirstCache.pkts; 603 582 ipFirstCache.pkts = 0; 604 ( ipCache+(*ipCounter))->inSnmp = ipFirstCache.inSnmp;583 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->inSnmp = ipFirstCache.inSnmp; 605 584 ipFirstCache.inSnmp = 0; 606 ( ipCache+(*ipCounter))->outSnmp = ipFirstCache.outSnmp;585 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->outSnmp = ipFirstCache.outSnmp; 607 586 ipFirstCache.outSnmp = 0; 608 ( ipCache+(*ipCounter))->v4AdS = ipFirstCache.v4AdS;587 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->v4AdS = ipFirstCache.v4AdS; 609 588 ipFirstCache.outSnmp = 0; 610 ( ipCache+(*ipCounter))->v4AdD = ipFirstCache.v4AdD;589 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->v4AdD = ipFirstCache.v4AdD; 611 590 ipFirstCache.v4AdD = 0; 612 ( ipCache+(*ipCounter))->tProt = ipFirstCache.tProt;591 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->tProt = ipFirstCache.tProt; 613 592 ipFirstCache.tProt = 0; 614 ( ipCache+(*ipCounter))->sPort = ipFirstCache.sPort;593 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->sPort = ipFirstCache.sPort; 615 594 ipFirstCache.sPort = 0; 616 ( ipCache+(*ipCounter))->dPort = ipFirstCache.dPort;595 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->dPort = ipFirstCache.dPort; 617 596 ipFirstCache.dPort = 0; 618 ( ipCache+(*ipCounter))->maskD = ipFirstCache.maskD;597 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->maskD = ipFirstCache.maskD; 619 598 ipFirstCache.maskD = 0; 620 ( ipCache+(*ipCounter))->maskS = ipFirstCache.maskS;599 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->maskS = ipFirstCache.maskS; 621 600 ipFirstCache.maskS = 0; 622 ( ipCache+(*ipCounter))->routerAd = ipFirstCache.routerAd;623 ( ipCache+(*ipCounter))->liveTime = lastTime - firstTime;601 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->routerAd = ipFirstCache.routerAd; 602 (myPtrs->tabIPPtr+(*myPtrs->ipNbPtr))->liveTime = lastTime - firstTime; 624 603 firstTime = 0; lastTime = 0; 625 (* ipCounter)++;604 (*myPtrs->ipNbPtr)++; 626 605 } else { 627 (m plsCache+(*mplsCounter))->ipProt = mplsFirstCache.ipProt;606 (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->ipProt = mplsFirstCache.ipProt; 628 607 mplsFirstCache.ipProt = 0; 629 (m plsCache+(*mplsCounter))->v4AdS = mplsFirstCache.v4AdS;608 (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->v4AdS = mplsFirstCache.v4AdS; 630 609 mplsFirstCache.v4AdS = 0; 631 (m plsCache+(*mplsCounter))->v4AdD = mplsFirstCache.v4AdD;610 (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->v4AdD = mplsFirstCache.v4AdD; 632 611 mplsFirstCache.v4AdD = 0; 633 (m plsCache+(*mplsCounter))->routerAd = mplsFirstCache.routerAd;634 (m plsCache+(*mplsCounter))->mplsLabel1 = mplsFirstCache.mplsLabel1;612 (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->routerAd = mplsFirstCache.routerAd; 613 (myPtrs->tabMPLSPtr+(*myPtrs->mplsNbPtr))->mplsLabel1 = mplsFirstCache.mplsLabel1; 635 614 mplsFirstCache.mplsLabel1 = 0; 636 (*m plsCounter)++;615 (*myPtrs->mplsNbPtr)++; 637 616 } 638 617 #endif 639 618 /* put aggregation cache information to IPv4 Prefixes table */ 619 /* Aggregation mode must be enable in ./configure options */ 620 /* first we must know if the address belong to our prefix */ 640 621 #ifdef IPV4AGG 641 622 if (bool == 1){ … … 643 624 res = bsearch(&prefixKey, V4PTab, nbPV4, 644 625 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) {626 if (res!=NULL){ /* OUT ("traffic from the prefix") */ 627 res->bytesNbOUT += agCache.bytes; 628 res->pktsNbOUT += agCache.pkts; 629 (res->flowNbOUT)++; 630 switch (agCache.tProt) { 650 631 case 1: 651 res->icmpBytesNb += agCache.bytes;652 res->icmpPktsNb += agCache.pkts;653 res->icmpFlowNb += 1;632 res->icmpBytesNbOUT += agCache.bytes; 633 res->icmpPktsNbOUT += agCache.pkts; 634 (res->icmpFlowNbOUT)++; 654 635 break; 655 636 case 6: 656 res->tcpBytesNb += agCache.bytes;657 res->tcpPktsNb += agCache.pkts;658 res->tcpFlowNb += 1;637 res->tcpBytesNbOUT += agCache.bytes; 638 res->tcpPktsNbOUT += agCache.pkts; 639 (res->tcpFlowNbOUT)++; 659 640 break; 660 641 case 17: 661 res->udpBytesNb += agCache.bytes;662 res->udpPktsNb += agCache.pkts;663 res->udpFlowNb += 1;642 res->udpBytesNbOUT += agCache.bytes; 643 res->udpPktsNbOUT += agCache.pkts; 644 (res->udpFlowNbOUT)++; 664 645 break; 665 646 default: 666 res->othersBytesNb += agCache.bytes;667 res->othersPktsNb += agCache.pkts;668 res->othersFlowNb += 1;647 res->othersBytesNbOUT += agCache.bytes; 648 res->othersPktsNbOUT += agCache.pkts; 649 (res->othersFlowNbOUT)++; 669 650 } 670 } 671 /* if (res==NULL){ */ 672 /* fprintf(stderr, "IPv4_spoofing? "); */ 673 /* } */ 651 } else { 652 prefixKey.beginning = agCache.v4AdD>>(32-agCache.maskD)<<(32-agCache.maskD); 653 res = bsearch(&prefixKey, V4PTab, nbPV4, 654 sizeof(struct PrefixV4), prefCmp); 655 if (res!=NULL){ /* IN ("traffic to the prefix") */ 656 res->bytesNbIN += agCache.bytes; 657 res->pktsNbIN += agCache.pkts; 658 (res->flowNbIN)++; 659 switch (agCache.tProt) { 660 case 1: 661 res->icmpBytesNbIN += agCache.bytes; 662 res->icmpPktsNbIN += agCache.pkts; 663 (res->icmpFlowNbIN)++; 664 break; 665 case 6: 666 res->tcpBytesNbIN += agCache.bytes; 667 res->tcpPktsNbIN += agCache.pkts; 668 (res->tcpFlowNbIN)++; 669 break; 670 case 17: 671 res->udpBytesNbIN += agCache.bytes; 672 res->udpPktsNbIN += agCache.pkts; 673 (res->udpFlowNbIN)++; 674 break; 675 default: 676 res->othersBytesNbIN += agCache.bytes; 677 res->othersPktsNbIN += agCache.pkts; 678 (res->othersFlowNbIN)++; 679 } 680 } else { 681 /* HERE : we are in the cases of the address/mask don't */ 682 /* belong to a prefix listed in the IPv4 prefix file */ 683 /* possibilities : */ 684 /* - prefix not referenced but allowed to be routed */ 685 /* - prefix not referenced but not allowed to be routed */ 686 /* - spoofing */ 687 /* fprintf(stderr, "%lu.%lu.%lu.%lu/%hu -> %lu.%lu.%lu.%lu/%hu R:%lu.%lu.%lu.%lu \n", */ 688 /* (agCache.v4AdS>>24), */ 689 /* (agCache.v4AdS<<8>>24), */ 690 /* (agCache.v4AdS<<16>>24), */ 691 /* (agCache.v4AdS<<24>>24), */ 692 /* (agCache.maskS), */ 693 /* (agCache.v4AdD>>24), */ 694 /* (agCache.v4AdD<<8>>24), */ 695 /* (agCache.v4AdD<<16>>24), */ 696 /* (agCache.v4AdD<<24>>24), */ 697 /* (agCache.maskD), */ 698 /* (myPtrs->pcktPtr->ipH->srcAdd>>24), */ 699 /* (myPtrs->pcktPtr->ipH->srcAdd<<8>>24), */ 700 /* (myPtrs->pcktPtr->ipH->srcAdd<<16>>24), */ 701 /* (myPtrs->pcktPtr->ipH->srcAdd<<24>>24) */ 702 /* ); */ 703 } 704 } 674 705 } 675 706 bool = 0; … … 680 711 * we send the flow or a part of the flow to a remote host or a file 681 712 */ 682 tmpRuleList = rlPtr;713 tmpRuleList = myPtrs->rulesListPtr; 683 714 while (tmpRuleList){ 684 715 unsigned short check = 1; … … 693 724 /* msg building */ 694 725 secondPftmp = tmp->lastField; 695 /* memcpy(myMsg.text, (char*)( buf+secondOffset),flow_size); */726 /* memcpy(myMsg.text, (char*)(myPtrs->ptr_buffer+secondOffset),flow_size); */ 696 727 msgTextIndex = mempcpy(mempcpy(mempcpy(myMsg.text, 697 728 &tplMsgType, … … 701 732 sizeof(tmpRuleList->id) 702 733 ), 703 & cr->IpAddress,734 &myPtrs->currentRouterPtr->IpAddress, 704 735 sizeof(unsigned long) 705 736 ); … … 711 742 sizeof(tmp->templateFlowSetId) 712 743 ), 713 buf+secondOffset,744 myPtrs->ptr_buffer+secondOffset, 714 745 flow_size 715 746 ); … … 725 756 * end redirection 726 757 */ 727 secondOffset = * offV9;758 secondOffset = *myPtrs->offsetV9Ptr; 728 759 secondOldOffset = secondOffset; 729 760 pftmp = tmp->lastField; 730 761 cpt=0; 731 (* cFNPtr)++; /* pointer on the flows number */732 if (((* offV9)-48-shift+flow_size) > data_length){762 (*myPtrs->currentFlowsetNumberPtr)++; /* pointer on the flows number */ 763 if (((*myPtrs->offsetV9Ptr)-48-shift+flow_size) > data_length){ 733 764 overflow = 1; /* buffer index not correct */ 734 765 } … … 742 773 * template unknown, we skip this all the data 743 774 */ 744 (* offV9)+=(data_length-4);745 (* cFNPtr) = v9Ptr->count;775 (*myPtrs->offsetV9Ptr)+=(data_length-4); 776 (*myPtrs->currentFlowsetNumberPtr) = myPtrs->currentHeaderV9Ptr->count; 746 777 } 747 while ( ((* offV9)-48-shift) < data_length ) {748 (* offV9)++; /* if padding */778 while ( ((*myPtrs->offsetV9Ptr)-48-shift) < data_length ) { 779 (*myPtrs->offsetV9Ptr)++; /* if padding */ 749 780 } 750 while ( (* offV9)-48-shift > data_length ) {751 (* offV9)--; /* crazy loop (when bug appears in template def) */781 while ( (*myPtrs->offsetV9Ptr)-48-shift > data_length ) { 782 (*myPtrs->offsetV9Ptr)--; /* crazy loop (when bug appears in template def) */ 752 783 } 753 784 return (data_length+shift); -
trunk/src/dataFlowSet.h
r22 r23 86 86 }; 87 87 88 struct MyPtrs { 89 RouterPtr currentRouterPtr; 90 NetFlowV9HeaderPtr currentHeaderV9Ptr; 91 unsigned short *offsetV9Ptr; 92 unsigned char *ptr_buffer; 93 short *currentFlowsetNumberPtr; 94 short *currentFlowsetIdPtr; 95 DatagramPtr pcktPtr; 96 RuleDefPtr *rulesAddressPtr; 97 RulesPtr rulesListPtr; /* Rules list */ 98 struct IPFLowCache *tabIPPtr; 99 struct MPLSFlowCache *tabMPLSPtr; 100 unsigned long *ipNbPtr; 101 unsigned long *mplsNbPtr; 102 }; 103 88 104 unsigned short 89 checkDataFlowSet(unsigned short, RouterPtr, NetFlowV9HeaderPtr, 90 unsigned short *, unsigned char *, short *, 91 short *, DatagramPtr, RuleDefPtr *, RulesPtr, int, 92 struct PrefixV4 *, size_t, 93 struct IPFLowCache *, struct MPLSFlowCache *, 94 unsigned long *, unsigned long *); 105 checkDataFlowSet(unsigned short, 106 struct MyPtrs *, 107 int, 108 struct PrefixV4 *, size_t 109 ); 95 110 96 111 #endif /* DATAFLOWSET_H */ -
trunk/src/fields_mgmt.c
r22 r23 31 31 * print_fields_set 32 32 */ 33 void printFieldSet(F ieldPtr pf)33 void printFieldSet(FILE *file, FieldPtr pf) 34 34 { 35 35 FieldPtr tmp = pf; 36 36 for (; tmp; tmp=tmp->next) { 37 fprintf( stderr, "(%hu,%hu) ", tmp->fieldType, tmp->fieldLength);37 fprintf(file, "(%hu,%hu) ", tmp->fieldType, tmp->fieldLength); 38 38 } 39 fprintf( stderr,"\n");39 fprintf(file,"\n"); 40 40 } 41 41 -
trunk/src/fields_mgmt.h
r2 r23 26 26 #define FIELDS_MGMT_H 27 27 28 #include <stdio.h> 29 28 30 typedef struct Field * FieldPtr; 29 31 typedef struct Field { … … 36 38 FieldPtr addField (FieldPtr, unsigned short, unsigned short); 37 39 int delField(unsigned short, unsigned short); 38 void printFieldSet(F ieldPtr);40 void printFieldSet(FILE *, FieldPtr); 39 41 void invPrintFieldSet(FieldPtr); 40 42 void freeField(FieldPtr); -
trunk/src/get_conf.c
r22 r23 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 pV4TabPtr[i].flowNbIN = 0; 175 pV4TabPtr[i].bytesNbIN = 0; 176 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; 189 pV4TabPtr[i].flowNbOUT = 0; 190 pV4TabPtr[i].bytesNbOUT = 0; 191 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; 185 204 } 186 205 if( fclose(prefixFile) == 0) { -
trunk/src/get_conf.h
r22 r23 33 33 unsigned short mask; /* prefix mask */ 34 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; 35 unsigned long long flowNbIN; 36 unsigned long long bytesNbIN; 37 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; 50 unsigned long long flowNbOUT; /* WARNING !!! */ 51 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; 50 65 }; 51 66 -
trunk/src/renetcol.c
r22 r23 26 26 #include "renetcol.h" 27 27 28 /* #ifdef CRIHAN*/29 struct IPFLowCache tabIP[MAX_IP_FLOW], *tabIPPtr = tabIP; 30 struct MPLSFlowCache tabMPLS[MAX_MPLS_FLOW], *tabMPLSPtr = tabMPLS;31 unsigned long ipNb = 0; /* counter of IP flows number */ 32 unsigned long mplsNb = 0; /* counter of MPLS flownumber */33 unsigned long *ipNbPtr = &ipNb;34 unsigned long *mplsNbPtr = &mplsNb; 35 unsigned short currentIPOutputFile = 0; /* index on the current IP file */36 unsigned short currentMPLSOutputFile = 0; /* index on the current MPLS file */28 struct MyPtrs myPtrs; /* defined in dataflowset.h */ 29 30 struct IPFLowCache tabIP[MAX_IP_FLOW]; 31 struct MPLSFlowCache tabMPLS[MAX_MPLS_FLOW]; 32 unsigned long ipNb = 0; /* counter of IP flows number */ 33 unsigned long mplsNb = 0; /* counter of MPLS flow number */ 34 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]; /* 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 */ 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 42 char *rulesFileName; /* file name of the rules (like acl) */ 43 char *configFileName; /* file name where routers list is */ 44 char *prefixV4FileName; /* IPv4 prefix list */ 46 45 47 46 struct sigaction myAction; /* handler for renetcolSender communication */ … … 50 49 /* struct sigaction myAction; for timer not used in this version */ 51 50 52 unsigned short currentIntervalle = 0; /* based on 5 min intervalles */ 53 54 unsigned short offsetV9 = 0; /* index in a neflow v9 packet */ 55 unsigned short *offsetV9Ptr = &offsetV9; 51 unsigned short currentIntervalle = 0; /* based on 5 min intervalles */ 52 53 unsigned short offsetV9 = 0; /* index in a neflow v9 packet */ 56 54 57 55 unsigned char buffer1; … … 61 59 62 60 short currentFlowsetNumber; 63 short *currentFlowsetNumberPtr = ¤tFlowsetNumber;64 61 short currentFlowsetId; 65 short *currentFlowsetIdPtr = ¤tFlowsetId;66 62 TplFlowSetPtr curTplFlSetPtr; /* current template flowset pointer */ 67 63 TplOptionPtr curTplOptionPtr; 68 RouterPtr routersListPtr; 69 RouterPtr currentRouterPtr; 70 DatagramPtr pcktPtr; 64 RouterPtr routersListPtr; 65 71 66 unsigned long sortedRouterList[ROUTER_INDEX_MAX]; 72 67 unsigned long indexedRouterList[ROUTER_INDEX_MAX]; 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 */ 77 NetFlowV9HeaderPtr currentHeaderV9Ptr; 68 int routerNb = 0; /* routers number */ 69 unsigned short v4PrefixNb = 0; /* IPv4 prefix number */ 70 struct PrefixV4 prefixV4Tab[2][MAX_IPV4_PREFIX]; /* IPv4 prefix structure */ 71 unsigned short indexForShmTable = 0; 72 78 73 key_t myKey = 0; /* FIXME to delete in futur */ 79 74 int myQueue = 0; /* FIXME to delete in futur */ … … 81 76 /* Next structure used as cache in rules reading */ 82 77 RuleDefPtr rulesAddress[FIELD_TYPE_NUMBER+1][MAX_RULES_PER_FIELD]; 83 RuleDefPtr *rulesAddressPtr;84 78 85 79 int reInitConf = 0; 86 87 static unsigned long datagramNumber;88 80 89 81 static time_t lastRock; 90 82 static struct tm *tmPtr; 91 83 92 static unsigned long myHost; /* FIXME to erase */93 84 extern int errno; 94 85 static int inputSock; … … 100 91 /* static unsigned short flowNumber; */ 101 92 static unsigned short receptPort = RECEPTION_PORT; 102 static unsigned char *ptr_buffer; 93 /* static unsigned char *ptr_buffer; */ 103 94 static char *receptAddress = RECEPTION_ADDRESS; 104 95 static struct sockaddr_in name; … … 139 130 140 131 initCache(); 141 fprintf(stderr, "re ading the routers list\n");132 fprintf(stderr, "renetcol: reading the routers list...\n"); 142 133 routerNb = getRegisteredRouters(configFileName, &sortedRouterList[0], 143 134 &indexedRouterList[0]); 144 fprintf(stderr, "reading the IPv4 prefix\n"); 135 fprintf(stderr, "renetcol: OK\n"); 136 fprintf(stderr, "renetcol: reading the IPv4 prefix...\n"); 145 137 if ( (v4PrefixNb = getPrefixV4(prefixV4FileName, &prefixV4Tab[0])) < 1){ 146 fprintf(stderr, " Error during prefix v4 reading\n");138 fprintf(stderr, "renetcol: Error \n"); 147 139 exit(1); 148 } 149 rulesListPtr = NULL; 150 fprintf(stderr, "reading the rules\n"); 151 rulesListPtr = getLightRules(rulesListPtr, rulesFileName); 152 tmp = rulesListPtr; 140 } else { 141 fprintf(stderr, "renetcol: OK \n"); 142 } 143 myPtrs.rulesListPtr = NULL; 144 fprintf(stderr, "renetcol: reading the rules...\n"); 145 myPtrs.rulesListPtr = getLightRules(myPtrs.rulesListPtr, rulesFileName); 146 fprintf(stderr, "renetcol : OK \n"); 147 tmp = myPtrs.rulesListPtr; 153 148 for ( ; tmp->next; tmp=tmp->next) { 154 149 if (tmp->type != 2) { 155 rulesListPtr = delRule(tmp,rulesListPtr);150 myPtrs.rulesListPtr = delRule(tmp, myPtrs.rulesListPtr); 156 151 } 157 152 } … … 159 154 /* exit(1); */ 160 155 161 fprintf(stderr, " I become a deamon, next messages via syslogd.\n");156 fprintf(stderr, "renetcol: I become a deamon, next messages via syslogd. By.\n"); 162 157 if (fork () != 0) 163 158 exit (0); … … 174 169 175 170 /* Pointer on rules Table */ 176 setCache( rulesListPtr);177 rulesAddressPtr = (RuleDefPtr *)rulesAddress;171 setCache(myPtrs.rulesListPtr); 172 myPtrs.rulesAddressPtr = (RuleDefPtr *)rulesAddress; 178 173 179 174 /* init IPC messages queue */ … … 183 178 184 179 /* INIT THE CURRENTS VARIABLES*/ 185 currentRouterPtr = routersListPtr;186 currentHeaderV9Ptr = (NetFlowV9HeaderPtr)180 myPtrs.currentRouterPtr = routersListPtr; 181 myPtrs.currentHeaderV9Ptr = (NetFlowV9HeaderPtr) 187 182 malloc(sizeof(struct NetFlowV9Header)); 188 pcktPtr = (DatagramPtr) malloc(sizeof(struct Datagram)); 189 if (pcktPtr==NULL) { 183 myPtrs.offsetV9Ptr = &offsetV9; 184 myPtrs.currentFlowsetIdPtr = ¤tFlowsetId; 185 myPtrs.pcktPtr = (DatagramPtr) malloc(sizeof(struct Datagram)); 186 myPtrs.currentFlowsetNumberPtr = ¤tFlowsetNumber; 187 myPtrs.ipNbPtr = &ipNb; 188 myPtrs.mplsNbPtr = &mplsNb; 189 190 if (myPtrs.pcktPtr==NULL) { 190 191 fprintf(stderr, "ERROR in struct Datagram allocation\n"); 191 192 exit(1); 192 193 } else { 193 pcktPtr->ipH = (IpHeaderPtr) malloc(sizeof(struct IpHeader));194 pcktPtr->udp_header = (UdpHeaderPtr) malloc(sizeof(struct UdpHeader));195 } 196 197 if (! ( ptr_buffer = malloc(sockBufSize)))194 myPtrs.pcktPtr->ipH = (IpHeaderPtr) malloc(sizeof(struct IpHeader)); 195 myPtrs.pcktPtr->udp_header = (UdpHeaderPtr) malloc(sizeof(struct UdpHeader)); 196 } 197 198 if (! (myPtrs.ptr_buffer = malloc(sockBufSize))) 198 199 { 199 200 printf("ERROR during socket buffer allocation\n"); … … 204 205 initStream(); 205 206 206 datagramNumber =0; /* FIXME : ???? */207 208 207 socketLoop(); /* all work on datagram is made here */ 208 209 209 closelog(); 210 210 211 fprintf(stderr, "END\n"); 212 211 213 return (0); 212 214 } 213 215 214 216 /* 215 * 216 */ 217 void sendMyPid(int queueID) 217 * send his PID to another program via IPC message queue 218 * 219 * @param queueID the IPC queue ident 220 * 221 */ 222 void 223 sendMyPid(int queueID) 218 224 { 219 225 msgType myMsg; … … 235 241 236 242 /* 243 * Send the "read rules list" message to another program 244 * 245 * @param queueID the IPC queue ident 237 246 * 238 247 */ … … 252 261 253 262 /* 254 * 255 */ 256 void sigusr1Mgmt(int num) 263 * 264 */ 265 void 266 sigusr1Mgmt(int num) 257 267 { 258 268 sigusr1Up = 1; … … 260 270 261 271 /* 262 * 272 * init the rule structure 263 273 */ 264 274 void … … 267 277 RulesPtr tmp = NULL; 268 278 initCache(); 269 tmp = rulesListPtr;279 tmp = myPtrs.rulesListPtr; 270 280 for ( ; tmp; tmp=tmp->next) { 271 rulesListPtr = delRule(tmp,rulesListPtr);272 } 273 rulesListPtr = NULL;274 rulesListPtr = getLightRules(rulesListPtr, rulesFileName);275 tmp = rulesListPtr;281 myPtrs.rulesListPtr = delRule(tmp, myPtrs.rulesListPtr); 282 } 283 myPtrs.rulesListPtr = NULL; 284 myPtrs.rulesListPtr = getLightRules(myPtrs.rulesListPtr, rulesFileName); 285 tmp = myPtrs.rulesListPtr; 276 286 for ( ; tmp; tmp=tmp->next) { 277 287 if (tmp->type != 2) { 278 rulesListPtr = delRule(tmp,rulesListPtr);288 myPtrs.rulesListPtr = delRule(tmp, myPtrs.rulesListPtr); 279 289 } 280 290 } 281 291 tmp = NULL; 282 292 initCache(); 283 setCache( rulesListPtr);293 setCache(myPtrs.rulesListPtr); 284 294 sendReadRulesSignal(myQueue); 285 295 } 286 296 287 297 /* 288 * 298 * init cache table 289 299 */ 290 300 void … … 339 349 buffer4[2] = (unsigned char)n1; 340 350 buffer4[3] = (unsigned char)n0; 341 myHost = *((unsigned long*)&buffer4[0]);342 351 } 343 352 … … 353 362 time_t now = time((time_t *)NULL); 354 363 int iIP, iMPLS, i; 364 int loopNb = 0; 355 365 time_t lastIPOutput, lastMPLSOutput; 356 366 time_t receptionTime; … … 371 381 } 372 382 socketReading(); 373 getIpHeader(pcktPtr, ptr_buffer); 374 regRouter = checkIpHeader(pcktPtr, &sortedRouterList[0], routerNb); 375 getUdpHeader(pcktPtr, ptr_buffer); 376 checkUdpHeader(pcktPtr, regRouter, receptPort); 383 getIpHeader(myPtrs.pcktPtr, myPtrs.ptr_buffer); 384 regRouter = checkIpHeader(myPtrs.pcktPtr, &sortedRouterList[0], routerNb); 385 getUdpHeader(myPtrs.pcktPtr, myPtrs.ptr_buffer); 386 if ( checkUdpHeader(myPtrs.pcktPtr, regRouter, receptPort) == 1 ){ 387 continue; 388 } 377 389 378 390 switch( version = 379 getNetFlowHeader( pcktPtr,ptr_buffer,380 currentHeaderV9Ptr,offsetV9Ptr)){391 getNetFlowHeader(myPtrs.pcktPtr, myPtrs.ptr_buffer, 392 myPtrs.currentHeaderV9Ptr, myPtrs.offsetV9Ptr)){ 381 393 case 9: 382 if (( currentRouterPtr=notExistRouter(routersListPtr,383 394 if ((myPtrs.currentRouterPtr=notExistRouter(routersListPtr, 395 myPtrs.pcktPtr->ipH->srcAdd))==NULL) { 384 396 routersListPtr = addRouter(routersListPtr, 385 pcktPtr->ipH->srcAdd,397 myPtrs.pcktPtr->ipH->srcAdd, 386 398 (unsigned long) 0); 387 currentRouterPtr = routersListPtr;399 myPtrs.currentRouterPtr = routersListPtr; 388 400 } 389 401 currentFlowsetNumber = 0; 390 402 shift = 0; 391 while ((currentFlowsetNumber < currentHeaderV9Ptr->count)) {403 while ((currentFlowsetNumber < myPtrs.currentHeaderV9Ptr->count)) { 392 404 curTplFlSetPtr = NULL; 393 405 currentFlowsetId=getFlowsetId(currentFlowsetNumber, 394 offsetV9Ptr,ptr_buffer);406 myPtrs.offsetV9Ptr, myPtrs.ptr_buffer); 395 407 if ( currentFlowsetId == 0 ) { 396 shift = checkTemplateFlowSet( currentRouterPtr,offsetV9Ptr,397 ptr_buffer,currentHeaderV9Ptr,408 shift = checkTemplateFlowSet(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr, 409 myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 398 410 curTplFlSetPtr, 399 currentFlowsetNumberPtr,411 myPtrs.currentFlowsetNumberPtr, 400 412 myQueue); 401 /* FIXME : TplFlSet Def in a file before next release */402 /* showAllTplFlSet(); */403 413 } else if (currentFlowsetId == 1) { 404 shift = checkTemplateOption( currentRouterPtr,offsetV9Ptr,405 ptr_buffer,currentHeaderV9Ptr,414 shift = checkTemplateOption(myPtrs.currentRouterPtr, myPtrs.offsetV9Ptr, 415 myPtrs.ptr_buffer, myPtrs.currentHeaderV9Ptr, 406 416 curTplOptionPtr, 407 currentFlowsetNumberPtr);417 myPtrs.currentFlowsetNumberPtr); 408 418 } else { 409 shift = checkDataFlowSet(shift, currentRouterPtr, 410 currentHeaderV9Ptr, offsetV9Ptr, 411 ptr_buffer, currentFlowsetNumberPtr, 412 currentFlowsetIdPtr, pcktPtr, 413 rulesAddressPtr, rulesListPtr, 414 myQueue, prefixV4Tab, 415 (size_t) v4PrefixNb, 416 tabIPPtr, 417 tabMPLSPtr, 418 ipNbPtr, mplsNbPtr); 419 shift = checkDataFlowSet(shift, 420 &myPtrs, 421 myQueue, 422 prefixV4Tab, 423 (size_t) v4PrefixNb 424 ); 419 425 } 420 } 426 } /* end while flowset exist */ 421 427 break; 422 428 default: 423 /* FIXME : Uncomment before next release */ 424 /* syslog(LOG_INFO, */ 425 /* "NetFlow exp. version unknown: %hu, from router: %lu.%lu.%lu.%lu", */ 426 /* (unsigned short) version, */ 427 /* (pcktPtr->ipH->srcAdd>>24), */ 428 /* (pcktPtr->ipH->srcAdd<<8>>24), */ 429 /* (pcktPtr->ipH->srcAdd<<16>>24), */ 430 /* (pcktPtr->ipH->srcAdd<<24>>24)); */ 429 syslog(LOG_INFO, 430 "NetFlow exp. version unknown: %hu, from router: %lu.%lu.%lu.%lu", 431 (unsigned short) version, 432 (myPtrs.pcktPtr->ipH->srcAdd>>24), 433 (myPtrs.pcktPtr->ipH->srcAdd<<8>>24), 434 (myPtrs.pcktPtr->ipH->srcAdd<<16>>24), 435 (myPtrs.pcktPtr->ipH->srcAdd<<24>>24)); 431 436 break; 432 437 } 433 /* for (i=0; i<v4PrefixNb; i++){ */ 434 /* fprintf(stderr, "%lu %llu flows\n", */ 435 /* prefixV4Tab[i].beginning, */ 436 /* prefixV4Tab[i].flowNb); */ 437 /* } */ 438 if (loopNb > 100 ){ 439 /* FIXME perhaps call this function via the compilation options */ 440 writeAllTplFlSet(); 441 for (i=0; i<v4PrefixNb; i++){ 442 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", 443 prefixV4Tab[i].beginning, 444 prefixV4Tab[i].flowNbIN, 445 prefixV4Tab[i].bytesNbIN, 446 prefixV4Tab[i].pktsNbIN, 447 prefixV4Tab[i].udpPktsNbIN, 448 prefixV4Tab[i].tcpPktsNbIN, 449 prefixV4Tab[i].icmpPktsNbIN, 450 prefixV4Tab[i].othersPktsNbIN, 451 prefixV4Tab[i].udpBytesNbIN, 452 prefixV4Tab[i].tcpBytesNbIN, 453 prefixV4Tab[i].icmpBytesNbIN, 454 prefixV4Tab[i].othersBytesNbIN, 455 prefixV4Tab[i].udpFlowNbIN, 456 prefixV4Tab[i].tcpFlowNbIN, 457 prefixV4Tab[i].icmpFlowNbIN, 458 prefixV4Tab[i].othersFlowNbIN, 459 prefixV4Tab[i].flowNbOUT, 460 prefixV4Tab[i].bytesNbOUT, 461 prefixV4Tab[i].pktsNbOUT, 462 prefixV4Tab[i].udpPktsNbOUT, 463 prefixV4Tab[i].tcpPktsNbOUT, 464 prefixV4Tab[i].icmpPktsNbOUT, 465 prefixV4Tab[i].othersPktsNbOUT, 466 prefixV4Tab[i].udpBytesNbOUT, 467 prefixV4Tab[i].tcpBytesNbOUT, 468 prefixV4Tab[i].icmpBytesNbOUT, 469 prefixV4Tab[i].othersBytesNbOUT, 470 prefixV4Tab[i].udpFlowNbOUT, 471 prefixV4Tab[i].tcpFlowNbOUT, 472 prefixV4Tab[i].icmpFlowNbOUT, 473 prefixV4Tab[i].othersFlowNbOUT 474 ); 475 } 476 loopNb = 0; 477 } 478 loopNb++; 438 479 439 480 #ifdef CRIHAN … … 558 599 } 559 600 /* Here socket DGRAM creation, only to not have a unreachable service */ 601 /* message in return */ 560 602 inputSock2 = socket(AF_INET, SOCK_DGRAM, 0); 561 603 if (inputSock2 < 0) … … 597 639 598 640 sockNameFromlg = sizeof(fromName); 599 rcv = recvfrom(inputSock, ptr_buffer, sockBufSize, 0,641 rcv = recvfrom(inputSock, myPtrs.ptr_buffer, sockBufSize, 0, 600 642 (struct sockaddr *)(&fromName), 601 643 (socklen_t *)&sockNameFromlg); … … 613 655 614 656 /* 615 * check up flow datagramme 657 * check up flow datagramme 616 658 */ 617 659 short 618 660 checkFlow(short flowNumber) 619 661 { 620 return(0); 662 return(0); /* FIXME : why this function ??? */ 621 663 } 622 664 … … 624 666 * showAllTplFlSet 625 667 * 668 * to use only in debug mode 626 669 */ 627 670 void … … 643 686 tmpFS->templateFlowSetId, 644 687 tmpFS->sourceId); 645 printFieldSet( tmpFS->fieldSet);688 printFieldSet(stderr, tmpFS->fieldSet); 646 689 fprintf(stderr,"\n"); 647 690 } … … 651 694 tmpOP->templateOptionId, 652 695 tmpOP->sourceId); 653 printFieldSet( tmpOP->fieldSet);696 printFieldSet(stderr, tmpOP->fieldSet); 654 697 fprintf(stderr,"\n"); 655 698 } … … 658 701 } 659 702 } 703 704 705 /* 706 * writeAllTplFlSet 707 * 708 */ 709 void 710 writeAllTplFlSet() 711 { 712 713 RouterPtr tmp = routersListPtr; 714 TplFlowSetPtr tmpFS; 715 TplOptionPtr tmpOP; 716 FILE *TPLFILE; 717 if (!(TPLFILE = fopen("/tmp/TemplateDef.txt", "w"))) { 718 syslog (LOG_ERR, "error during %s opening", "/tmp/TemplateDef.txt"); 719 } 720 fprintf(TPLFILE,"\n*********************************************\n* All template definitions: (field, size) : *\n*********************************************\n"); 721 for (; tmp; tmp=tmp->next) { 722 fprintf(TPLFILE,"----------------------\nrouter %lu.%lu.%lu.%lu : \n----------------------\n", 723 (tmp->IpAddress>>24), 724 (tmp->IpAddress<<8>>24), 725 (tmp->IpAddress<<16>>24), 726 (tmp->IpAddress<<24>>24)); 727 tmpFS = tmp->tplList; 728 for (; tmpFS; tmpFS=tmpFS->next) { 729 fprintf(TPLFILE,"TId %hu (sourceId: %lu):\n", 730 tmpFS->templateFlowSetId, 731 tmpFS->sourceId); 732 printFieldSet(TPLFILE, tmpFS->fieldSet); 733 fprintf(TPLFILE,"\n"); 734 } 735 if ((tmpOP = tmp->tplOptList) != NULL){ 736 for (; tmpOP; tmpOP=tmpOP->next) { 737 fprintf(TPLFILE,"OpTId %hu (sourceId: %lu) >\n", 738 tmpOP->templateOptionId, 739 tmpOP->sourceId); 740 printFieldSet(TPLFILE, tmpOP->fieldSet); 741 fprintf(TPLFILE,"\n"); 742 } 743 fprintf(TPLFILE,"\n"); 744 } 745 } 746 fclose(TPLFILE); 747 } -
trunk/src/renetcol.h
r22 r23 82 82 #define MPLS_TIME_THRESHOLD 60 /* in sec */ 83 83 #endif /* CRIHAN */ 84 84 85 #define MAX_IP_FLOW 10000 85 86 #define MAX_MPLS_FLOW 200 87 88 /* struct SHMForAgg { */ 89 /* struct PrefixV4 prefixV4Tab[MAX_IPV4_PREFIX]; */ 90 /* } */ 91 86 92 87 93 void setCache(RulesPtr); … … 100 106 short checkFlow(short); 101 107 void showAllTplFlSet(); 108 void writeAllTplFlSet(); 102 109 -
trunk/src/renetcolSender.c
r20 r23 299 299 } 300 300 if (sscanf (argv[2], "%ld", &type) != 1){ 301 fprintf(stderr, " Invalid type\n");301 fprintf(stderr, "renetcolSender: Error, Invalid message type in command\n"); 302 302 exit(1); 303 303 } … … 309 309 strcpy (rulesFileName, argv[3]); 310 310 rulesListPtr = NULL; 311 fprintf(stderr, "renetcolSender: reading the rules...\n"); 311 312 rulesListPtr = getRules(rulesListPtr, rulesFileName); 313 fprintf(stderr, "renetcolSender: OK\n"); 312 314 /* we delete rules which are not type socket */ 313 315 tmp = rulesListPtr; … … 329 331 330 332 /* chdir ("/"); */ 331 fprintf(stderr, " I become a deamon, next messages via syslogd.\n");333 fprintf(stderr, "renetcolSender: I become a deamon, next messages via syslogd. By.\n"); 332 334 if (fork () != 0) 333 335 exit (0); -
trunk/src/template.c
r16 r23 126 126 syslog (LOG_INFO, 127 127 "fields nb too large, bug collector or wrong template def"); 128 exit(1);128 cTFSPtr = deleteTplFlSet(cTFSPtr); 129 129 } 130 130 } … … 181 181 syslog (LOG_INFO, 182 182 "fields nb too large, bug collector or wrong template def"); 183 exit(1);183 cTFSPtr = deleteTplFlSet(cTFSPtr); 184 184 } 185 185 } … … 194 194 /* ( cr->IpAddress)<<24>>24); */ 195 195 /* fprintf(stderr,"%lu %d\n", cTFSPtr->sourceId, sizeof(cTFSPtr->sourceId)); */ 196 /* FIXME HERE don't send an wrong def if error detected */ 196 197 msgTextIndex = mempcpy(mempcpy(mempcpy(mempcpy(mempcpy(myMsg.text, 197 198 &tplMsgType,