void dataplane_stream_global_initialize(void) { int i = 0; int index = 0; rule_stream_st * rule_stream_tmp = NULL; g_stream_table = (rule_stream_st *)malloc( (MAX_NUM_RULE_FIVETUPLE + MAX_NUM_RULE_FIVETUPLE_DEFAULT)*sizeof(rule_stream_st)); memset(g_stream_table, 0, (MAX_NUM_RULE_FIVETUPLE + MAX_NUM_RULE_FIVETUPLE_DEFAULT)*sizeof(rule_stream_st)); g_ix_rfc_table_base = (rfc_acl_s*)malloc(sizeof(rfc_acl_s)); memset(g_ix_rfc_table_base, 0, sizeof(rfc_acl_s)); printf("test-------------->sizeof(g_ix_rfc_table_base) = %d \n", sizeof(*g_ix_rfc_table_base)); printf("test-------------->sizeof(g_stream_table) = %d \n", sizeof(*g_stream_table)); printf("test-------------->sizeof(rule_set_t) = %d \n", sizeof(rule_set_t)); printf("test-------------->sizeof(rule_t) = %d \n", sizeof(rule_t)); for (i = 0; i < MAX_NUM_RULE_FIVETUPLE; i++) { rule_stream_tmp = &g_stream_table[i]; memset(rule_stream_tmp, 0, sizeof(rule_stream_st)); rule_stream_tmp->valid = INVALID; rule_stream_tmp->enabled = DISABLE; rule_stream_tmp->rule_id = STREAM_INVALID_INDEX; } for (i = 0; i < MAX_NUM_RULE_FIVETUPLE_DEFAULT; i ++) { index = i + OFFSET_RULE_FIVETUPLE_DEFAULT; rule_stream_tmp = &g_stream_table[index]; memset(rule_stream_tmp, 0, sizeof(rule_stream_st)); rule_stream_tmp->valid = INVALID; rule_stream_tmp->enabled = DISABLE; rule_stream_tmp->rule_id = index + 1; //STREAM_INVALID_INDEX; rule_stream_tmp->transimit.action = ACTION_PERMIT; rule_stream_tmp->transimit.iifgrp = i + 1 ; rule_stream_tmp->transimit.oifgrp[0] = INVALID_GROUP; rule_stream_tmp->transimit.oifgrp[1] = INVALID_GROUP; rule_stream_tmp->transimit.oifgrp[2] = INVALID_GROUP; rule_stream_tmp->transimit.oifgrp[3] = INVALID_GROUP; rule_stream_tmp->transimit.fwd_oifgrp_num = 0; } rfc_init(); }
void dnscore_init() { if(dnscore_init_done) { return; } dnscore_init_done = TRUE; dnscore_arch_checkup(); //random_init(time(NULL)); thread_pool_setup_random_ctx(); random_ctx rnd = thread_pool_get_random_ctx(); // random NEEDS to work. { u32 r0 = random_next(rnd); u32 r1 = random_next(rnd); u32 r2 = random_next(rnd); u32 r3 = random_next(rnd); if( ((r0 == 0) && (r1 == 0) && (r2 == 0) && (r3 == 0)) || ((r0 == r1) && (r1 == r2) && (r2 == r3)) ) { printf("panic: random generation fails. (%08x,%08x,%08x,%08x)\n", r0, r1, r2, r3); exit(-1); } } rfc_init(); format_class_init(); dnsformat_class_init(); stdstream_init(); logger_init(); dnscore_register_errors(); #if HAS_TSIG_SUPPORT tsig_register_algorithms(); #endif atexit(dnscore_finalize); dnscore_reset_timer(); }