mbox

pull request for net: batman-adv 2013-06-11

Message ID 1370932501-3937-1-git-send-email-ordex@autistici.org (mailing list archive)
State Not Applicable, archived
Headers

Pull-request

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

Message

Antonio Quartulli June 11, 2013, 6:34 a.m. UTC
  Hello David,

here you have three patches intended for net/linux-3.10.

Patch 1/3 is substituting a rtnl_trylock with a rtnl_lock. The trylock was used
before to avoid deadlock, but since this situation has been fixed, the trylock
is not necessary anymore. It only creates troubles every time batman-adv is
initialised and the RTNL lock is taken by another component.
Since the deadlock has been fixed in 3.8, I'd like to queue this patch for
stable for 3.8+.


Patch 2/3 fixes an important point in our routing protocol, in particular in the
duplicate control messages detection. In the right condition, the protocol
prevents some control packets to be forwarded making some nodes in the network
totally unreachable and so breaking the mesh. The fix, by Simon Wunderlich,
enhances the duplicate message detection and avoids this situation (the change
may look a bit big, but it is just because a variable has been changed from int
to enum to better describe the duplicate packet event).
Please, enqueue this patch for -stable because the bug is there since a while..


Patch 3/3 fixes the Bridge Loop Avoidance component by avoiding a particular
routine to run even if the aforementioned feature is off. This bug leads to some
useless packets to be sent over the mesh. This one is not critical and therefore
does not need to be enqueued for stable.


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

Thanks a lot,
	Antonio


The following changes since commit 40edeff6e1c6f9a6f16536ae3375e3af9d648449:

  net_sched: qdisc_get_rtab() must check data[] array (2013-06-07 15:24:04 -0700)

are available in the git repository at:

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

for you to fetch changes up to d5b4c93e67b0b1291aa8e2aaf694e40afc3412d0:

  batman-adv: Don't handle address updates when bla is disabled (2013-06-10 08:42:18 +0200)

----------------------------------------------------------------
Included change:
- fix "rtnl locked" concurrent executions by using rtnl_lock instead of
  rtnl_trylock. This fix enables batman-adv initialisation to do not fail just
  because somewhere else in the system another code path is holding the rtnl
  lock. It is easy to see the problem when batman-adv is trying to start
  together with other networking components.
- fix the routing protocol forwarding policy by enhancing the duplicate control
  packet detection. When the right circumstances trigger the issue, some nodes in
  the network become totally unreachable, so breaking the mesh connectivity.
- fix the Bridge Loop Avoidance component by not running the originator address
  change handling routine when the component is disabled. The routine was
  generating useless packets that were sent over the network.

----------------------------------------------------------------
Matthias Schiffer (1):
      batman-adv: wait for rtnl in batadv_store_mesh_iface instead of failing if it is taken

Simon Wunderlich (2):
      batman-adv: forward late OGMs from best next hop
      batman-adv: Don't handle address updates when bla is disabled

 net/batman-adv/bat_iv_ogm.c            | 86 ++++++++++++++++++++++------------
 net/batman-adv/bridge_loop_avoidance.c |  4 ++
 net/batman-adv/sysfs.c                 |  5 +-
 3 files changed, 60 insertions(+), 35 deletions(-)
  

Comments

Antonio Quartulli June 11, 2013, 8:07 a.m. UTC | #1
Hello David,

On Tue, Jun 11, 2013 at 08:34:58AM +0200, Antonio Quartulli wrote:

[...]

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

After having applied this patchset the merge of net into net-next will generate
a conflict. Here you have the needed information to properly solve it.

Regards,



conflict in net/batman-adv/bat_iv_ogm.c:

++<<<<<<< HEAD
 + * batadv_ring_buffer_set - update the ring buffer with the given value
 + * @lq_recv: pointer to the ring buffer
 + * @lq_index: index to store the value at
 + * @value: value to store in the ring buffer
 + */
 +static void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
 +				   uint8_t value)
 +{
 +	lq_recv[*lq_index] = value;
 +	*lq_index = (*lq_index + 1) % BATADV_TQ_GLOBAL_WINDOW_SIZE;
 +}
 +
 +/**
 + * batadv_ring_buffer_set - compute the average of all non-zero values stored
 + * in the given ring buffer
 + * @lq_recv: pointer to the ring buffer
 + *
 + * Returns computed average value.
 + */
 +static uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
 +{
 +	const uint8_t *ptr;
 +	uint16_t count = 0, i = 0, sum = 0;
 +
 +	ptr = lq_recv;
 +
 +	while (i < BATADV_TQ_GLOBAL_WINDOW_SIZE) {
 +		if (*ptr != 0) {
 +			count++;
 +			sum += *ptr;
 +		}
 +
 +		i++;
 +		ptr++;
 +	}
 +
 +	if (count == 0)
 +		return 0;
 +
 +	return (uint8_t)(sum / count);
 +}
