b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28
@ 2013-03-28  7:50 Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 01/11] batman-adv: Fix endianness errors for network coding Antonio Quartulli
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

here you have another batch of patches intended for net-next/linux-3.10.

The first one fixes an endianess bug in the new network coding component,
sent within our last pull request. It was discovered thanks to
Fengguang Wu's automated daily checks on our tree (we upgraded our daily
check to look for endianess bugs as well ;-))

Then you have patches from 2/11 to 8/11 implementing the RTNL API for virtual
interfaces manipulation: now users can use the "ip" tool to create/delete
batman-adv interfaces and to enslave real ones below them. However, to avoid
breaking any user tool, we did not disrupt our sysfs API.

Patch 11/11 is addressing a new checkpatch complaining by substituting seq_printf
with seq_puts when possible (however, checkpatch seems to be broken because it
raises false positives in case of multi-line seq_printf).

The rest is ordinary house keeping.


Please pull or let me know if there is any problem!

Thank you,
	Antonio



The following changes since commit 6bdeaba47d87f48a3943b6899d6c6e6f17d52f1d:

  6lowpan: use IEEE802154_ADDR_LEN instead of a magic number (2013-03-27 00:52:16 -0400)

are available in the git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem

for you to fetch changes up to 0c81465357ffe29da9ff20103afe4a59908e0d30:

  batman-adv: use seq_puts instead of seq_printf when the format is constant (2013-03-27 10:29:55 +0100)

----------------------------------------------------------------
Included changes:
- A fix for the network coding component which has been added within the last
  pull request (so it is in linux-3.10). The problem has been spotted thanks to
  Fengguang Wu's automated daily checks on our tree.
- Implementation of the RTNL API for virtual interface creation/deletion and slave
  manipulation
- substitution of seq_printf with seq_puts when possible
- minor cleanups

----------------------------------------------------------------
Antonio Quartulli (3):
      batman-adv: free an hard-interface before adding it
      batman-adv: update Makefile copyright years
      batman-adv: use seq_puts instead of seq_printf when the format is constant

Marek Lindner (1):
      batman-adv: rename batadv_softif_destroy to reflect sysfs use case

Martin Hundebøll (1):
      batman-adv: Fix endianness errors for network coding

Simon Wunderlich (1):
      batman-adv: Start new development cycle

Sven Eckelmann (5):
      batman-adv: Move soft-interface initialization to ndo_init
      batman-adv: Move deinitialization of soft-interface to destructor
      batman-adv: Don't always delete softif when last slave was removed
      batman-adv: Allow to use rntl_link for device creation/deletion
      batman-adv: Allow to modify slaves of soft-interfaces through rntl_link

 net/batman-adv/Makefile         |   2 +-
 net/batman-adv/gateway_client.c |   2 +-
 net/batman-adv/hard-interface.c |  66 ++++++++--
 net/batman-adv/hard-interface.h |  13 +-
 net/batman-adv/main.c           |   4 +-
 net/batman-adv/main.h           |   3 +-
 net/batman-adv/network-coding.c |  10 +-
 net/batman-adv/originator.c     |   4 +-
 net/batman-adv/packet.h         |   2 +-
 net/batman-adv/soft-interface.c | 269 ++++++++++++++++++++++++++--------------
 net/batman-adv/soft-interface.h |   3 +-
 net/batman-adv/sysfs.c          |   6 +-
 net/batman-adv/vis.c            |   4 +-
 13 files changed, 268 insertions(+), 120 deletions(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 01/11] batman-adv: Fix endianness errors for network coding
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 02/11] batman-adv: Move soft-interface initialization to ndo_init Antonio Quartulli
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, Martin Hundebøll, b.a.t.m.a.n, Marek Lindner

From: Martin Hundebøll <martin@hundeboll.net>

Add a htonl() in network_coding.c when reading the sequence number
from received ogm_packet, to avoid wrong byte ordering when comparing
with a host value. This bug was introduced in
3ed7ada3f0bbcd058567bc0a8f9729a73eba7db6 ("batman-adv: network coding -
detect coding nodes and remove these after timeout").

Change the type of coded_packet->coded_len from uint16 to __be16 to
avoid wrong assumptions about endianness in later uses. Introduced in
c3289f3650d34b60296000a629c99f2488f7c3dd ("batman-adv: network coding -
code and transmit packets if possible").

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/network-coding.c | 2 +-
 net/batman-adv/packet.h         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 5728079..086c107 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -654,7 +654,7 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
 				    struct batadv_orig_node *orig_node,
 				    struct batadv_ogm_packet *ogm_packet)
 {
-	if (orig_node->last_real_seqno != ogm_packet->seqno)
+	if (orig_node->last_real_seqno != ntohl(ogm_packet->seqno))
 		return false;
 	if (orig_node->last_ttl != ogm_packet->header.ttl + 1)
 		return false;
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index a079958..a51ccfc 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -308,7 +308,7 @@ struct batadv_coded_packet {
 	uint8_t  second_source[ETH_ALEN];
 	uint8_t  second_orig_dest[ETH_ALEN];
 	__be32   second_crc;
-	uint16_t coded_len;
+	__be16   coded_len;
 };
 
 #endif /* _NET_BATMAN_ADV_PACKET_H_ */
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 02/11] batman-adv: Move soft-interface initialization to ndo_init
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 01/11] batman-adv: Fix endianness errors for network coding Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 03/11] batman-adv: Move deinitialization of soft-interface to destructor Antonio Quartulli
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann

