Hi,
since my last patches did not trigger too many complaints I went ahead and
submitted them. This opens the way for the last series of patches which
conclude the matter. All remaining /proc files have been eliminated and moved
over to /sys. While doing so, I reworked the interface handling to satisfy an
old feature request: interfaces can be added & removed on the fly.
On startup batman-adv will scan the system for available interfaces to create
a "batman_adv" subfolder in their respective /sys/class/net folder, e.g.
eth0: /sys/class/net/eth0/batman_adv
This subfolder will contain the settings which are relevant for this
interface. You can tell batman-adv to use an interface by writing "bat0" into
the mesh_iface file:
echo bat0 > /sys/class/net/eth0/batman_adv/mesh_iface
or write "none" to deactivate it:
echo none > /sys/class/net/eth0/batman_adv/mesh_iface
Although only "bat0" is accepted at this point, the syntax already gears
towards multiple virtual mesh support. Later you will be able to create/name
your virtual meshes by writing into this file. Retrieve the interface status by
simply reading its status file:
cat /sys/class/net/eth0/batman_adv/iface_status
Note: batman-adv will continuously observe the system's interfaces. Whenever
new interfaces appear or disappear batman will update the /sys/class/net
folders automatically. Also, batman-adv will make sure that incompatible
interfaces (e.g. loopback, non-ethernet, etc) won't have the subfolder, hence
can't be activated.
The batctl interface syntax had to be modified in order to cope with these
changes. You can run:
batctl interface
to get the list of active interfaces and their status. To add or delete
interfaces you can run:
batctl interface add|del eth0 eth1 ..
Since removing an active interface is a tricky thing where many operations can
go wrong I expect some crashes/race conditions in the code. I tested it a
while on multiple machines with multiple interfaces and it works for me but
I'm sure there are more bugs to find.
Regards,
Marek