Set gateway mode automatically #18

Merged
pranav merged 23 commits from gateway into master 2021-10-09 11:57:53 +02:00
5 changed files with 19 additions and 4 deletions
Showing only changes of commit 761618aff4 - Show all commits

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)