- Timestamp:
- 11/03/08 10:46:51 (14 years ago)
- Location:
- trunk/src
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/as.h
r60 r77 35 35 #include <syslog.h> 36 36 37 #ifdef ASACC38 37 struct AS{ 39 38 unsigned short as; … … 46 45 unsigned long long pktsNbOUT; 47 46 }; 48 #endif49 47 50 48 int asGlobalCmp(const void *, const void *); -
trunk/src/renetcolSender.c
r75 r77 43 43 44 44 /* 45 * subsstr 46 * 47 * substitute '_' char in a string with ' ' 48 */ 49 char *subsstr(char *chin) 50 { 51 int i; 52 for (i = 0; i < strlen(chin); i++) { 53 if (chin[i] == '_') { 54 chin[i] = ' '; 55 } 56 } 57 return chin; 58 } 59 60 /* 45 61 * todo 46 62 */ … … 53 69 FILE *tmpFile; 54 70 char port[6]; 71 /* char value[44]; */ 55 72 char filters[249]; 73 /* char operator[2]; */ 56 74 char lines[256][256]; 57 75 char line[256]; … … 129 147 /* NEW RULE */ 130 148 if (sscanf(buffer, "%s %s\n", 131 port, 132 filters) == 0) { 149 port, 150 filters) == 0) { 151 syslog (LOG_ERR, "reception de : %s, %s et %s", buffer, port, filters); 133 152 syslog (LOG_ERR, "error in rule syntax: %s", filters); 134 153 close(sock); 135 154 return 1; 136 155 } 156 syslog (LOG_ERR, "filters : %s", filters); 137 157 subsstr(filters); 158 syslog (LOG_ERR, "filters modifies : %s", filters); 138 159 if (!(ruleFile = fopen(RULES_FILE, "a"))) { 139 140 141 160 syslog (LOG_ERR, "error during %s opening", RULES_FILE); 161 close(sock); 162 return 1; 142 163 } else { 143 fprintf(ruleFile, "N %s\n", host); 144 fprintf(ruleFile, "O socket %s %s\n", host, port); 145 fprintf(ruleFile, "%s\n", filters); 146 fclose(ruleFile); 147 } 148 164 fprintf(ruleFile, "N %s\n", host); 165 fprintf(ruleFile, "O socket %s %s\n", host, port); 166 fprintf(ruleFile, "%s\n", filters); 167 fclose(ruleFile); 168 } 149 169 } 150 170 } -
trunk/src/renetcolSender.h
r36 r77 43 43 #include "renetcolParam.h" 44 44 45 #define CONST1 "C " 46 45 47 typedef union semun 46 48 { -
trunk/src/template.c
r76 r77 36 36 unsigned short os; 37 37 unsigned char buffer2[2]; 38 38 39 39 if ( cfn == 0 ) { 40 40 os = 20+8+20; … … 78 78 unsigned short badFieldLength = 0; 79 79 unsigned short badFieldCount = 0; 80 80 81 81 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 82 82 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; … … 166 166 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 167 167 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 168 if ( (fldPtr->fieldType = *((unsigned short*)&buffer2) ) > 89) {168 if ( (fldPtr->fieldType = *((unsigned short*)&buffer2) ) > 216) { 169 169 badFieldNumber = 1; 170 170 } … … 205 205 } 206 206 syslog (LOG_INFO, 207 "in new template: field nb gt 89, field lg gt 16 or too many fields, bad template definition possibility");207 "in new template: field nb gt 216, field lg gt 16 or too many fields, bad template definition possibility"); 208 208 fprintf(stderr, 209 209 "\n in new template function: too many fields, bug collector or wrong template def \n"); … … 272 272 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 273 273 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 274 if ( (fldPtr->fieldType = *((unsigned short*)&buffer2) ) > 89) {274 if ( (fldPtr->fieldType = *((unsigned short*)&buffer2) ) > 216) { 275 275 badFieldNumber = 1; 276 276 } … … 397 397 length = *((unsigned short*)&buffer2); 398 398 do { 399 /*#ifdef DEBUG */ 399 #ifdef DEBUG 400 400 fprintf (stderr, "< %hu, %hu, ",getFlowsetId, length); 401 /*#endif*/ 401 #endif 402 402 badFieldNumber = 0; 403 403 badFieldLength = 0; … … 425 425 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 426 426 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 427 if ( (tmp->fieldType = *((unsigned short*)&buffer2) ) > 89) {427 if ( (tmp->fieldType = *((unsigned short*)&buffer2) ) > 216) { 428 428 badFieldNumber = 1; 429 429 } … … 454 454 syslog (LOG_INFO, 455 455 "in option template function: too many fields, bug collector or wrong template def in template update"); 456 /*#ifdef DEBUG*/ 456 #ifdef DEBUG 457 457 fprintf(stderr, 458 458 "\nin option template function: too many fields, bug collector or wrong template def in template update\n"); 459 /*#endif*/ 459 #endif 460 460 while ( ((*offV9))> (index)){ 461 461 buffer2[1]= *(buf+index); index++; … … 518 518 buffer2[1]= *(buf+(*offV9)); (*offV9)++; cpt++; 519 519 buffer2[0]= *(buf+(*offV9)); (*offV9)++; cpt++; 520 if ( (tmp->fieldType = *((unsigned short*)&buffer2) ) > 89) {520 if ( (tmp->fieldType = *((unsigned short*)&buffer2) ) > 216) { 521 521 badFieldNumber = 1; 522 522 } … … 545 545 syslog (LOG_INFO, 546 546 "in update option tpl function: too many fields, bug collector or wrong template def in template update"); 547 /*#ifdef DEBUG*/ 547 #ifdef DEBUG 548 548 fprintf(stderr, 549 549 "\nin update option tpl function: too many fields, bug collector or wrong template def in template update\n"); 550 /*#endif*/ 550 #endif 551 551 ptplotmp = cTOPtr; 552 552 if (ptplotmp->prev == NULL) { … … 574 574 } while ((cpt) < (length-2)); 575 575 /* show_all_tplFlSet(); */ 576 /*#ifdef DEBUG*/ 576 #ifdef DEBUG 577 577 fprintf (stderr, ">"); 578 /*#endif*/ 578 #endif 579 579 return length; 580 580 }