From: Sven Eckelmann <sven@narfation.org>

The initialization of an net_device object should be done in the
init/constructor function and not from the outside after the register_netdevice
was done to avoid race conditions.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/hard-interface.c |   5 ++
 net/batman-adv/soft-interface.c | 169 +++++++++++++++++++---------------------
 2 files changed, 86 insertions(+), 88 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 368219e..da000e9 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -563,6 +563,11 @@ static int batadv_hard_if_event(struct notifier_block *this,
 	struct batadv_hard_iface *primary_if = NULL;
 	struct batadv_priv *bat_priv;
 
+	if (batadv_softif_is_valid(net_dev) && event == NETDEV_REGISTER) {
+		batadv_sysfs_add_meshif(net_dev);
+		return NOTIFY_DONE;
+	}
+
 	hard_iface = batadv_hardif_get_by_netdev(net_dev);
 	if (!hard_iface && event == NETDEV_REGISTER)
 		hard_iface = batadv_hardif_add_interface(net_dev);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index f93ae42..c5cb0a7 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -402,55 +402,6 @@ static void batadv_set_lockdep_class(struct net_device *dev)
 }
 
 /**
- * batadv_softif_init - Late stage initialization of soft interface
- * @dev: registered network device to modify
- *
- * Returns error code on failures
- */
-static int batadv_softif_init(struct net_device *dev)
-{
-	batadv_set_lockdep_class(dev);
-
-	return 0;
-}
-
-static const struct net_device_ops batadv_netdev_ops = {
-	.ndo_init = batadv_softif_init,
-	.ndo_open = batadv_interface_open,
-	.ndo_stop = batadv_interface_release,
-	.ndo_get_stats = batadv_interface_stats,
-	.ndo_set_mac_address = batadv_interface_set_mac_addr,
-	.ndo_change_mtu = batadv_interface_change_mtu,
-	.ndo_start_xmit = batadv_interface_tx,
-	.ndo_validate_addr = eth_validate_addr
-};
-
-static void batadv_interface_setup(struct net_device *dev)
-{
-	struct batadv_priv *priv = netdev_priv(dev);
-
-	ether_setup(dev);
-
-	dev->netdev_ops = &batadv_netdev_ops;
-	dev->destructor = free_netdev;
-	dev->tx_queue_len = 0;
-
-	/* can't call min_mtu, because the needed variables
-	 * have not been initialized yet
-	 */
-	dev->mtu = ETH_DATA_LEN;
-	/* reserve more space in the skbuff for our header */
-	dev->hard_header_len = BATADV_HEADER_LEN;
-
-	/* generate random address */
-	eth_hw_addr_random(dev);
-
-	SET_ETHTOOL_OPS(dev, &batadv_ethtool_ops);
-
-	memset(priv, 0, sizeof(*priv));
-}
-
-/**
  * batadv_softif_destroy_finish - cleans up the remains of a softif
  * @work: work queue item
  *
@@ -474,21 +425,22 @@ static void batadv_softif_destroy_finish(struct work_struct *work)
 	rtnl_unlock();
 }
 
-struct net_device *batadv_softif_create(const char *name)
+/**
+ * batadv_softif_init_late - late stage initialization of soft interface
+ * @dev: registered network device to modify
+ *
+ * Returns error code on failures
+ */
+static int batadv_softif_init_late(struct net_device *dev)
 {
-	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
 	int ret;
 	size_t cnt_len = sizeof(uint64_t) * BATADV_CNT_NUM;
 
-	soft_iface = alloc_netdev(sizeof(*bat_priv), name,
-				  batadv_interface_setup);
+	batadv_set_lockdep_class(dev);
 
-	if (!soft_iface)
-		goto out;
-
-	bat_priv = netdev_priv(soft_iface);
-	bat_priv->soft_iface = soft_iface;
+	bat_priv = netdev_priv(dev);
+	bat_priv->soft_iface = dev;
 	INIT_WORK(&bat_priv->cleanup_work, batadv_softif_destroy_finish);
 
 	/* batadv_interface_stats() needs to be available as soon as
@@ -496,14 +448,7 @@ struct net_device *batadv_softif_create(const char *name)
 	 */
 	bat_priv->bat_counters = __alloc_percpu(cnt_len, __alignof__(uint64_t));
 	if (!bat_priv->bat_counters)
-		goto free_soft_iface;
-
-	ret = register_netdevice(soft_iface);
-	if (ret < 0) {
-		pr_err("Unable to register the batman interface '%s': %i\n",
-		       name, ret);
-		goto free_bat_counters;
-	}
+		return -ENOMEM;
 
 	atomic_set(&bat_priv->aggregated_ogms, 1);
 	atomic_set(&bat_priv->bonding, 0);
@@ -541,41 +486,89 @@ struct net_device *batadv_softif_create(const char *name)
 	bat_priv->primary_if = NULL;
 	bat_priv->num_ifaces = 0;
 
-	ret = batadv_algo_select(bat_priv, batadv_routing_algo);
-	if (ret < 0)
-		goto unreg_soft_iface;
-
 	batadv_nc_init_bat_priv(bat_priv);
 
-	ret = batadv_sysfs_add_meshif(soft_iface);
+	ret = batadv_algo_select(bat_priv, batadv_routing_algo);
 	if (ret < 0)
-		goto unreg_soft_iface;
+		goto free_bat_counters;
 
-	ret = batadv_debugfs_add_meshif(soft_iface);
+	ret = batadv_debugfs_add_meshif(dev);
 	if (ret < 0)
-		goto unreg_sysfs;
+		goto free_bat_counters;
 
-	ret = batadv_mesh_init(soft_iface);
+	ret = batadv_mesh_init(dev);
 	if (ret < 0)
 		goto unreg_debugfs;
 
-	return soft_iface;
+	return 0;
 
 unreg_debugfs:
-	batadv_debugfs_del_meshif(soft_iface);
-unreg_sysfs:
-	batadv_sysfs_del_meshif(soft_iface);
-unreg_soft_iface:
-	free_percpu(bat_priv->bat_counters);
-	unregister_netdevice(soft_iface);
-	return NULL;
-
+	batadv_debugfs_del_meshif(dev);
 free_bat_counters:
 	free_percpu(bat_priv->bat_counters);
-free_soft_iface:
-	free_netdev(soft_iface);
-out:
-	return NULL;
+
+	return ret;
+}
+
+static const struct net_device_ops batadv_netdev_ops = {
+	.ndo_init = batadv_softif_init_late,
+	.ndo_open = batadv_interface_open,
+	.ndo_stop = batadv_interface_release,
+	.ndo_get_stats = batadv_interface_stats,
+	.ndo_set_mac_address = batadv_interface_set_mac_addr,
+	.ndo_change_mtu = batadv_interface_change_mtu,
+	.ndo_start_xmit = batadv_interface_tx,
+	.ndo_validate_addr = eth_validate_addr
+};
+
+/**
+ * batadv_softif_init_early - early stage initialization of soft interface
+ * @dev: registered network device to modify
+ */
+static void batadv_softif_init_early(struct net_device *dev)
+{
+	struct batadv_priv *priv = netdev_priv(dev);
+
+	ether_setup(dev);
+
+	dev->netdev_ops = &batadv_netdev_ops;
+	dev->destructor = free_netdev;
+	dev->tx_queue_len = 0;
+
+	/* can't call min_mtu, because the needed variables
+	 * have not been initialized yet
+	 */
+	dev->mtu = ETH_DATA_LEN;
+	/* reserve more space in the skbuff for our header */
+	dev->hard_header_len = BATADV_HEADER_LEN;
+
+	/* generate random address */
+	eth_hw_addr_random(dev);
+
+	SET_ETHTOOL_OPS(dev, &batadv_ethtool_ops);
+
+	memset(priv, 0, sizeof(*priv));
+}
+
+struct net_device *batadv_softif_create(const char *name)
+{
+	struct net_device *soft_iface;
+	int ret;
+
+	soft_iface = alloc_netdev(sizeof(struct batadv_priv), name,
+				  batadv_softif_init_early);
+	if (!soft_iface)
+		return NULL;
+
+	ret = register_netdevice(soft_iface);
+	if (ret < 0) {
+		pr_err("Unable to register the batman interface '%s': %i\n",
+		       name, ret);
+		free_netdev(soft_iface);
+		return NULL;
+	}
+
+	return soft_iface;
 }
 
 void batadv_softif_destroy(struct net_device *soft_iface)
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 03/11] batman-adv: Move deinitialization of soft-interface to destructor
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 01/11] batman-adv: Fix endianness errors for network coding Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 02/11] batman-adv: Move soft-interface initialization to ndo_init Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 04/11] batman-adv: Don't always delete softif when last slave was removed Antonio Quartulli
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann

