added new args and config options

This will allow changing name of batman and bridge interface.
But deleting them after stopping naxalnet will not work at the moment.
This commit is contained in:
Pranav Jerry 2021-09-27 11:27:44 +05:30
parent 798cd3e988
commit 761618aff4
Signed by: pranav
GPG Key ID: F1DCDC4FED0A0C5B
5 changed files with 19 additions and 4 deletions

View File

@ -11,6 +11,10 @@ confdir = /usr/share/naxalnet/networkd
# See man:systemd.network(5)
runtimedir = /run/systemd/network
[device]
batman=bat0
bridge=bridge0
[adhoc]
# All your nodes should have the same name
name = NxMesh
@ -20,4 +24,3 @@ name = NxMesh
ssid = MeshWiFi
# Note the spelling. It's passwd, not password.
passwd = naxalnet256

View File

@ -35,4 +35,4 @@ See README.md for documentation.
#
# In case you forgot to change the version, skip the number
# and put the next number in the next commit.
__version__ = "0.4.0a5"
__version__ = "0.4.0a5.dev1"

View File

@ -158,6 +158,18 @@ def parse_args() -> Namespace:
help="send log messages to systemd journal",
)
parser.add_argument(
"--batman-device",
default=config["device"]["batman"],
help="name of interface used by batman-adv",
)
parser.add_argument(
"--bridge-device",
default=config["device"]["bridge"],
help="name of bridge interface",
)
parser.add_argument(
"--version",
"-V",

View File

@ -31,6 +31,7 @@ CONFIG = {
"confdir": "/usr/share/naxalnet/networkd",
"runtimedir": "/run/systemd/network",
},
"device": {"batman": "bat0", "bridge": "bridge0"},
"adhoc": {"name": "NxMesh"},
"ap": {"ssid": "MeshWiFi", "passwd": "naxalnet256"},
}

View File

@ -64,8 +64,7 @@ def setup_mesh():
dest.mkdir(parents=True, exist_ok=True)
networkd = NetworkD(runtime_dir=args.networkd_runtime_dir)
# TODO: replace with valus from args
networkd.set_vars(batdev="bat0", bridgedev="bridge0")
networkd.set_vars(batdev=args.batman_device, bridgedev=args.bridge_device)
for i in get_sorted_glob(args.networkd_config_dir, MESH_GLOB):
logger.debug("Adding network config %s", i)
networkd.add_config(i)