From 483d7fb66c5b122176a4b23aed05bab6d1432ab5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 21:29:52 +0200 Subject: [PATCH] gluon-mesh-vpn-fastd: generate fastd config from site configuration --- gluon/gluon-mesh-vpn-fastd/Makefile | 4 +- gluon/gluon-mesh-vpn-fastd/fastd.pl | 59 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 gluon/gluon-mesh-vpn-fastd/fastd.pl diff --git a/gluon/gluon-mesh-vpn-fastd/Makefile b/gluon/gluon-mesh-vpn-fastd/Makefile index 777cb02..d232268 100644 --- a/gluon/gluon-mesh-vpn-fastd/Makefile +++ b/gluon/gluon-mesh-vpn-fastd/Makefile @@ -27,10 +27,12 @@ define Build/Configure endef define Build/Compile + $(GLUON_CONFIGURE) fastd.pl > $(PKG_BUILD_DIR)/fastd.sh endef define Package/gluon-mesh-vpn-fastd/install - $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant + $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef $(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) diff --git a/gluon/gluon-mesh-vpn-fastd/fastd.pl b/gluon/gluon-mesh-vpn-fastd/fastd.pl new file mode 100644 index 0000000..85bc7e2 --- /dev/null +++ b/gluon/gluon-mesh-vpn-fastd/fastd.pl @@ -0,0 +1,59 @@ +my $cfg = $CONFIG->{fastd_mesh_vpn}; +my $backbone = $cfg->{backbone}; + +my $add_methods = ''; +for (@{$cfg->{methods}}) { + $add_methods .= "add_list fastd.mesh_vpn.method='$_'\n"; +} + +my $set_peer_limit; +if ($backbone->{limit}) { + $set_peer_limit = "set fastd.mesh_vpn_backbone.peer_limit='$backbone->{limit}'\n"; +} +else { + $set_peer_limit = "delete fastd.mesh_vpn_backbone.peer_limit\n"; +} + +print <{peers}}) { + my $peer = $backbone->{peers}->{$name}; + print <{remotes}}) { + print "add_list fastd.mesh_vpn_backbone_peer_$name.remote='$_'\n"; + } +} + +print <