From: Sven Eckelmann <sven@narfation.org>

The deinitialization of the soft-interface created in ndo_init/constructor
should be done in the destructor and not directly before calling
unregister_netdevice

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/soft-interface.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index c5cb0a7..e889bfb 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -417,7 +417,6 @@ static void batadv_softif_destroy_finish(struct work_struct *work)
 				cleanup_work);
 	soft_iface = bat_priv->soft_iface;
 
-	batadv_debugfs_del_meshif(soft_iface);
 	batadv_sysfs_del_meshif(soft_iface);
 
 	rtnl_lock();
@@ -522,6 +521,17 @@ static const struct net_device_ops batadv_netdev_ops = {
 };
 
 /**
+ * batadv_softif_free - Deconstructor of batadv_soft_interface
+ * @dev: Device to cleanup and remove
+ */
+static void batadv_softif_free(struct net_device *dev)
+{
+	batadv_debugfs_del_meshif(dev);
+	batadv_mesh_free(dev);
+	free_netdev(dev);
+}
+
+/**
  * batadv_softif_init_early - early stage initialization of soft interface
  * @dev: registered network device to modify
  */
@@ -532,7 +542,7 @@ static void batadv_softif_init_early(struct net_device *dev)
 	ether_setup(dev);
 
 	dev->netdev_ops = &batadv_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->destructor = batadv_softif_free;
 	dev->tx_queue_len = 0;
 
 	/* can't call min_mtu, because the needed variables
@@ -575,7 +585,6 @@ void batadv_softif_destroy(struct net_device *soft_iface)
 {
 	struct batadv_priv *bat_priv = netdev_priv(soft_iface);
 
-	batadv_mesh_free(soft_iface);
 	queue_work(batadv_event_workqueue, &bat_priv->cleanup_work);
 }
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 04/11] batman-adv: Don't always delete softif when last slave was removed
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (2 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 03/11] batman-adv: Move deinitialization of soft-interface to destructor Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 05/11] batman-adv: rename batadv_softif_destroy to reflect sysfs use case Antonio Quartulli
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann

From: Sven Eckelmann <sven@narfation.org>

batman-adv has an unusual way to manage softinterfaces. These will be created
automatically when a user writes to the batman-adv/mesh_iface file in sysfs and
removed when no slave device exists anymore.

This behaviour cannot be changed without breaking compatibility with existing
code. Instead other interfaces should be able to slightly reduce this behaviour
and provide a more common reaction to a removal of a slave interface.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/hard-interface.c |  8 +++++---
 net/batman-adv/hard-interface.h | 13 ++++++++++++-
 net/batman-adv/sysfs.c          |  6 ++++--
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index da000e9..74e3ec2f 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -408,7 +408,8 @@ err:
 	return ret;
 }
 
-void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
+void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
+				     enum batadv_hard_if_cleanup autodel)
 {
 	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
 	struct batadv_hard_iface *primary_if = NULL;
@@ -446,7 +447,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
 	dev_put(hard_iface->soft_iface);
 
 	/* nobody uses this interface anymore */
