Exemplo n.º 1
0
static bool test_flush(void)
{
	bool success = true;

	/*
	 * It doesn't look like there are corner cases here.
	 * Not even empty pool4, since that's pretty much all RB tree logic.
	 * (Which is tested elsewhere.)
	 */

	if (!add_common_samples())
		return false;

	pool4db_flush(pool);
	success &= __foreach(NULL, 0, 0);
	return success;
}
Exemplo n.º 2
0
Arquivo: pool4.c Projeto: NICMx/Jool
static int handle_pool4_flush(struct xlator *jool, struct genl_info *info,
		union request_pool4 *request)
{
	log_debug("Flushing pool4.");

	pool4db_flush(jool->nat64.pool4);
	if (xlat_is_nat64() && !request->flush.quick) {
		/*
		 * This will also clear *previously* orphaned entries, but given
		 * that "not quick" generally means "please clean up", this is
		 * more likely what people wants.
		 */
		bib_flush(jool);
	}

	return nlcore_respond(info, 0);
}
Exemplo n.º 3
0
static int handle_pool4_flush(struct nlmsghdr *nl_hdr, union request_pool4 *request)
{
	int error;

	if (verify_superpriv())
		return respond_error(nl_hdr, -EPERM);

	log_debug("Flushing the IPv4 pool...");
	error = pool4db_flush();

	/*
	 * Well, pool4db_flush only errors on memory allocation failures,
	 * so I guess clearing BIB and session even if pool4db_flush fails
	 * is a good idea.
	 */
	if (xlat_is_nat64() && !request->flush.quick) {
		sessiondb_flush();
		bibdb_flush();
	}

	return respond_error(nl_hdr, error);
}