/** * fab_host_create - * * Allocate and initialize a host struct */ static fab_host_t * fab_host_create(uint64_t dpid, uint32_t sw_alias, struct flow *fl) { fab_host_t *host; host = fab_zalloc(sizeof(fab_host_t)); c_rw_lock_init(&host->lock); host->sw.swid = dpid; host->sw.alias = sw_alias; host->sw.port = ntohs(fl->in_port); FAB_MK_TEN_NET_ID(host->hkey.tn_id, fab_extract_tenant_id(fl), fab_extract_network_id(fl)); host->hkey.host_ip = ntohl(fl->nw_src); memcpy(host->hkey.host_mac, fl->dl_src, 6); host->dfl_gw = fl->FL_DFL_GW; return host; }
/** * @name fab_host_create * @brief Allocate and initialize a host struct */ static fab_host_t * fab_host_create(uint64_t dpid, uint32_t sw_alias, struct flow *fl, uint8_t *tenant_id, uint8_t *network_id) { fab_host_t *host; host = fab_zalloc(sizeof(fab_host_t)); c_rw_lock_init(&host->lock); host->sw.swid = dpid; host->sw.alias = sw_alias; host->sw.port = ntohl(fl->in_port); FAB_MK_TEN_NET_ID(host->hkey.tn_id, fab_tenant_nw_uuid_hash_func(tenant_id), fab_tenant_nw_uuid_hash_func(network_id)); host->hkey.host_ip = ntohl(fl->ip.nw_src); memcpy(host->hkey.host_mac, fl->dl_src, 6); memcpy(host->tenant_id, tenant_id, sizeof(uuid_t)); memcpy(host->network_id, network_id, sizeof(uuid_t)); host->dfl_gw = fl->FL_DFL_GW; return host; }