-	if (!bat_priv->num_ifaces)
+	if (!bat_priv->num_ifaces && autodel == BATADV_IF_CLEANUP_AUTO)
 		batadv_softif_destroy(hard_iface->soft_iface);
 
 	hard_iface->soft_iface = NULL;
@@ -533,7 +534,8 @@ static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface)
 
 	/* first deactivate interface */
 	if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
-		batadv_hardif_disable_interface(hard_iface);
+		batadv_hardif_disable_interface(hard_iface,
+						BATADV_IF_CLEANUP_AUTO);
 
 	if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
 		return;
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index 308437d..4989288 100644
--- a/net/batman-adv/hard-interface.h
+++ b/net/batman-adv/hard-interface.h
@@ -29,13 +29,24 @@ enum batadv_hard_if_state {
 	BATADV_IF_I_WANT_YOU,
 };
 
+/**
+ * enum batadv_hard_if_cleanup - Cleanup modi for soft_iface after slave removal
+ * @BATADV_IF_CLEANUP_KEEP: Don't automatically delete soft-interface
+ * @BATADV_IF_CLEANUP_AUTO: Delete soft-interface after last slave was removed
+ */
+enum batadv_hard_if_cleanup {
+	BATADV_IF_CLEANUP_KEEP,
+	BATADV_IF_CLEANUP_AUTO,
+};
+
 extern struct notifier_block batadv_hard_if_notifier;
 
 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);
-void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface);
+void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
+				     enum batadv_hard_if_cleanup autodel);
 void batadv_hardif_remove_interfaces(void);
 int batadv_hardif_min_mtu(struct net_device *soft_iface);
 void batadv_update_min_mtu(struct net_device *soft_iface);
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
index ce39f62..15a22ef 100644
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@ -588,13 +588,15 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
 	}
 
 	if (status_tmp == BATADV_IF_NOT_IN_USE) {
-		batadv_hardif_disable_interface(hard_iface);
+		batadv_hardif_disable_interface(hard_iface,
+						BATADV_IF_CLEANUP_AUTO);
 		goto unlock;
 	}
 
 	/* if the interface already is in use */
 	if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
-		batadv_hardif_disable_interface(hard_iface);
+		batadv_hardif_disable_interface(hard_iface,
+						BATADV_IF_CLEANUP_AUTO);
 
 	ret = batadv_hardif_enable_interface(hard_iface, buff);
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 05/11] batman-adv: rename batadv_softif_destroy to reflect sysfs use case
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (3 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 04/11] batman-adv: Don't always delete softif when last slave was removed Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 06/11] batman-adv: Allow to use rntl_link for device creation/deletion Antonio Quartulli
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann

