b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] batman-adv: Fix hang up with small MTU hard-interface
@ 2022-08-20  3:25 Shigeru Yoshida
  2022-09-07 16:00 ` Shigeru Yoshida
  0 siblings, 1 reply; 4+ messages in thread
From: Shigeru Yoshida @ 2022-08-20  3:25 UTC (permalink / raw)
  To: mareklindner, sw, a, sven; +Cc: b.a.t.m.a.n, linux-kernel, Shigeru Yoshida

The system hangs up when batman-adv soft-interface is created on
hard-interface with small MTU.  For example, the following commands
create batman-adv soft-interface on dummy interface with zero MTU:

  # ip link add name dummy0 type dummy
  # ip link set mtu 0 dev dummy0
  # ip link set up dev dummy0
  # ip link add name bat0 type batadv
  # ip link set dev dummy0 master bat0

These commands cause the system hang up with the following messages:

  [   90.578925][ T6689] batman_adv: bat0: Adding interface: dummy0
  [   90.580884][ T6689] batman_adv: bat0: The MTU of interface dummy0 is too small (0) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
  [   90.586264][ T6689] batman_adv: bat0: Interface activated: dummy0
  [   90.590061][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320)
  [   90.595517][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320)
  [   90.598499][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320)

This patch fixes this issue by returning error when enabling
hard-interface with small MTU size.

Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
 net/batman-adv/hard-interface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index b8f8da7ee3de..dce5557800e9 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -700,6 +700,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	int max_header_len = batadv_max_header_len();
 	int ret;
 
+	if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len)
+		return -EINVAL;
+
 	if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
 		goto out;
 
-- 
2.37.2


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

* Re: [PATCH] batman-adv: Fix hang up with small MTU hard-interface
  2022-08-20  3:25 [PATCH] batman-adv: Fix hang up with small MTU hard-interface Shigeru Yoshida
@ 2022-09-07 16:00 ` Shigeru Yoshida
  2022-09-07 16:04   ` Sven Eckelmann
  0 siblings, 1 reply; 4+ messages in thread
From: Shigeru Yoshida @ 2022-09-07 16:00 UTC (permalink / raw)
  To: mareklindner, sw, a, sven; +Cc: b.a.t.m.a.n, linux-kernel, syoshida

ping?

On Sat, 20 Aug 2022 12:25:16 +0900, Shigeru Yoshida wrote:
> The system hangs up when batman-adv soft-interface is created on
> hard-interface with small MTU.  For example, the following commands
> create batman-adv soft-interface on dummy interface with zero MTU:
> 
>   # ip link add name dummy0 type dummy
>   # ip link set mtu 0 dev dummy0
>   # ip link set up dev dummy0
>   # ip link add name bat0 type batadv
>   # ip link set dev dummy0 master bat0
> 
> These commands cause the system hang up with the following messages:
> 
>   [   90.578925][ T6689] batman_adv: bat0: Adding interface: dummy0
>   [   90.580884][ T6689] batman_adv: bat0: The MTU of interface dummy0 is too small (0) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
>   [   90.586264][ T6689] batman_adv: bat0: Interface activated: dummy0
>   [   90.590061][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320)
>   [   90.595517][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320)
>   [   90.598499][ T6689] batman_adv: bat0: Forced to purge local tt entries to fit new maximum fragment MTU (-320)
> 
> This patch fixes this issue by returning error when enabling
> hard-interface with small MTU size.
> 
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> ---
>  net/batman-adv/hard-interface.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
> index b8f8da7ee3de..dce5557800e9 100644
> --- a/net/batman-adv/hard-interface.c
> +++ b/net/batman-adv/hard-interface.c
> @@ -700,6 +700,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
>  	int max_header_len = batadv_max_header_len();
>  	int ret;
>  
> +	if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len)
> +		return -EINVAL;
> +
>  	if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
>  		goto out;
>  
> -- 
> 2.37.2
> 


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

* Re: [PATCH] batman-adv: Fix hang up with small MTU hard-interface
  2022-09-07 16:00 ` Shigeru Yoshida
@ 2022-09-07 16:04   ` Sven Eckelmann
  2022-09-07 16:25     ` [PATCH] batman-adv: Fix hang up with small MTU hard-interface,Re: " Shigeru Yoshida
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2022-09-07 16:04 UTC (permalink / raw)
  To: mareklindner, sw, a, Shigeru Yoshida; +Cc: b.a.t.m.a.n, linux-kernel, syoshida

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

On Wednesday, 7 September 2022 18:00:37 CEST Shigeru Yoshida wrote:
> ping?

This was applied a while ago:

https://git.open-mesh.org/linux-merge.git/commit/b1cb8a71f1eaec4eb77051590f7f561f25b15e32

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] batman-adv: Fix hang up with small MTU hard-interface,Re: [PATCH] batman-adv: Fix hang up with small MTU hard-interface
  2022-09-07 16:04   ` Sven Eckelmann
@ 2022-09-07 16:25     ` Shigeru Yoshida
  0 siblings, 0 replies; 4+ messages in thread
From: Shigeru Yoshida @ 2022-09-07 16:25 UTC (permalink / raw)
  To: sven; +Cc: mareklindner, sw, a, b.a.t.m.a.n, linux-kernel

Hi Sven,

On Wed, 07 Sep 2022 18:04:09 +0200,Wed, 07 Sep 2022 18:04:09 +0200, Sven Eckelmann wrote:
> On Wednesday, 7 September 2022 18:00:37 CEST Shigeru Yoshida wrote:
>> ping?
> 
> This was applied a while ago:
> 
> https://git.open-mesh.org/linux-merge.git/commit/b1cb8a71f1eaec4eb77051590f7f561f25b15e32

Sorry, I didn't notice that.  Thank you so much!!

Thanks,
Shigeru

> 
> Kind regards,
> 	Sven


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

end of thread, other threads:[~2022-09-07 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-20  3:25 [PATCH] batman-adv: Fix hang up with small MTU hard-interface Shigeru Yoshida
2022-09-07 16:00 ` Shigeru Yoshida
2022-09-07 16:04   ` Sven Eckelmann
2022-09-07 16:25     ` [PATCH] batman-adv: Fix hang up with small MTU hard-interface,Re: " Shigeru Yoshida

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).