[2/2] batctl: Drop incorrect check for existing meshif directory

Message ID 20181207214629.30307-2-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 8c5a028cb509349c639cd2adffc7858d50855d32
Delegated to: Simon Wunderlich
Headers
Series [1/2] batctl: Remove check of compiled_out files |

Commit Message

Sven Eckelmann Dec. 7, 2018, 9:46 p.m. UTC
  The (not silenced) read_file/write_file functions will check whether the
directory of a file exists. This is used to determine whether the mesh
interface was created. In that case, it will print:

  Error - mesh has not been enabled yet
  Activate your mesh by adding interfaces to batman-adv

This is most of the time wrong because only a limited number of commands
will call these function:

* gw_mode
* log
* loglevel
* routing_algo
* backbonetable
* claimtable
* dat_cache
* gateways
* mcast_flags
* nc_nodes
* neighbors
* originators
* transglobal
* translocal

Beside routing_algo, every command is marked as COMMAND_FLAG_MESH_IFACE and
therefore already requested a check to make sure that the specified meshif
existed at some point.

This message is especially confusing because debugfs can be disabled in
batman-adv. If it was compiled without debugfs and the user tries to still
use `batctl log`, the log command will fail with an incorrect error message
instead of showing a more detailed (and more correct):

  Error - can't open file '/sys/kernel/debug//batman_adv/bat0/log': No such file or directory
  The option you called seems not to be compiled into your batman-adv kernel module.
  Consult the README if you wish to learn more about compiling options into batman-adv.

And for routing_algo, the problem of the missing batman-adv module should
already be catched when the batman-adv module version path is checked.

Reported-by: Andre Kasper <andre.kasper@gmx.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 functions.c | 6 ------
 1 file changed, 6 deletions(-)
  

Patch

diff --git a/functions.c b/functions.c
index 9a130e1..9d64c62 100644
--- a/functions.c
+++ b/functions.c
@@ -149,12 +149,6 @@  static void file_open_problem_dbg(const char *dir, const char *full_path)
 		return;
 	}
 
-	if (!file_exists(dir)) {
-		fprintf(stderr, "Error - mesh has not been enabled yet\n");
-		fprintf(stderr, "Activate your mesh by adding interfaces to batman-adv\n");
-		return;
-	}
-
 	fprintf(stderr, "Error - can't open file '%s': %s\n", full_path, strerror(errno));
 	fprintf(stderr, "The option you called seems not to be compiled into your batman-adv kernel module.\n");
 	fprintf(stderr, "Consult the README if you wish to learn more about compiling options into batman-adv.\n");