From: Marek Lindner <lindner_marek@yahoo.de>

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
CC: Sven Eckelmann <sven@narfation.org>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/hard-interface.c | 2 +-
 net/batman-adv/soft-interface.c | 6 +++++-
 net/batman-adv/soft-interface.h | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 74e3ec2f..6c32607 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -448,7 +448,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 
 	/* nobody uses this interface anymore */
 	if (!bat_priv->num_ifaces && autodel == BATADV_IF_CLEANUP_AUTO)
-		batadv_softif_destroy(hard_iface->soft_iface);
+		batadv_softif_destroy_sysfs(hard_iface->soft_iface);
 
 	hard_iface->soft_iface = NULL;
 	batadv_hardif_free_ref(hard_iface);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index e889bfb..bc77a5be 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -581,7 +581,11 @@ struct net_device *batadv_softif_create(const char *name)
 	return soft_iface;
 }
 
-void batadv_softif_destroy(struct net_device *soft_iface)
+/**
+ * batadv_softif_destroy_sysfs - deletion of batadv_soft_interface via sysfs
+ * @soft_iface: the to-be-removed batman-adv interface
+ */
+void batadv_softif_destroy_sysfs(struct net_device *soft_iface)
 {
 	struct batadv_priv *bat_priv = netdev_priv(soft_iface);
 
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h
index 43182e5..49bc66b 100644
--- a/net/batman-adv/soft-interface.h
+++ b/net/batman-adv/soft-interface.h
@@ -25,7 +25,7 @@ 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);
-void batadv_softif_destroy(struct net_device *soft_iface);
+void batadv_softif_destroy_sysfs(struct net_device *soft_iface);
 int batadv_softif_is_valid(const struct net_device *net_dev);
 
 #endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 06/11] batman-adv: Allow to use rntl_link for device creation/deletion
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (4 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 05/11] batman-adv: rename batadv_softif_destroy to reflect sysfs use case Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 07/11] batman-adv: Allow to modify slaves of soft-interfaces through rntl_link Antonio Quartulli
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann

From: Sven Eckelmann <sven@narfation.org>

The sysfs configuration interface of batman-adv to add/remove soft-interfaces
is not deadlock free and doesn't follow the currently common way to create new
virtual interfaces.

An additional interface though rtnl_link is introduced which provides easy device
creation/deletion with tools like "ip":

$ ip link add dev bat0 type batadv
$ ip link del dev bat0

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/main.c           |  2 ++
 net/batman-adv/main.h           |  1 +
 net/batman-adv/soft-interface.c | 29 +++++++++++++++++++++++++++++
 net/batman-adv/soft-interface.h |  1 +
 4 files changed, 33 insertions(+)

diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 0495a7d..62b1f89 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -71,6 +71,7 @@ static int __init batadv_init(void)
 	batadv_debugfs_init();
 
 	register_netdevice_notifier(&batadv_hard_if_notifier);
+	rtnl_link_register(&batadv_link_ops);
 
 	pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
 		BATADV_SOURCE_VERSION, BATADV_COMPAT_VERSION);
@@ -81,6 +82,7 @@ static int __init batadv_init(void)
 static void __exit batadv_exit(void)
 {
 	batadv_debugfs_destroy();
+	rtnl_link_unregister(&batadv_link_ops);
 	unregister_netdevice_notifier(&batadv_hard_if_notifier);
 	batadv_hardif_remove_interfaces();
 
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 0afd4ee..a9e12e6 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -152,6 +152,7 @@ enum batadv_uev_type {
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <net/sock.h>		/* struct sock */
+#include <net/rtnetlink.h>
 #include <linux/jiffies.h>
 #include <linux/seq_file.h>
 #include "types.h"
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index bc77a5be..545c863 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -570,6 +570,8 @@ struct net_device *batadv_softif_create(const char *name)
 	if (!soft_iface)
 		return NULL;
 
+	soft_iface->rtnl_link_ops = &batadv_link_ops;
+
 	ret = register_netdevice(soft_iface);
 	if (ret < 0) {
 		pr_err("Unable to register the batman interface '%s': %i\n",
@@ -592,6 +594,26 @@ void batadv_softif_destroy_sysfs(struct net_device *soft_iface)
 	queue_work(batadv_event_workqueue, &bat_priv->cleanup_work);
 }
 
+/**
+ * batadv_softif_destroy_netlink - deletion of batadv_soft_interface via netlink
+ * @soft_iface: the to-be-removed batman-adv interface
+ * @head: list pointer
+ */
+static void batadv_softif_destroy_netlink(struct net_device *soft_iface,
+					  struct list_head *head)
+{
+	struct batadv_hard_iface *hard_iface;
+
+	list_for_each_entry(hard_iface, &batadv_hardif_list, list) {
+		if (hard_iface->soft_iface == soft_iface)
+			batadv_hardif_disable_interface(hard_iface,
+							BATADV_IF_CLEANUP_KEEP);
+	}
+
+	batadv_sysfs_del_meshif(soft_iface);
+	unregister_netdevice_queue(soft_iface, head);
+}
+
 int batadv_softif_is_valid(const struct net_device *net_dev)
 {
 	if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx)
@@ -600,6 +622,13 @@ int batadv_softif_is_valid(const struct net_device *net_dev)
 	return 0;
 }
 
+struct rtnl_link_ops batadv_link_ops __read_mostly = {
+	.kind		= "batadv",
+	.priv_size	= sizeof(struct batadv_priv),
+	.setup		= batadv_softif_init_early,
+	.dellink	= batadv_softif_destroy_netlink,
+};
+
 /* ethtool */
 static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h
index 49bc66b..2f2472c 100644
--- a/net/batman-adv/soft-interface.h
+++ b/net/batman-adv/soft-interface.h
@@ -27,5 +27,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
 struct net_device *batadv_softif_create(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;
 
 #endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 07/11] batman-adv: Allow to modify slaves of soft-interfaces through rntl_link
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (5 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 06/11] batman-adv: Allow to use rntl_link for device creation/deletion Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 08/11] batman-adv: free an hard-interface before adding it Antonio Quartulli
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann

From: Sven Eckelmann <sven@narfation.org>

The sysfs configuration interface of batman-adv to add/remove slaves of an
soft-iface is not deadlock free and doesn't follow the currently common way to
modify slaves of an interface.

An additional configuration interface though rtnl_link is introduced which
provides easy device adding/removing with tools like "ip":
$ ip link set dev eth0 master bat0
$ ip link set dev eth0 nomaster

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/hard-interface.c | 12 +++++++--
 net/batman-adv/soft-interface.c | 56 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 6c32607..f33ced8 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -350,9 +350,13 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
+	ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface);
+	if (ret)
+		goto err_dev;
+
 	ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface);
 	if (ret < 0)
