batman-adv: 2014.0.0 updated stability fixes
[feed/routing.git] / batman-adv / patches / 0003-batman-adv-fix-soft-interface-MTU-computation.patch
1 From 2b108ccd0533e1375e44c73ec58c69dde9a71687 Mon Sep 17 00:00:00 2001
2 From: Antonio Quartulli <antonio@meshcoding.com>
3 Date: Tue, 21 Jan 2014 11:22:05 +0100
4 Subject: [PATCH 3/5] batman-adv: fix soft-interface MTU computation
5
6 The current MTU computation always returns a value
7 smaller than 1500bytes even if the real interfaces
8 have an MTU large enough to compensate the batman-adv
9 overhead.
10
11 Fix the computation by properly returning the highest
12 admitted value.
13
14 Introduced by f7f2fe494388fca828094a4ebdab918a7b2d64f8
15 ("batman-adv: limit local translation table max size")
16
17 Reported-by: Russell Senior <russell@personaltelco.net>
18 Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
19 Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
20 ---
21 hard-interface.c | 22 ++++++++++++++--------
22 1 file changed, 14 insertions(+), 8 deletions(-)
23
24 diff --git a/hard-interface.c b/hard-interface.c
25 index 6792e03..0eb0b3b 100644
26 --- a/hard-interface.c
27 +++ b/hard-interface.c
28 @@ -244,7 +244,7 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
29 {
30 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
31 const struct batadv_hard_iface *hard_iface;
32 - int min_mtu = ETH_DATA_LEN;
33 + int min_mtu = INT_MAX;
34
35 rcu_read_lock();
36 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
37 @@ -259,8 +259,6 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
38 }
39 rcu_read_unlock();
40
41 - atomic_set(&bat_priv->packet_size_max, min_mtu);
42 -
43 if (atomic_read(&bat_priv->fragmentation) == 0)
44 goto out;
45
46 @@ -271,13 +269,21 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
47 min_mtu = min_t(int, min_mtu, BATADV_FRAG_MAX_FRAG_SIZE);
48 min_mtu -= sizeof(struct batadv_frag_packet);
49 min_mtu *= BATADV_FRAG_MAX_FRAGMENTS;
50 - atomic_set(&bat_priv->packet_size_max, min_mtu);
51 -
52 - /* with fragmentation enabled we can fragment external packets easily */
53 - min_mtu = min_t(int, min_mtu, ETH_DATA_LEN);
54
55 out:
56 - return min_mtu - batadv_max_header_len();
57 + /* report to the other components the maximum amount of bytes that
58 + * batman-adv can send over the wire (without considering the payload
59 + * overhead). For example, this value is used by TT to compute the
60 + * maximum local table table size
61 + */
62 + atomic_set(&bat_priv->packet_size_max, min_mtu);
63 +
64 + /* the real soft-interface MTU is computed by removing the payload
65 + * overhead from the maximum amount of bytes that was just computed.
66 + *
67 + * However batman-adv does not support MTUs bigger than ETH_DATA_LEN
68 + */
69 + return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);
70 }
71
72 /* adjusts the MTU if a new interface with a smaller MTU appeared. */
73 --
74 1.8.5.3
75