++=======
+  * batadv_dup_status - duplicate status
+  * @BATADV_NO_DUP: the packet is a duplicate
+  * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the
+  *  neighbor)
+  * @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor
+  * @BATADV_PROTECTED: originator is currently protected (after reboot)
+  */
+ enum batadv_dup_status {
+ 	BATADV_NO_DUP = 0,
+ 	BATADV_ORIG_DUP,
+ 	BATADV_NEIGH_DUP,
+ 	BATADV_PROTECTED,
+ };
+ 
++>>>>>>> 7c24bbb... batman-adv: forward late OGMs from best next hop

is solved as follows (add /** at the top of the batadv_dup_status kerneldoc and
keep everything):

<<<<<<<<<<<<
 * batadv_ring_buffer_set - update the ring buffer with the given value
 * @lq_recv: pointer to the ring buffer
 * @lq_index: index to store the value at
 * @value: value to store in the ring buffer
 */
static void batadv_ring_buffer_set(uint8_t lq_recv[], uint8_t *lq_index,
				   uint8_t value)
{
	lq_recv[*lq_index] = value;
	*lq_index = (*lq_index + 1) % BATADV_TQ_GLOBAL_WINDOW_SIZE;
}

/**
 * batadv_ring_buffer_set - compute the average of all non-zero values stored
 * in the given ring buffer
 * @lq_recv: pointer to the ring buffer
 *
 * Returns computed average value.
 */
static uint8_t batadv_ring_buffer_avg(const uint8_t lq_recv[])
{
	const uint8_t *ptr;
	uint16_t count = 0, i = 0, sum = 0;

	ptr = lq_recv;

	while (i < BATADV_TQ_GLOBAL_WINDOW_SIZE) {
		if (*ptr != 0) {
			count++;
			sum += *ptr;
		}

		i++;
		ptr++;
	}

	if (count == 0)
		return 0;

	return (uint8_t)(sum / count);
}

/**
 * batadv_dup_status - duplicate status
 * @BATADV_NO_DUP: the packet is a duplicate
 * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the
 *  neighbor)
 * @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor
 * @BATADV_PROTECTED: originator is currently protected (after reboot)
 */
enum batadv_dup_status {
	BATADV_NO_DUP = 0,
	BATADV_ORIG_DUP,
	BATADV_NEIGH_DUP,
	BATADV_PROTECTED,
};

>>>>>>>>>>>>>>
  
Antonio Quartulli June 11, 2013, 2:17 p.m. UTC | #2
On Tue, Jun 11, 2013 at 03:09:30PM +0100, Ben Hutchings wrote:
> On Tue, 2013-06-11 at 08:34 +0200, Antonio Quartulli wrote:
> > From: Matthias Schiffer <mschiffer@universe-factory.net>
> > 
> > The rtnl_lock in batadv_store_mesh_iface has been converted to a rtnl_trylock
> > some time ago to avoid a possible deadlock between rtnl and s_active on removal
> > of the sysfs nodes.
> > 
> > The behaviour introduced by that was quite confusing as it could lead to the
> > sysfs store to fail, making batman-adv setup scripts unreliable.
> 
> I think what you actually wanted was ERESTARTNOINTR.  But the real
> problem is that neither of these error codes is valid unless the system
> call is aborted due to a signal.

Well, it should have been handled differently from the beginning..the other
problem was that ERESTARTSYS was propagated to userspace while this is not
supposed to happen.

However, with this patch the initialisation does not fail anymore. So we don't
need to care about the error code anymore :-)

Cheers,
  
David Miller June 13, 2013, 8:27 a.m. UTC | #3
From: Antonio Quartulli <ordex@autistici.org>
Date: Tue, 11 Jun 2013 08:34:58 +0200

> here you have three patches intended for net/linux-3.10.

Pulled, thanks Antonio.