2012-01-30 06:56:54 -08:00
|
|
|
#include <linux/if_vlan.h>
|
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
|
#include <net/net_namespace.h>
|
|
|
|
|
#include <net/netns/generic.h>
|
|
|
|
|
|
2013-07-01 14:36:51 -07:00
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
|
2012-01-30 06:56:54 -08:00
|
|
|
|
2015-04-20 18:19:53 -07:00
|
|
|
int ovs_compat_init_net(struct net *net, struct rpl_pernet_operations *pnet)
|
2012-01-30 06:56:54 -08:00
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
void *ovs_net = kzalloc(pnet->size, GFP_KERNEL);
|
|
|
|
|
|
|
|
|
|
if (!ovs_net)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
err = net_assign_generic(net, *pnet->id, ovs_net);
|
|
|
|
|
if (err)
|
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
|
|
if (pnet->init) {
|
|
|
|
|
err = pnet->init(net);
|
|
|
|
|
if (err)
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
err:
|
|
|
|
|
kfree(ovs_net);
|
|
|
|
|
return err;
|
|
|
|
|
}
|
2015-04-20 18:19:53 -07:00
|
|
|
EXPORT_SYMBOL_GPL(ovs_compat_init_net);
|
2012-01-30 06:56:54 -08:00
|
|
|
|
2015-04-20 18:19:53 -07:00
|
|
|
void ovs_compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet)
|
2012-01-30 06:56:54 -08:00
|
|
|
{
|
|
|
|
|
void *ovs_net = net_generic(net, *pnet->id);
|
|
|
|
|
|
|
|
|
|
if (pnet->exit)
|
|
|
|
|
pnet->exit(net);
|
|
|
|
|
kfree(ovs_net);
|
|
|
|
|
}
|
2015-04-20 18:19:53 -07:00
|
|
|
EXPORT_SYMBOL_GPL(ovs_compat_exit_net);
|
|
|
|
|
|
2012-01-30 06:56:54 -08:00
|
|
|
#endif
|