コード例 #1
0
ファイル: iface_locators.c プロジェクト: biels/oor
/*
 * Release memory of an iface_locators structure
 * @param if_loct Element to be released
 */
void
iface_locators_del(iface_locators *if_loct)
{
    free(if_loct->iface_name);
    glist_destroy(if_loct->map_loc_entries);
    glist_destroy(if_loct->ipv4_locators);
    glist_destroy(if_loct->ipv6_locators);
    if (if_loct->ipv4_prev_addr != NULL){
        lisp_addr_del(if_loct->ipv4_prev_addr);
    }
    if (if_loct->ipv6_prev_addr != NULL){
        lisp_addr_del(if_loct->ipv6_prev_addr);
    }
    free(if_loct);
}
コード例 #2
0
ファイル: fwd_policy.c プロジェクト: LISPmob/lispmob
void
policy_map_parm_del (fwd_policy_map_parm *pol_map)
{
    lisp_addr_del(pol_map->eid_prefix);
    shash_destroy(pol_map->paramiters);
    glist_destroy(pol_map->locators);
    free(pol_map);
}
コード例 #3
0
ファイル: test_group_list.c プロジェクト: zdenekc/SIVM
/**
 * Deallocate the group list and destroy the test data created for unit tests.
 */
static void test_teardown(void) {

	COLOR_TEARDOWN_START;
	glist_destroy();

	group_destroy(group_data[0]);
	group_destroy(group_data[1]);
	group_destroy(group_data[2]);
	group_destroy(group_data[3]);
	group_destroy(group_data[4]);

	if ( error_is_error() ) {
		ERROR_LOG();
	}
	COLOR_TEARDOWN_END;
	return ;
}
コード例 #4
0
ファイル: oor_config_confuse.c プロジェクト: muharif/oor2
int
configure_rtr(cfg_t *cfg)
{
    lisp_xtr_t *xtr;
    shash_t *lcaf_ht;
    mapping_t *mapping;
    map_local_entry_t *map_loc_e;
    void *fwd_map_inf;
    int n,i;

    /* CREATE AND CONFIGURE RTR (xTR in fact) */
    if (ctrl_dev_create(RTR_MODE, &ctrl_dev) != GOOD) {
        OOR_LOG(LCRIT, "Failed to create RTR. Aborting!");
        return (BAD);
    }

    lcaf_ht = parse_lcafs(cfg);

    xtr = CONTAINER_OF(ctrl_dev, lisp_xtr_t, super);
    if (configure_tunnel_router(cfg, xtr, lcaf_ht)!=GOOD){
        return (BAD);
    }

    /* INTERFACES CONFIG */
    n = cfg_size(cfg, "rtr-ifaces");
    if (n) {
        cfg_t *rifs = cfg_getsec(cfg, "rtr-ifaces");
        int nr = cfg_size(rifs, "rtr-iface");
        for(i = 0; i < nr; i++) {
            cfg_t *ri = cfg_getnsec(rifs, "rtr-iface", i);
            if (add_rtr_iface(xtr,
                    cfg_getstr(ri, "iface"),
                    cfg_getint(ri, "ip_version"),
                    cfg_getint(ri, "priority"),
                    cfg_getint(ri, "weight")) == GOOD) {
                OOR_LOG(LDBG_1, "Configured interface %s for RTR",
                        cfg_getstr(ri, "iface"));
            } else{
                OOR_LOG(LERR, "Can't configure iface %s for RTR",
                        cfg_getstr(ri, "iface"));
            }
        }
    }

    /* RTR DATABASE MAPPINGS (like for instance replication lists) */
    n = cfg_size(cfg, "rtr-database-mapping");
    for (i = 0; i < n; i++) {
        mapping = parse_mapping(cfg_getnsec(cfg, "rtr-database-mapping",i),&(xtr->super),lcaf_ht,TRUE);
        if (mapping == NULL){
            continue;
        }
        map_loc_e = map_local_entry_new_init(mapping);
        if (map_loc_e == NULL){
            mapping_del(mapping);
            continue;
        }

        fwd_map_inf = xtr->fwd_policy->new_map_loc_policy_inf(xtr->fwd_policy_dev_parm,mapping,NULL);
        if (fwd_map_inf == NULL){
            OOR_LOG(LERR, "Couldn't create forward information for rtr database mapping with EID: %s. Discarding it...",
                    lisp_addr_to_char(mapping_eid(mapping)));
            map_local_entry_del(map_loc_e);
            continue;
        }
        map_local_entry_set_fwd_info(map_loc_e, fwd_map_inf, xtr->fwd_policy->del_map_loc_policy_inf);

        if (add_local_db_map_local_entry(map_loc_e,xtr) != GOOD){
            map_local_entry_del(map_loc_e);
            continue;
        }


        if (add_local_db_map_local_entry(map_loc_e,xtr) != GOOD){
            map_local_entry_del(map_loc_e);
        }
    }

    /* Deallocate PiTRs and PeTRs elements */
    glist_destroy(xtr->pitrs);
    xtr->pitrs = NULL;

    shash_destroy(lcaf_ht);

    return(GOOD);
}