Lines Matching refs:host

105 			struct nat64lsn_host	*host;
139 static void nat64lsn_destroy_host(struct nat64lsn_host *host);
204 struct nat64lsn_host *host, const struct ipfw_flow_id *f_id __unused)
212 return (CK_SLIST_FIRST(&host->aliases));
309 nat64lsn_get_state6to4(struct nat64lsn_cfg *cfg, struct nat64lsn_host *host,
321 CK_SLIST_FOREACH(state, &STATE_HASH(host, hval), entries) {
327 link = nat64lsn_get_aliaslink(cfg, host, f_id);
383 state->host = host;
386 /* Insert new state into host's hash table */
387 HOST_LOCK(host);
388 CK_SLIST_INSERT_HEAD(&STATE_HASH(host, hval),
390 host->states_count++;
392 * XXX: In case if host is going to be expired,
395 host->flags &= ~NAT64LSN_DEADHOST;
396 HOST_UNLOCK(host);
691 ret = nat64_do_handle_ip4(*mp, &src6, &state->host->addr, port,
747 struct nat64lsn_host *host;
764 * 1. Mark as STALE and unlink from host's hash.
780 host = state->host;
781 HOST_LOCK(host);
782 CK_SLIST_REMOVE(&STATE_HASH(host, state->hval),
784 host->states_count--;
785 HOST_UNLOCK(host);
877 struct nat64lsn_host *host, *tmp;
881 CK_SLIST_FOREACH_SAFE(host, &cfg->hosts_hash[i],
883 /* Is host was marked in previous call? */
884 if (host->flags & NAT64LSN_DEADHOST) {
885 if (host->states_count > 0) {
886 host->flags &= ~NAT64LSN_DEADHOST;
890 * Unlink host from hash table and schedule
894 CK_SLIST_REMOVE(&cfg->hosts_hash[i], host,
898 CK_SLIST_INSERT_HEAD(hosts, host, entries);
901 if (GET_AGE(host->timestamp) < cfg->host_delete_delay)
903 if (host->states_count > 0)
905 /* Mark host as going to be expired in next pass */
906 host->flags |= NAT64LSN_DEADHOST;
1006 struct nat64lsn_host *host;
1011 /* Check that host was not yet added. */
1013 CK_SLIST_FOREACH(host, &HOSTS(cfg, ji->src6_hval), entries) {
1014 if (IN6_ARE_ADDR_EQUAL(&ji->f_id.src_ip6, &host->addr)) {
1015 /* The host was allocated in previous call. */
1016 ji->host = host;
1021 host = ji->host = uma_zalloc(nat64lsn_host_zone, M_NOWAIT);
1022 if (ji->host == NULL)
1025 host->states_hashsize = NAT64LSN_HSIZE;
1026 host->states_hash = malloc(sizeof(struct nat64lsn_states_slist) *
1027 host->states_hashsize, M_NAT64LSN, M_NOWAIT);
1028 if (host->states_hash == NULL) {
1029 uma_zfree(nat64lsn_host_zone, host);
1035 free(host->states_hash, M_NAT64LSN);
1036 uma_zfree(nat64lsn_host_zone, host);
1041 HOST_LOCK_INIT(host);
1042 SET_AGE(host->timestamp);
1043 host->addr = ji->f_id.src_ip6;
1044 host->hval = ji->src6_hval;
1045 host->flags = 0;
1046 host->states_count = 0;
1047 host->states_hashsize = NAT64LSN_HSIZE;
1048 CK_SLIST_INIT(&host->aliases);
1049 for (i = 0; i < host->states_hashsize; i++)
1050 CK_SLIST_INIT(&host->states_hash[i]);
1055 CK_SLIST_INSERT_HEAD(&host->aliases, link, host_entries);
1063 CK_SLIST_INSERT_HEAD(&HOSTS(cfg, ji->src6_hval), host, entries);
1071 state = nat64lsn_get_state6to4(cfg, host, &ji->f_id, hval,
1087 inet_ntop(AF_INET6, &host->addr, a, sizeof(a)), host);
1197 link = nat64lsn_get_aliaslink(cfg, ji->host, &ji->f_id);
1238 ji->state = nat64lsn_get_state6to4(cfg, ji->host, &ji->f_id,
1369 struct nat64lsn_host *host;
1376 host = CK_SLIST_FIRST(&ji->hosts);
1378 if (host->states_count > 0) {
1381 * during host deletion.
1383 printf("NAT64LSN: %s: destroying host with %d "
1384 "states\n", __func__, host->states_count);
1386 nat64lsn_destroy_host(host);
1432 nat64lsn_request_pg(struct nat64lsn_cfg *cfg, struct nat64lsn_host *host,
1446 ji->host = host;
1490 struct nat64lsn_host *host;
1540 /* Try to find host */
1542 CK_SLIST_FOREACH(host, &HOSTS(cfg, hval), entries) {
1543 if (IN6_ARE_ADDR_EQUAL(&f_id->src_ip6, &host->addr))
1546 /* We use IPv4 address in host byte order */
1548 if (host == NULL)
1557 state = nat64lsn_get_state6to4(cfg, host, f_id, hval, addr,
1560 return (nat64lsn_request_pg(cfg, host, f_id, mp, hval, addr,
1707 alias->addr = prefix + i; /* host byte order */
1758 nat64lsn_destroy_host(struct nat64lsn_host *host)
1762 while (!CK_SLIST_EMPTY(&host->aliases)) {
1763 link = CK_SLIST_FIRST(&host->aliases);
1764 CK_SLIST_REMOVE_HEAD(&host->aliases, host_entries);
1774 HOST_LOCK_DESTROY(host);
1775 free(host->states_hash, M_NAT64LSN);
1776 uma_zfree(nat64lsn_host_zone, host);
1782 struct nat64lsn_host *host;
1792 host = CK_SLIST_FIRST(&cfg->hosts_hash[i]);
1794 nat64lsn_destroy_host(host);