diff --git a/server/replay_cache.c b/server/replay_cache.c index 6a784671..766d9a10 100644 --- a/server/replay_cache.c +++ b/server/replay_cache.c @@ -152,7 +152,13 @@ replay_cache_init(fko_srv_options_t *opts) int replay_file_cache_init(fko_srv_options_t *opts) { - FILE *digest_file_cache_ptr = NULL; + FILE *digest_file_ptr = NULL; + unsigned int num_lines = 0; + char line_buf[MAX_LINE_LEN] = {0}; + char src_ip[INET_ADDRSTRLEN+1] = {0}; + char dst_ip[INET_ADDRSTRLEN+1] = {0}; + + struct digest_cache_list *digest_elm = NULL; /* if the file exists, import the previous SPA digests into * the cache list @@ -170,20 +176,96 @@ replay_file_cache_init(fko_srv_options_t *opts) } else { - /* the does not exist yet, so it will be created when the first + /* the file does not exist yet, so it will be created when the first * successful SPA packet digest is written to disk */ return(-1); } - if ((digest_file_cache_ptr = fopen(opts->config[CONF_DIGEST_FILE], "r")) == NULL) + /* File exist, and we have access - create in-memory digest cache + */ + if ((digest_file_ptr = fopen(opts->config[CONF_DIGEST_FILE], "r")) == NULL) { log_msg(LOG_WARNING, "Could not open digest cache: %s", opts->config[CONF_DIGEST_FILE]); return(-1); } - fclose(digest_file_cache_ptr); + /* Line format: + *