diff options
Diffstat (limited to 'net/batman-adv/hard-interface.c')
| -rw-r--r-- | net/batman-adv/hard-interface.c | 56 | 
1 files changed, 32 insertions, 24 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 7704df468e0..409d0273c9d 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -1,5 +1,5 @@  /* - * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:   *   * Marek Lindner, Simon Wunderlich   * @@ -28,7 +28,6 @@  #include "bat_sysfs.h"  #include "originator.h"  #include "hash.h" -#include "bat_ogm.h"  #include <linux/if_arp.h> @@ -147,7 +146,7 @@ static void primary_if_select(struct bat_priv *bat_priv,  	if (!new_hard_iface)  		return; -	bat_ogm_init_primary(new_hard_iface); +	bat_priv->bat_algo_ops->bat_ogm_init_primary(new_hard_iface);  	primary_if_update_addr(bat_priv);  } @@ -233,7 +232,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)  	bat_priv = netdev_priv(hard_iface->soft_iface); -	bat_ogm_update_mac(hard_iface); +	bat_priv->bat_algo_ops->bat_ogm_update_mac(hard_iface);  	hard_iface->if_status = IF_TO_BE_ACTIVATED;  	/** @@ -281,6 +280,14 @@ int hardif_enable_interface(struct hard_iface *hard_iface,  	if (!atomic_inc_not_zero(&hard_iface->refcount))  		goto out; +	/* hard-interface is part of a bridge */ +	if (hard_iface->net_dev->priv_flags & IFF_BRIDGE_PORT) +		pr_err("You are about to enable batman-adv on '%s' which " +		       "already is part of a bridge. Unless you know exactly " +		       "what you are doing this is probably wrong and won't " +		       "work the way you think it would.\n", +		       hard_iface->net_dev->name); +  	soft_iface = dev_get_by_name(&init_net, iface_name);  	if (!soft_iface) { @@ -307,7 +314,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface,  	hard_iface->soft_iface = soft_iface;  	bat_priv = netdev_priv(hard_iface->soft_iface); -	bat_ogm_init(hard_iface); +	bat_priv->bat_algo_ops->bat_ogm_init(hard_iface);  	if (!hard_iface->packet_buff) {  		bat_err(hard_iface->soft_iface, "Can't add interface packet " @@ -334,23 +341,23 @@ int hardif_enable_interface(struct hard_iface *hard_iface,  	if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <  		ETH_DATA_LEN + BAT_HEADER_LEN)  		bat_info(hard_iface->soft_iface, -			"The MTU of interface %s is too small (%i) to handle " -			"the transport of batman-adv packets. Packets going " -			"over this interface will be fragmented on layer2 " -			"which could impact the performance. Setting the MTU " -			"to %zi would solve the problem.\n", -			hard_iface->net_dev->name, hard_iface->net_dev->mtu, -			ETH_DATA_LEN + BAT_HEADER_LEN); +			 "The MTU of interface %s is too small (%i) to handle " +			 "the transport of batman-adv packets. Packets going " +			 "over this interface will be fragmented on layer2 " +			 "which could impact the performance. Setting the MTU " +			 "to %zi would solve the problem.\n", +			 hard_iface->net_dev->name, hard_iface->net_dev->mtu, +			 ETH_DATA_LEN + BAT_HEADER_LEN);  	if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <  		ETH_DATA_LEN + BAT_HEADER_LEN)  		bat_info(hard_iface->soft_iface, -			"The MTU of interface %s is too small (%i) to handle " -			"the transport of batman-adv packets. If you experience" -			" problems getting traffic through try increasing the " -			"MTU to %zi.\n", -			hard_iface->net_dev->name, hard_iface->net_dev->mtu, -			ETH_DATA_LEN + BAT_HEADER_LEN); +			 "The MTU of interface %s is too small (%i) to handle " +			 "the transport of batman-adv packets. If you " +			 "experience problems getting traffic through try " +			 "increasing the MTU to %zi.\n", +			 hard_iface->net_dev->name, hard_iface->net_dev->mtu, +			 ETH_DATA_LEN + BAT_HEADER_LEN);  	if (hardif_is_iface_up(hard_iface))  		hardif_activate_interface(hard_iface); @@ -527,9 +534,10 @@ static int hard_if_event(struct notifier_block *this,  			goto hardif_put;  		check_known_mac_addr(hard_iface->net_dev); -		bat_ogm_update_mac(hard_iface);  		bat_priv = netdev_priv(hard_iface->soft_iface); +		bat_priv->bat_algo_ops->bat_ogm_update_mac(hard_iface); +  		primary_if = primary_if_get_selected(bat_priv);  		if (!primary_if)  			goto hardif_put; @@ -572,8 +580,8 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,  		goto err_free;  	/* expect a valid ethernet header here. */ -	if (unlikely(skb->mac_len != sizeof(struct ethhdr) -				|| !skb_mac_header(skb))) +	if (unlikely(skb->mac_len != sizeof(struct ethhdr) || +		     !skb_mac_header(skb)))  		goto err_free;  	if (!hard_iface->soft_iface) @@ -590,17 +598,17 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,  	batman_ogm_packet = (struct batman_ogm_packet *)skb->data; -	if (batman_ogm_packet->version != COMPAT_VERSION) { +	if (batman_ogm_packet->header.version != COMPAT_VERSION) {  		bat_dbg(DBG_BATMAN, bat_priv,  			"Drop packet: incompatible batman version (%i)\n", -			batman_ogm_packet->version); +			batman_ogm_packet->header.version);  		goto err_free;  	}  	/* all receive handlers return whether they received or reused  	 * the supplied skb. if not, we have to free the skb. */ -	switch (batman_ogm_packet->packet_type) { +	switch (batman_ogm_packet->header.packet_type) {  		/* batman originator packet */  	case BAT_OGM:  		ret = recv_bat_ogm_packet(skb, hard_iface);  |