static struct ospf6_area * ospf6_area_get (u_int32_t area_id, struct ospf6 *o) { struct ospf6_area *oa; oa = ospf6_area_lookup (area_id, o); if (oa == NULL) oa = ospf6_area_create (area_id, o); return oa; }
void sibling_ctrl_add_ctrl_client(unsigned int hostnum, char * ifname, char * area) { struct ctrl_client * ctrl_client; struct interface * ifp; struct ospf6_interface * oi; struct ospf6_area * oa; u_int32_t area_id; ctrl_client = ctrl_client_new(); ctrl_client->hostnum = hostnum; ctrl_client->inter_con = NULL; list_push_back(&ctrl_clients, &ctrl_client->node); /* find/create ospf6 interface */ ifp = if_get_by_name(ctrl_client->if_list, ifname); oi = (struct ospf6_interface *) ifp->info; if(oi == NULL) { oi = ospf6_interface_create(ifp); } /* parse Area-ID */ if (inet_pton (AF_INET, area, &area_id) != 1) { printf("Invalid Area-ID: %s\n", area); } /* find/create ospf6 area */ oa = ospf6_area_lookup (area_id, ospf6); if(oa == NULL) oa = ospf6_area_create(area_id, ospf6); /* attach interface to area */ list_push_back(&oa->if_list, &oi->node); oi->area = oa; /* start up */ thread_add_event(master, interface_up, oi, 0); }