Bug #179 » 0002-batman-adv-Restrict-movement-of-batman-interfaces-be.patch
net/batman-adv/hard-interface.c | ||
---|---|---|
static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
|
||
{
|
||
struct net_device *parent_dev;
|
||
struct net *net = dev_net(net_dev);
|
||
bool ret;
|
||
/* check if this is a batman-adv mesh interface */
|
||
... | ... | |
return false;
|
||
/* recurse over the parent device */
|
||
parent_dev = __dev_get_by_index(&init_net, dev_get_iflink(net_dev));
|
||
parent_dev = __dev_get_by_index(net, dev_get_iflink(net_dev));
|
||
/* if we got a NULL parent_dev there is something broken.. */
|
||
if (WARN(!parent_dev, "Cannot find parent device"))
|
||
return false;
|
||
... | ... | |
}
|
||
int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
|
||
const char *iface_name)
|
||
struct net *net, const char *iface_name)
|
||
{
|
||
struct batadv_priv *bat_priv;
|
||
struct net_device *soft_iface, *master;
|
||
... | ... | |
if (!atomic_inc_not_zero(&hard_iface->refcount))
|
||
goto out;
|
||
soft_iface = dev_get_by_name(&init_net, iface_name);
|
||
soft_iface = dev_get_by_name(net, iface_name);
|
||
if (!soft_iface) {
|
||
soft_iface = batadv_softif_create(iface_name);
|
||
soft_iface = batadv_softif_create(net, iface_name);
|
||
if (!soft_iface) {
|
||
ret = -ENOMEM;
|
net/batman-adv/hard-interface.h | ||
---|---|---|
struct batadv_hard_iface*
|
||
batadv_hardif_get_by_netdev(const struct net_device *net_dev);
|
||
int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
|
||
const char *iface_name);
|
||
struct net *net, const char *iface_name);
|
||
void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
|
||
enum batadv_hard_if_cleanup autodel);
|
||
void batadv_hardif_remove_interfaces(void);
|
net/batman-adv/soft-interface.c | ||
---|---|---|
#include <linux/string.h>
|
||
#include <linux/types.h>
|
||
#include <linux/workqueue.h>
|
||
#include <net/net_namespace.h>
|
||
#include "bridge_loop_avoidance.h"
|
||
#include "debugfs.h"
|
||
... | ... | |
struct net_device *slave_dev)
|
||
{
|
||
struct batadv_hard_iface *hard_iface;
|
||
struct net *net = dev_net(dev);
|
||
int ret = -EINVAL;
|
||
hard_iface = batadv_hardif_get_by_netdev(slave_dev);
|
||
if (!hard_iface || hard_iface->soft_iface)
|
||
goto out;
|
||
ret = batadv_hardif_enable_interface(hard_iface, dev->name);
|
||
ret = batadv_hardif_enable_interface(hard_iface, net, dev->name);
|
||
out:
|
||
if (hard_iface)
|
||
... | ... | |
memset(priv, 0, sizeof(*priv));
|
||
}
|
||
struct net_device *batadv_softif_create(const char *name)
|
||
struct net_device *batadv_softif_create(struct net *net, const char *name)
|
||
{
|
||
struct net_device *soft_iface;
|
||
int ret;
|
||
... | ... | |
if (!soft_iface)
|
||
return NULL;
|
||
dev_net_set(soft_iface, net);
|
||
soft_iface->rtnl_link_ops = &batadv_link_ops;
|
||
ret = register_netdevice(soft_iface);
|
net/batman-adv/soft-interface.h | ||
---|---|---|
void batadv_interface_rx(struct net_device *soft_iface,
|
||
struct sk_buff *skb, struct batadv_hard_iface *recv_if,
|
||
int hdr_size, struct batadv_orig_node *orig_node);
|
||
struct net_device *batadv_softif_create(const char *name);
|
||
struct net_device *batadv_softif_create(struct net *net, const char *name);
|
||
void batadv_softif_destroy_sysfs(struct net_device *soft_iface);
|
||
int batadv_softif_is_valid(const struct net_device *net_dev);
|
||
extern struct rtnl_link_ops batadv_link_ops;
|
net/batman-adv/sysfs.c | ||
---|---|---|
#include <linux/stddef.h>
|
||
#include <linux/string.h>
|
||
#include <linux/stringify.h>
|
||
#include <net/net_namespace.h>
|
||
#include "distributed-arp-table.h"
|
||
#include "gateway_client.h"
|
||
... | ... | |
size_t count)
|
||
{
|
||
struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
|
||
struct net *net = dev_net(net_dev);
|
||
struct batadv_hard_iface *hard_iface;
|
||
int status_tmp = -1;
|
||
int ret = count;
|
||
... | ... | |
batadv_hardif_disable_interface(hard_iface,
|
||
BATADV_IF_CLEANUP_AUTO);
|
||
ret = batadv_hardif_enable_interface(hard_iface, buff);
|
||
ret = batadv_hardif_enable_interface(hard_iface, net, buff);
|
||
unlock:
|
||
rtnl_unlock();
|
net/batman-adv/translation-table.c | ||
---|---|---|
struct batadv_tt_global_entry *tt_global = NULL;
|
||
struct batadv_softif_vlan *vlan;
|
||
struct net_device *in_dev = NULL;
|
||
struct net *net = dev_net(soft_iface);
|
||
struct hlist_head *head;
|
||
struct batadv_tt_orig_list_entry *orig_entry;
|
||
int hash_added, table_size, packet_size_max;
|
||
... | ... | |
uint32_t match_mark;
|
||
if (ifindex != BATADV_NULL_IFINDEX)
|
||
in_dev = dev_get_by_index(&init_net, ifindex);
|
||
in_dev = dev_get_by_index(net, ifindex);
|
||
tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid);
|
||
- « Previous
- 1
- 2
- 3
- 4
- Next »