The following commit has been merged in the master branch: commit dcfd9cdc1222f14d6180514e533289493a0716fb Merge: 5615787257742aab42ecf17c11e3244d9536a48d 32ae9b221e788413ce68feaae2ca39e406211a0a Author: David S. Miller davem@davemloft.net Date: Mon May 2 15:04:46 2011 -0700
Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-merge
diff --combined net/batman-adv/soft-interface.c index eeabbb8,ea5e58c..9e5fcd1 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@@ -43,6 -43,8 +43,6 @@@ static void bat_get_drvinfo(struct net_ static u32 bat_get_msglevel(struct net_device *dev); static void bat_set_msglevel(struct net_device *dev, u32 value); static u32 bat_get_link(struct net_device *dev); -static u32 bat_get_rx_csum(struct net_device *dev); -static int bat_set_rx_csum(struct net_device *dev, u32 data);
static const struct ethtool_ops bat_ethtool_ops = { .get_settings = bat_get_settings, @@@ -50,6 -52,8 +50,6 @@@ .get_msglevel = bat_get_msglevel, .set_msglevel = bat_set_msglevel, .get_link = bat_get_link, - .get_rx_csum = bat_get_rx_csum, - .set_rx_csum = bat_set_rx_csum };
int my_skb_head_push(struct sk_buff *skb, unsigned int len) @@@ -211,13 -215,24 +211,24 @@@ int softif_neigh_seq_print_text(struct struct net_device *net_dev = (struct net_device *)seq->private; struct bat_priv *bat_priv = netdev_priv(net_dev); struct softif_neigh *softif_neigh; + struct hard_iface *primary_if; struct hlist_node *node; struct softif_neigh *curr_softif_neigh; + int ret = 0;
- if (!bat_priv->primary_if) { - return seq_printf(seq, "BATMAN mesh %s disabled - " - "please specify interfaces to enable it\n", - net_dev->name); + primary_if = primary_if_get_selected(bat_priv); + if (!primary_if) { + ret = seq_printf(seq, "BATMAN mesh %s disabled - " + "please specify interfaces to enable it\n", + net_dev->name); + goto out; + } + + if (primary_if->if_status != IF_ACTIVE) { + ret = seq_printf(seq, "BATMAN mesh %s " + "disabled - primary interface not active\n", + net_dev->name); + goto out; }
seq_printf(seq, "Softif neighbor list (%s)\n", net_dev->name); @@@ -234,7 -249,10 +245,10 @@@ if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh);
- return 0; + out: + if (primary_if) + hardif_free_ref(primary_if); + return ret; }
static void softif_batman_recv(struct sk_buff *skb, struct net_device *dev, @@@ -243,7 -261,8 +257,8 @@@ struct bat_priv *bat_priv = netdev_priv(dev); struct ethhdr *ethhdr = (struct ethhdr *)skb->data; struct batman_packet *batman_packet; - struct softif_neigh *softif_neigh; + struct softif_neigh *softif_neigh = NULL; + struct hard_iface *primary_if = NULL; struct softif_neigh *curr_softif_neigh = NULL;
if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) @@@ -253,28 -272,34 +268,34 @@@ batman_packet = (struct batman_packet *)(skb->data + ETH_HLEN);
if (batman_packet->version != COMPAT_VERSION) - goto err; + goto out;
if (batman_packet->packet_type != BAT_PACKET) - goto err; + goto out;
if (!(batman_packet->flags & PRIMARIES_FIRST_HOP)) - goto err; + goto out;
if (is_my_mac(batman_packet->orig)) - goto err; + goto out;
softif_neigh = softif_neigh_get(bat_priv, batman_packet->orig, vid); - if (!softif_neigh) - goto err; + goto out;
curr_softif_neigh = softif_neigh_get_selected(bat_priv); + if (!curr_softif_neigh) + goto out; + if (curr_softif_neigh == softif_neigh) goto out;
+ primary_if = primary_if_get_selected(bat_priv); + if (!primary_if) + goto out; + /* we got a neighbor but its mac is 'bigger' than ours */ - if (memcmp(bat_priv->primary_if->net_dev->dev_addr, + if (memcmp(primary_if->net_dev->dev_addr, softif_neigh->addr, ETH_ALEN) < 0) goto out;
@@@ -296,7 -321,7 +317,7 @@@ /* close own batX device and use softif_neigh as exit node */ if ((!curr_softif_neigh) && (memcmp(softif_neigh->addr, - bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN) < 0)) { + primary_if->net_dev->dev_addr, ETH_ALEN) < 0)) { bat_dbg(DBG_ROUTES, bat_priv, "Setting mesh exit point to %pM (vid: %d).\n", softif_neigh->addr, softif_neigh->vid); @@@ -306,12 -331,13 +327,13 @@@ }
out: - softif_neigh_free_ref(softif_neigh); - err: kfree_skb(skb); + if (softif_neigh) + softif_neigh_free_ref(softif_neigh); if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); - + if (primary_if) + hardif_free_ref(primary_if); return; }
@@@ -367,6 -393,7 +389,7 @@@ int interface_tx(struct sk_buff *skb, s { struct ethhdr *ethhdr = (struct ethhdr *)skb->data; struct bat_priv *bat_priv = netdev_priv(soft_iface); + struct hard_iface *primary_if = NULL; struct bcast_packet *bcast_packet; struct vlan_ethhdr *vhdr; struct softif_neigh *curr_softif_neigh = NULL; @@@ -416,7 -443,8 +439,8 @@@
/* ethernet packet should be broadcasted */ if (do_bcast) { - if (!bat_priv->primary_if) + primary_if = primary_if_get_selected(bat_priv); + if (!primary_if) goto dropped;
if (my_skb_head_push(skb, sizeof(struct bcast_packet)) < 0) @@@ -432,7 -460,7 +456,7 @@@ /* hw address of first interface is the orig mac because only * this mac is known throughout the mesh */ memcpy(bcast_packet->orig, - bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN); + primary_if->net_dev->dev_addr, ETH_ALEN);
/* set broadcast sequence number */ bcast_packet->seqno = @@@ -462,6 -490,8 +486,8 @@@ dropped_freed end: if (curr_softif_neigh) softif_neigh_free_ref(curr_softif_neigh); + if (primary_if) + hardif_free_ref(primary_if); return NETDEV_TX_OK; }
@@@ -528,7 -558,7 +554,7 @@@ void interface_rx(struct net_device *so goto dropped; skb->protocol = eth_type_trans(skb, soft_iface);
- /* should not be neccesary anymore as we use skb_pull_rcsum() + /* should not be necessary anymore as we use skb_pull_rcsum() * TODO: please verify this and remove this TODO * -- Dec 21st 2009, Simon Wunderlich */
@@@ -697,7 -727,7 +723,7 @@@ static int bat_get_settings(struct net_ { cmd->supported = 0; cmd->advertising = 0; - cmd->speed = SPEED_10; + ethtool_cmd_speed_set(cmd, SPEED_10); cmd->duplex = DUPLEX_FULL; cmd->port = PORT_TP; cmd->phy_address = 0; @@@ -732,3 -762,12 +758,3 @@@ static u32 bat_get_link(struct net_devi return 1; }
-static u32 bat_get_rx_csum(struct net_device *dev) -{ - return 0; -} - -static int bat_set_rx_csum(struct net_device *dev, u32 data) -{ - return -EOPNOTSUPP; -}
linux-merge@lists.open-mesh.org