Exemplo n.º 1
0
int __net_init fib4_rules_init(struct net *net)
{
	int err;
	struct fib_rules_ops *ops;

#ifdef FIB_RULE_DEBUG
	printk(KERN_DEBUG "[NET][IPV4][RULE] %s \n", __func__);
#endif 

	ops = fib_rules_register(&fib4_rules_ops_template, net);
	if (IS_ERR(ops))
		return PTR_ERR(ops);

	err = fib_default_rules_init(ops);
	if (err < 0)
		goto fail;
	net->ipv4.rules_ops = ops;
	return 0;

fail:

#ifdef FIB_RULE_DEBUG
	printk(KERN_DEBUG "[NET][IPV4][RULE] %s : fib_rules_unregister\n", __func__);
#endif 
	/* also cleans all rules already added */
	fib_rules_unregister(ops);
	return err;
}
Exemplo n.º 2
0
int __net_init fib4_rules_init(struct net *net)
{
	int err;
	struct fib_rules_ops *ops;

	ops = fib_rules_register(&fib4_rules_ops_template, net);
	if (IS_ERR(ops))
		return PTR_ERR(ops);

	err = fib_default_rules_init(ops);
	if (err < 0)
		goto fail;
	net->ipv4.rules_ops = ops;
	return 0;

fail:
	/* also cleans all rules already added */
	fib_rules_unregister(ops);
	return err;
}