-		goto err_dev;
+		goto err_upper;
 
 	hard_iface->if_num = bat_priv->num_ifaces;
 	bat_priv->num_ifaces++;
@@ -362,7 +366,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 		bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
 		bat_priv->num_ifaces--;
 		hard_iface->if_status = BATADV_IF_NOT_IN_USE;
-		goto err_dev;
+		goto err_upper;
 	}
 
 	hard_iface->batman_adv_ptype.type = ethertype;
@@ -401,7 +405,10 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 out:
 	return 0;
 
+err_upper:
+	netdev_upper_dev_unlink(hard_iface->net_dev, soft_iface);
 err_dev:
+	hard_iface->soft_iface = NULL;
 	dev_put(soft_iface);
 err:
 	batadv_hardif_free_ref(hard_iface);
@@ -450,6 +457,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 	if (!bat_priv->num_ifaces && autodel == BATADV_IF_CLEANUP_AUTO)
 		batadv_softif_destroy_sysfs(hard_iface->soft_iface);
 
+	netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
 	hard_iface->soft_iface = NULL;
 	batadv_hardif_free_ref(hard_iface);
 
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 545c863..403b8c4 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -509,6 +509,58 @@ free_bat_counters:
 	return ret;
 }
 
+/**
+ * batadv_softif_slave_add - Add a slave interface to a batadv_soft_interface
+ * @dev: batadv_soft_interface used as master interface
+ * @slave_dev: net_device which should become the slave interface
+ *
+ * Return 0 if successful or error otherwise.
+ */
+static int batadv_softif_slave_add(struct net_device *dev,
+				   struct net_device *slave_dev)
+{
+	struct batadv_hard_iface *hard_iface;
+	int ret = -EINVAL;
+
+	hard_iface = batadv_hardif_get_by_netdev(slave_dev);
+	if (!hard_iface || hard_iface->soft_iface != NULL)
+		goto out;
+
+	ret = batadv_hardif_enable_interface(hard_iface, dev->name);
+
+out:
+	if (hard_iface)
+		batadv_hardif_free_ref(hard_iface);
+	return ret;
+}
+
+/**
+ * batadv_softif_slave_del - Delete a slave iface from a batadv_soft_interface
+ * @dev: batadv_soft_interface used as master interface
+ * @slave_dev: net_device which should be removed from the master interface
+ *
+ * Return 0 if successful or error otherwise.
+ */
+static int batadv_softif_slave_del(struct net_device *dev,
+				   struct net_device *slave_dev)
+{
+	struct batadv_hard_iface *hard_iface;
+	int ret = -EINVAL;
+
+	hard_iface = batadv_hardif_get_by_netdev(slave_dev);
+
+	if (!hard_iface || hard_iface->soft_iface != dev)
+		goto out;
+
+	batadv_hardif_disable_interface(hard_iface, BATADV_IF_CLEANUP_KEEP);
+	ret = 0;
+
+out:
+	if (hard_iface)
+		batadv_hardif_free_ref(hard_iface);
+	return ret;
+}
+
 static const struct net_device_ops batadv_netdev_ops = {
 	.ndo_init = batadv_softif_init_late,
 	.ndo_open = batadv_interface_open,
@@ -517,7 +569,9 @@ static const struct net_device_ops batadv_netdev_ops = {
 	.ndo_set_mac_address = batadv_interface_set_mac_addr,
 	.ndo_change_mtu = batadv_interface_change_mtu,
 	.ndo_start_xmit = batadv_interface_tx,
-	.ndo_validate_addr = eth_validate_addr
+	.ndo_validate_addr = eth_validate_addr,
+	.ndo_add_slave = batadv_softif_slave_add,
+	.ndo_del_slave = batadv_softif_slave_del,
 };
 
 /**
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 08/11] batman-adv: free an hard-interface before adding it
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (6 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 07/11] batman-adv: Allow to modify slaves of soft-interfaces through rntl_link Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 09/11] batman-adv: Start new development cycle Antonio Quartulli
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner

When adding a new hard interface (e.g. wlan0) to a soft interface (e.g. bat0)
and the former is already enslaved in another virtual interface (e.g. a software
bridge) batman-adv has to free it first and then continue with the adding
mechanism.

In this way the behaviour becomes consistent with what "ip link set master"
does. At the moment batman-adv enslaves the hard interface without checking for
the master device, possibly causing strange behaviours which are never wanted by
the users.

Reported-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 net/batman-adv/hard-interface.c | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index f33ced8..522243a 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -307,11 +307,35 @@ batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
 	batadv_update_min_mtu(hard_iface->soft_iface);
 }
 
+/**
+ * batadv_master_del_slave - remove hard_iface from the current master interface
+ * @slave: the interface enslaved in another master
+ * @master: the master from which slave has to be removed
+ *
+ * Invoke ndo_del_slave on master passing slave as argument. In this way slave
+ * is free'd and master can correctly change its internal state.
+ * Return 0 on success, a negative value representing the error otherwise
+ */
+static int batadv_master_del_slave(struct batadv_hard_iface *slave,
+				   struct net_device *master)
+{
+	int ret;
+
+	if (!master)
+		return 0;
+
+	ret = -EBUSY;
+	if (master->netdev_ops->ndo_del_slave)
+		ret = master->netdev_ops->ndo_del_slave(master, slave->net_dev);
+
+	return ret;
+}
+
 int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 				   const char *iface_name)
 {
 	struct batadv_priv *bat_priv;
-	struct net_device *soft_iface;
+	struct net_device *soft_iface, *master;
 	__be16 ethertype = __constant_htons(ETH_P_BATMAN);
 	int ret;
 
@@ -321,11 +345,6 @@ int batadv_hardif_enable_interface(struct batadv_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) {
@@ -347,6 +366,14 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 		goto err_dev;
 	}
 
+	/* check if the interface is enslaved in another virtual one and
+	 * in that case unlink it first
+	 */
+	master = netdev_master_upper_dev_get(hard_iface->net_dev);
+	ret = batadv_master_del_slave(hard_iface, master);
+	if (ret)
+		goto err_dev;
+
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 09/11] batman-adv: Start new development cycle
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (7 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 08/11] batman-adv: free an hard-interface before adding it Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 10/11] batman-adv: update Makefile copyright years Antonio Quartulli
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index a9e12e6..f90f5bc 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -26,7 +26,7 @@
 #define BATADV_DRIVER_DEVICE "batman-adv"
 
 #ifndef BATADV_SOURCE_VERSION
