Hi,
the sysfs file mesh_iface to add/remove interfaces to/from a batman-adv soft-interface was downgraded in batman-adv master to a second-class citizen. This was done because it has conceptional problems (for example locking of sysfs vs. locking of the network core code). The only direct way to modify interfaces is rtnetlink which is used by different tools like iproute2 (ip link, ip addr, ...) or netifd. sysfs still exists but has to use workers which delay the actual add/del to a later point.
This patchset now moves batctl to rtnetlink instead of the sysfs-file mesh_iface. This should work fine since this is supported by batman-adv (in Linux) since Linux v3.10 (batman-adv v2013.2).
This patchset also introduces two new interface subcommands called "new" and "destroy". "new" can be used to create a batman-adv interface without any interface attached. This is helpful when the interfaces should be configured independently of the first attached interface. The command "destroy" can be used to destroy a batman-adv interface without going through all attached interfaces and delete them manually.
It is now also possible to tell batctl to not automatically create a batman-adv interface when an interface is attached. But more important is this option to disable the automatic removal of a batman-adv interface when all attached interfaces were removed. This is useful when a number of interfaces should be added/removed without accidentally loosing the current configuration of the interface. Of course, we should also accept the related patch for batman-adv [1].
I've also added two patches with some minor cleanup because it was dealing with code in the same file with similar context.
This patchset is build on top of the netlink patchset currently waiting to be applied.
Kind regards, Sven
[1] https://patchwork.open-mesh.org/patch/16499/
Sven Eckelmann (7): batctl: Use rtnl to query list of softif devices batctl: Add command to create/destroy batman-adv interface batctl: Use rtnl to add/remove interfaces batctl: Parse interface arguments relative to last parsed option batctl: Allow to disable automatic interface new/destroy batctl: Move interface command to extra file batctl: Move check_mesh_iface* to functions.c
Makefile | 1 + functions.c | 181 +++++++++++++++++++++++ functions.h | 10 +- interface.c | 457 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ interface.h | 29 ++++ main.c | 1 + man/batctl.8 | 7 +- sys.c | 215 +--------------------------- sys.h | 3 - 9 files changed, 690 insertions(+), 214 deletions(-) create mode 100644 interface.c create mode 100644 interface.h