b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] batctl: Don't stop when create_interface detected existing interface
@ 2021-01-15 22:38 Sven Eckelmann
  0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2021-01-15 22:38 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann

"batctl meshif bat0 interface add ..." should never be called in parallel.
But when something still does this, it could be that the code first detects
the missing meshif and then tries to create it - which fails when another
process requested the creation of the same interface slightly before batctl
did it.

But this should not prevent batctl to add the lower interface to the
meshif. It is not really important that the batctl process was the one
which created it - only that it exists is important.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/interface.c b/interface.c
index 77ca1a0..7f77459 100644
--- a/interface.c
+++ b/interface.c
@@ -526,7 +526,7 @@ static int interface(struct state *state, int argc, char **argv)
 	ifmaster = if_nametoindex(state->mesh_iface);
 	if (!manual_mode && !ifmaster && rest_argv[0][0] == 'a') {
 		ret = create_interface(state->mesh_iface, &create_params);
-		if (ret < 0) {
+		if (ret < 0 && ret != -EEXIST) {
 			fprintf(stderr,
 				"Error - failed to create batman-adv interface: %s\n",
 				strerror(-ret));
-- 
2.29.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-15 22:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 22:38 [PATCH] batctl: Don't stop when create_interface detected existing interface Sven Eckelmann

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