-#define BATADV_SOURCE_VERSION "2013.1.0"
+#define BATADV_SOURCE_VERSION "2013.2.0"
 #endif
 
 /* B.A.T.M.A.N. parameters */
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 10/11] batman-adv: update Makefile copyright years
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (8 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 09/11] batman-adv: Start new development cycle Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 11/11] batman-adv: use seq_puts instead of seq_printf when the format is constant Antonio Quartulli
  2013-03-28 18:34 ` [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Simon Wunderlich

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile
index 4b8f192..acbac2a 100644
--- a/net/batman-adv/Makefile
+++ b/net/batman-adv/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
+# Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
 #
 # Marek Lindner, Simon Wunderlich
 #
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [B.A.T.M.A.N.] [PATCH 11/11] batman-adv: use seq_puts instead of seq_printf when the format is constant
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (9 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 10/11] batman-adv: update Makefile copyright years Antonio Quartulli
@ 2013-03-28  7:50 ` Antonio Quartulli
  2013-03-28 18:34 ` [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-03-28  7:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner

As reported by checkpatch, seq_puts has to be preferred with
respect to seq_printf when the format is a constant string
(no va_args)

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 net/batman-adv/gateway_client.c | 2 +-
 net/batman-adv/main.c           | 2 +-
 net/batman-adv/network-coding.c | 8 ++++----
 net/batman-adv/originator.c     | 4 ++--
 net/batman-adv/vis.c            | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 34f99a4..f105219 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -500,7 +500,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
 	rcu_read_unlock();
 
 	if (gw_count == 0)
-		seq_printf(seq, "No gateways in range ...\n");
+		seq_puts(seq, "No gateways in range ...\n");
 
 out:
 	if (primary_if)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 62b1f89..6277735 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -419,7 +419,7 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
 {
 	struct batadv_algo_ops *bat_algo_ops;
 
-	seq_printf(seq, "Available routing algorithms:\n");
+	seq_puts(seq, "Available routing algorithms:\n");
 
 	hlist_for_each_entry(bat_algo_ops, &batadv_algo_list, list) {
 		seq_printf(seq, "%s\n", bat_algo_ops->name);
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 086c107..6b9a544 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -1760,23 +1760,23 @@ int batadv_nc_nodes_seq_print_text(struct seq_file *seq, void *offset)
 		hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
 			seq_printf(seq, "Node:      %pM\n", orig_node->orig);
 
-			seq_printf(seq, " Ingoing:  ");
+			seq_puts(seq, " Ingoing:  ");
 			/* For each in_nc_node to this orig_node */
 			list_for_each_entry_rcu(nc_node,
 						&orig_node->in_coding_list,
 						list)
 				seq_printf(seq, "%pM ",
 					   nc_node->addr);
-			seq_printf(seq, "\n");
+			seq_puts(seq, "\n");
 
-			seq_printf(seq, " Outgoing: ");
+			seq_puts(seq, " Outgoing: ");
 			/* For out_nc_node to this orig_node */
 			list_for_each_entry_rcu(nc_node,
 						&orig_node->out_coding_list,
 						list)
 				seq_printf(seq, "%pM ",
 					   nc_node->addr);
-			seq_printf(seq, "\n\n");
+			seq_puts(seq, "\n\n");
 		}
 		rcu_read_unlock();
 	}
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 585e684..2f34525 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -465,7 +465,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
 					   neigh_node_tmp->tq_avg);
 			}
 
-			seq_printf(seq, "\n");
+			seq_puts(seq, "\n");
 			batman_count++;
 
 next:
@@ -475,7 +475,7 @@ next:
 	}
 
 	if (batman_count == 0)
-		seq_printf(seq, "No batman nodes in range ...\n");
+		seq_puts(seq, "No batman nodes in range ...\n");
 
 out:
 	if (primary_if)
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index c053244..962ccf3 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -149,7 +149,7 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq,
 
 	hlist_for_each_entry(entry, if_list, list) {
 		if (entry->primary)
-			seq_printf(seq, "PRIMARY, ");
+			seq_puts(seq, "PRIMARY, ");
 		else
 			seq_printf(seq,  "SEC %pM, ", entry->addr);
 	}
@@ -207,7 +207,7 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
 		if (batadv_compare_eth(entry->addr, packet->vis_orig))
 			batadv_vis_data_read_prim_sec(seq, list);
 
-		seq_printf(seq, "\n");
+		seq_puts(seq, "\n");
 	}
 }
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28
  2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
                   ` (10 preceding siblings ...)
  2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 11/11] batman-adv: use seq_puts instead of seq_printf when the format is constant Antonio Quartulli
