Ejemplo n.º 1
0
static int add_instance(void)
{
	struct xlator jool;
	int error;

	if (no_instance)
		return 0;

	error = xlator_add(&jool);
	if (error)
		return error;

	jool.global->cfg.enabled = !disabled;
	error = pool6_add_str(jool.pool6, &pool6, pool6 ? 1 : 0);
	if (error)
		goto end;
	error = pool_add_str(jool.siit.blacklist, blacklist, blacklist_size);
	if (error)
		goto end;
	error = pool_add_str(jool.siit.pool6791, pool6791, pool6791_size);
	/* Fall through. */

end:
	xlator_put(&jool);
	return error;
}
Ejemplo n.º 2
0
static int init(void)
{
	struct config_prefix6 pool6;
	struct pool4_entry_usr entry;
	int error;

	pool6.set = true;
	pool6.prefix.len = 96;
	error = str_to_addr6("3::", &pool6.prefix.addr);
	if (error)
		return error;

	error = xlator_add(FW_NETFILTER, INAME_DEFAULT, &pool6, &jool);
	if (error)
		return error;

	entry.mark = 0;
	entry.iterations = 0;
	entry.flags = ITERATIONS_SET | ITERATIONS_INFINITE;
	error = str_to_addr4("192.0.2.128", &entry.range.prefix.addr);
	if (error)
		goto fail;
	entry.range.prefix.len = 32;
	entry.range.ports.min = 1024;
	entry.range.ports.max = 1024;

	entry.proto = L4PROTO_TCP;
	error = pool4db_add(jool.nat64.pool4, &entry);
	if (error)
		goto fail;
	entry.proto = L4PROTO_UDP;
	error = pool4db_add(jool.nat64.pool4, &entry);
	if (error)
		goto fail;
	entry.proto = L4PROTO_ICMP;
	error = pool4db_add(jool.nat64.pool4, &entry);
	if (error)
		goto fail;

	return 0;

fail:
	xlator_put(&jool);
	xlator_rm(INAME_DEFAULT);
	return error;
}