Projects STRLCPY 5GReplay Commits 4fba0f1e
🤬
  • Fixed bug when that does not forward packets when no rules are satisfied

  • Loading...
  • nhnghia committed 3 years ago
    4fba0f1e
    1 parent 794c8e62
  • ■ ■ ■ ■ ■ ■
    .gitignore
    skipped 26 lines
    27 27  *.wmv
    28 28   
    29 29  /build/
     30 +/.cproject
     31 +/.project
     32 +/.settings
     33 +/.externalToolBuilders
    30 34   
  • ■ ■ ■ ■ ■
    src/command/replay.c
    skipped 453 lines
    454 454   uint32_t rm_rules_arr[50];
    455 455   char string[500], *ch = string;
    456 456   int i;
     457 + int ret = 0;
    457 458   
    458 459   context_t *context = (context_t *) args;
    459 460   MUST_NOT_OCCUR( context == NULL, "args parameter must not be NULL"); //this must not happen
    skipped 9 lines
    469 470   
    470 471   //if there is no interested information
    471 472   //TODO: to check if we still need to send timestamp/counter to mmt-sec?
    472  - if( unlikely( msg == NULL ))
    473  - return 1;
     473 + if( unlikely( msg == NULL )){
     474 + goto __finish_security;
     475 + ret = 1;
     476 + }
    474 477   
    475 478   mmt_sec_process( context->sec_handler, msg );
    476 479   
    skipped 30 lines
    507 510   
    508 511   total_received_reports ++;
    509 512   
    510  - return 0;
     513 + //when forwarding packet is enable
     514 + // we need to call this function to forward the current packet if it is not satisfied by any rule
     515 + __finish_security:
     516 + if( context->config->forward->is_enable )
     517 + forward_packet_on_receiving_packet_after_rule_processing( ipacket, context->forward_context );
     518 + 
     519 + 
     520 + return ret;
    511 521  }
    512 522   
    513 523  void live_capture_callback( u_char *user, const struct pcap_pkthdr *p_pkthdr, const u_char *data ){
    skipped 197 lines
  • ■ ■ ■ ■ ■ ■
    src/engine/gen_code.c
    skipped 1144 lines
    1145 1145   * Public API
    1146 1146   */
    1147 1147  int generate_fsm( const char* file_name, rule_t *const* rules, size_t count, const char*embedded_functions ){
    1148  - char *str_ptr;
     1148 + char *str_ptr = NULL;
    1149 1149   size_t i;
    1150 1150   //open file for writing
    1151 1151   FILE *fd = fopen(file_name, "w");
    1152 1152   ASSERT (fd != NULL, "Error 11a: Cannot open file %s for writing", file_name );
    1153 1153   
    1154 1154   str_ptr = get_current_date_time_string( "%Y-%m-%d %H:%M:%S" );
    1155  - _gen_comment( fd, "This file is generated automatically on %s", str_ptr);
     1155 + _gen_comment( fd, "This file is generated automatically on %s", str_ptr == NULL ? "unknown" : str_ptr );
    1156 1156   mmt_mem_free( str_ptr );
    1157 1157   
    1158 1158   //include
    skipped 79 lines
Please wait...
Page is in error, reload to recover