@ 2013-03-28 18:34 ` David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-03-28 18:34 UTC (permalink / raw)
  To: ordex; +Cc: netdev, b.a.t.m.a.n

From: Antonio Quartulli <ordex@autistici.org>
Date: Thu, 28 Mar 2013 08:50:20 +0100

> here you have another batch of patches intended for net-next/linux-3.10.
> 
> The first one fixes an endianess bug in the new network coding component,
> sent within our last pull request. It was discovered thanks to
> Fengguang Wu's automated daily checks on our tree (we upgraded our daily
> check to look for endianess bugs as well ;-))
> 
> Then you have patches from 2/11 to 8/11 implementing the RTNL API for virtual
> interfaces manipulation: now users can use the "ip" tool to create/delete
> batman-adv interfaces and to enslave real ones below them. However, to avoid
> breaking any user tool, we did not disrupt our sysfs API.
> 
> Patch 11/11 is addressing a new checkpatch complaining by substituting seq_printf
> with seq_puts when possible (however, checkpatch seems to be broken because it
> raises false positives in case of multi-line seq_printf).
> 
> The rest is ordinary house keeping.

Pulled, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-03-28 18:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28  7:50 [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 01/11] batman-adv: Fix endianness errors for network coding Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 02/11] batman-adv: Move soft-interface initialization to ndo_init Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 03/11] batman-adv: Move deinitialization of soft-interface to destructor Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 04/11] batman-adv: Don't always delete softif when last slave was removed Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 05/11] batman-adv: rename batadv_softif_destroy to reflect sysfs use case Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 06/11] batman-adv: Allow to use rntl_link for device creation/deletion Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 07/11] batman-adv: Allow to modify slaves of soft-interfaces through rntl_link Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 08/11] batman-adv: free an hard-interface before adding it Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 09/11] batman-adv: Start new development cycle Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 10/11] batman-adv: update Makefile copyright years Antonio Quartulli
2013-03-28  7:50 ` [B.A.T.M.A.N.] [PATCH 11/11] batman-adv: use seq_puts instead of seq_printf when the format is constant Antonio Quartulli
2013-03-28 18:34 ` [B.A.T.M.A.N.] pull request: batman-adv 2013-03-28 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).