diff options
Diffstat (limited to 'net/batman-adv/soft-interface.c')
| -rw-r--r-- | net/batman-adv/soft-interface.c | 72 |
1 files changed, 51 insertions, 21 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 5ec31d7de24f..c002961da75d 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2007-2014 B.A.T.M.A.N. contributors: | 1 | /* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: |
| 2 | * | 2 | * |
| 3 | * Marek Lindner, Simon Wunderlich | 3 | * Marek Lindner, Simon Wunderlich |
| 4 | * | 4 | * |
| @@ -15,26 +15,50 @@ | |||
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "main.h" | ||
| 19 | #include "soft-interface.h" | 18 | #include "soft-interface.h" |
| 20 | #include "hard-interface.h" | 19 | #include "main.h" |
| 21 | #include "distributed-arp-table.h" | 20 | |
| 22 | #include "routing.h" | 21 | #include <linux/atomic.h> |
| 23 | #include "send.h" | 22 | #include <linux/byteorder/generic.h> |
| 24 | #include "debugfs.h" | 23 | #include <linux/cache.h> |
| 25 | #include "translation-table.h" | 24 | #include <linux/compiler.h> |
| 26 | #include "hash.h" | 25 | #include <linux/errno.h> |
| 27 | #include "gateway_common.h" | ||
| 28 | #include "gateway_client.h" | ||
| 29 | #include "sysfs.h" | ||
| 30 | #include "originator.h" | ||
| 31 | #include <linux/slab.h> | ||
| 32 | #include <linux/ethtool.h> | ||
| 33 | #include <linux/etherdevice.h> | 26 | #include <linux/etherdevice.h> |
| 27 | #include <linux/ethtool.h> | ||
| 28 | #include <linux/fs.h> | ||
| 29 | #include <linux/if_ether.h> | ||
| 34 | #include <linux/if_vlan.h> | 30 | #include <linux/if_vlan.h> |
| 35 | #include "multicast.h" | 31 | #include <linux/jiffies.h> |
| 32 | #include <linux/kernel.h> | ||
| 33 | #include <linux/list.h> | ||
| 34 | #include <linux/lockdep.h> | ||
| 35 | #include <linux/netdevice.h> | ||
| 36 | #include <linux/percpu.h> | ||
| 37 | #include <linux/printk.h> | ||
| 38 | #include <linux/random.h> | ||
| 39 | #include <linux/rculist.h> | ||
| 40 | #include <linux/rcupdate.h> | ||
| 41 | #include <linux/skbuff.h> | ||
| 42 | #include <linux/slab.h> | ||
| 43 | #include <linux/socket.h> | ||
| 44 | #include <linux/spinlock.h> | ||
| 45 | #include <linux/stddef.h> | ||
| 46 | #include <linux/string.h> | ||
| 47 | #include <linux/types.h> | ||
| 48 | #include <linux/workqueue.h> | ||
| 49 | |||
| 36 | #include "bridge_loop_avoidance.h" | 50 | #include "bridge_loop_avoidance.h" |
| 51 | #include "debugfs.h" | ||
| 52 | #include "distributed-arp-table.h" | ||
| 53 | #include "gateway_client.h" | ||
| 54 | #include "gateway_common.h" | ||
| 55 | #include "hard-interface.h" | ||
| 56 | #include "multicast.h" | ||
| 37 | #include "network-coding.h" | 57 | #include "network-coding.h" |
| 58 | #include "packet.h" | ||
| 59 | #include "send.h" | ||
| 60 | #include "sysfs.h" | ||
| 61 | #include "translation-table.h" | ||
| 38 | 62 | ||
| 39 | static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); | 63 | static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); |
| 40 | static void batadv_get_drvinfo(struct net_device *dev, | 64 | static void batadv_get_drvinfo(struct net_device *dev, |
| @@ -105,6 +129,7 @@ static struct net_device_stats *batadv_interface_stats(struct net_device *dev) | |||
| 105 | static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) | 129 | static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) |
| 106 | { | 130 | { |
| 107 | struct batadv_priv *bat_priv = netdev_priv(dev); | 131 | struct batadv_priv *bat_priv = netdev_priv(dev); |
| 132 | struct batadv_softif_vlan *vlan; | ||
| 108 | struct sockaddr *addr = p; | 133 | struct sockaddr *addr = p; |
| 109 | uint8_t old_addr[ETH_ALEN]; | 134 | uint8_t old_addr[ETH_ALEN]; |
| 110 | 135 | ||
| @@ -115,12 +140,17 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) | |||
| 115 | ether_addr_copy(dev->dev_addr, addr->sa_data); | 140 | ether_addr_copy(dev->dev_addr, addr->sa_data); |
| 116 | 141 | ||
| 117 | /* only modify transtable if it has been initialized before */ | 142 | /* only modify transtable if it has been initialized before */ |
| 118 | if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) { | 143 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) |
| 119 | batadv_tt_local_remove(bat_priv, old_addr, BATADV_NO_FLAGS, | 144 | return 0; |
| 145 | |||
| 146 | rcu_read_lock(); | ||
| 147 | hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { | ||
| 148 | batadv_tt_local_remove(bat_priv, old_addr, vlan->vid, | ||
| 120 | "mac address changed", false); | 149 | "mac address changed", false); |
| 121 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NO_FLAGS, | 150 | batadv_tt_local_add(dev, addr->sa_data, vlan->vid, |
| 122 | BATADV_NULL_IFINDEX, BATADV_NO_MARK); | 151 | BATADV_NULL_IFINDEX, BATADV_NO_MARK); |
| 123 | } | 152 | } |
| 153 | rcu_read_unlock(); | ||
| 124 | 154 | ||
| 125 | return 0; | 155 | return 0; |
| 126 | } | 156 | } |
| @@ -732,7 +762,7 @@ static int batadv_softif_init_late(struct net_device *dev) | |||
| 732 | atomic_set(&bat_priv->aggregated_ogms, 1); | 762 | atomic_set(&bat_priv->aggregated_ogms, 1); |
| 733 | atomic_set(&bat_priv->bonding, 0); | 763 | atomic_set(&bat_priv->bonding, 0); |
| 734 | #ifdef CONFIG_BATMAN_ADV_BLA | 764 | #ifdef CONFIG_BATMAN_ADV_BLA |
| 735 | atomic_set(&bat_priv->bridge_loop_avoidance, 0); | 765 | atomic_set(&bat_priv->bridge_loop_avoidance, 1); |
| 736 | #endif | 766 | #endif |
| 737 | #ifdef CONFIG_BATMAN_ADV_DAT | 767 | #ifdef CONFIG_BATMAN_ADV_DAT |
| 738 | atomic_set(&bat_priv->distributed_arp_table, 1); | 768 | atomic_set(&bat_priv->distributed_arp_table, 1); |
| @@ -818,7 +848,7 @@ static int batadv_softif_slave_add(struct net_device *dev, | |||
| 818 | int ret = -EINVAL; | 848 | int ret = -EINVAL; |
| 819 | 849 | ||
| 820 | hard_iface = batadv_hardif_get_by_netdev(slave_dev); | 850 | hard_iface = batadv_hardif_get_by_netdev(slave_dev); |
| 821 | if (!hard_iface || hard_iface->soft_iface != NULL) | 851 | if (!hard_iface || hard_iface->soft_iface) |
| 822 | goto out; | 852 | goto out; |
| 823 | 853 | ||
| 824 | ret = batadv_hardif_enable_interface(hard_iface, dev->name); | 854 | ret = batadv_hardif_enable_interface(hard_iface, dev->name); |
