From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <antonio@meshcoding.com>,
Marek Lindner <mareklindner@neomailbox.ch>
Subject: [PATCH 01/10] batman-adv: fix soft-interface MTU computation
Date: Mon, 17 Feb 2014 21:48:40 +0100 [thread overview]
Message-ID: <1392670129-2498-2-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1392670129-2498-1-git-send-email-antonio@meshcoding.com>
The current MTU computation always returns a value
smaller than 1500bytes even if the real interfaces
have an MTU large enough to compensate the batman-adv
overhead.
Fix the computation by properly returning the highest
admitted value.
Introduced by a19d3d85e1b854e4a483a55d740a42458085560d
("batman-adv: limit local translation table max size")
Reported-by: Russell Senior <russell@personaltelco.net>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
---
net/batman-adv/hard-interface.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 3d417d3..b851cc5 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -241,7 +241,7 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
{
struct batadv_priv *bat_priv = netdev_priv(soft_iface);
const struct batadv_hard_iface *hard_iface;
- int min_mtu = ETH_DATA_LEN;
+ int min_mtu = INT_MAX;
rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
@@ -256,8 +256,6 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
}
rcu_read_unlock();
- atomic_set(&bat_priv->packet_size_max, min_mtu);
-
if (atomic_read(&bat_priv->fragmentation) == 0)
goto out;
@@ -268,13 +266,21 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
min_mtu = min_t(int, min_mtu, BATADV_FRAG_MAX_FRAG_SIZE);
min_mtu -= sizeof(struct batadv_frag_packet);
min_mtu *= BATADV_FRAG_MAX_FRAGMENTS;
- atomic_set(&bat_priv->packet_size_max, min_mtu);
-
- /* with fragmentation enabled we can fragment external packets easily */
- min_mtu = min_t(int, min_mtu, ETH_DATA_LEN);
out:
- return min_mtu - batadv_max_header_len();
+ /* report to the other components the maximum amount of bytes that
+ * batman-adv can send over the wire (without considering the payload
+ * overhead). For example, this value is used by TT to compute the
+ * maximum local table table size
+ */
+ atomic_set(&bat_priv->packet_size_max, min_mtu);
+
+ /* the real soft-interface MTU is computed by removing the payload
+ * overhead from the maximum amount of bytes that was just computed.
+ *
+ * However batman-adv does not support MTUs bigger than ETH_DATA_LEN
+ */
+ return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);
}
/* adjusts the MTU if a new interface with a smaller MTU appeared. */
--
1.8.5.3
next prev parent reply other threads:[~2014-02-17 20:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 20:48 [PATCH 00/10] pull request net: batman-adv 2014-02-17 Antonio Quartulli
2014-02-17 20:48 ` Antonio Quartulli [this message]
2014-02-17 21:13 ` [PATCH 01/10] batman-adv: fix soft-interface MTU computation David Miller
2014-02-18 6:44 ` [B.A.T.M.A.N.] " Antonio Quartulli
2014-02-18 18:22 ` David Miller
2014-02-18 20:41 ` David Miller
2014-02-18 20:57 ` Antonio Quartulli
2014-02-17 20:48 ` [PATCH 02/10] batman-adv: fix TT-TVLV parsing on OGM reception Antonio Quartulli
2014-02-17 20:48 ` [PATCH 03/10] batman-adv: release vlan object after checking the CRC Antonio Quartulli
2014-02-17 20:48 ` [PATCH 04/10] batman-adv: properly check pskb_may_pull return value Antonio Quartulli
2014-02-17 20:48 ` [PATCH 05/10] batman-adv: avoid potential race condition when adding a new neighbour Antonio Quartulli
2014-02-17 20:48 ` [PATCH 06/10] batman-adv: fix potential orig_node reference leak Antonio Quartulli
2014-02-17 20:48 ` [PATCH 07/10] batman-adv: fix TT CRC computation by ensuring byte order Antonio Quartulli
2014-02-17 20:48 ` [PATCH 08/10] batman-adv: free skb on TVLV parsing success Antonio Quartulli
2014-02-17 20:48 ` [PATCH 09/10] batman-adv: avoid double free when orig_node initialization fails Antonio Quartulli
[not found] ` <1392670129-2498-1-git-send-email-antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
2014-02-17 20:48 ` [PATCH 10/10] batman-adv: fix potential kernel paging error for unicast transmissions Antonio Quartulli
2014-02-21 7:47 ` [PATCH 00/10] pull request net: batman-adv 2014-02-17 Antonio Quartulli
2014-02-25 20:36 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392670129-2498-2-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).