/* *=========================================================================== * ipcom_sysvar_tree *=========================================================================== * Description: * Parameters: * Returns: */ IP_STATIC void ipcom_sysvar_tree_done(Ipcom_sysvar_tree *tree) { if (tree == IP_NULL) return; /* If we're killing the last reference, to deal finalization */ if (tree->referenced == 1) { /* Did it kill the tree? */ if (ipcom_sysvar_tree_finalize(tree)) { ipcom_hash_for_each(tree->sysvars, (Ipcom_hash_foreach_cb_func)ipcom_sysvar_free, tree); ipcom_hash_delete(tree->sysvars); tree->sysvars = IP_NULL; } } /* Decrease AFTER, since finalize may invoke sysvar calls as well */ tree->referenced--; }
/* *=========================================================================== * ipnet_vrrp_del_addr *=========================================================================== * Description: Deletes a virtual router address. * Parameters: netif - The network interface the VRIP was assigned to. * vrid - The VRID the address was assigned to. * Returns: 0 = success, <0 = error code. * */ IP_GLOBAL int ipnet_vrrp_del_addr(Ipnet_netif *netif, Ip_u8 vrid, struct Ip_in_addr addr) { Ipnet_vrrp_addr_t *addr_entry; int i; ip_assert(ipnet->vrrp_addrs != IP_NULL); addr_entry = ipnet_vrrp_get_addr_entry(netif, vrid); if (addr_entry == IP_NULL) return -IP_ERRNO_ESRCH; i = ipnet_vrrp_addr_index(addr_entry, addr); if (i < 0) return -IP_ERRNO_ESRCH; IPCOM_LOG2(INFO, "VRRP: deleted address %s on %s", ipcom_inet_ntop(IP_AF_INET, &addr, ipnet->log_buf, sizeof(ipnet->log_buf)), netif->ipcom.name); if (--addr_entry->num_addrs > 0) { for (;i < addr_entry->num_addrs; i++) addr_entry->addrs[i] = addr_entry->addrs[i + 1]; } else { (void)ipcom_hash_remove(ipnet->vrrp_addrs, addr_entry); ipcom_free(addr_entry); if (ipnet->vrrp_addrs->elem == 0) { ipcom_hash_delete(ipnet->vrrp_addrs); ipnet->vrrp_addrs = IP_NULL; } } return 0; }