From 7c45e7740f1bcb2cf6ad68d5099d45d98b663847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Fri, 20 May 2022 09:55:12 +0200 Subject: [PATCH] ddhcpd-nextnode: init --- package/ddhcpd-nextnode/Makefile | 19 +++++++++++++++++ package/ddhcpd-nextnode/check_site.lua | 1 + .../gluon/upgrade/500-ddhcpd-option-nextnode | 21 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 package/ddhcpd-nextnode/Makefile create mode 100644 package/ddhcpd-nextnode/check_site.lua create mode 100755 package/ddhcpd-nextnode/luasrc/lib/gluon/upgrade/500-ddhcpd-option-nextnode diff --git a/package/ddhcpd-nextnode/Makefile b/package/ddhcpd-nextnode/Makefile new file mode 100644 index 00000000..ecb5fe83 --- /dev/null +++ b/package/ddhcpd-nextnode/Makefile @@ -0,0 +1,19 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=ddhcpd-nextnode +PKG_RELEASE:=1 + +include ../gluon.mk + +define Package/ddhcpd-nextnode + SECTION:=net + CATEGORY:=Network + DEPENDS:=+ddhcpd + TITLE:=ddhcpd nextnode integration +endef + +define Package/ddhcpd-nextnode/description + nextnode integration for ddhcpd +endef + +$(eval $(call BuildPackage,ddhcpd-nextnode)) diff --git a/package/ddhcpd-nextnode/check_site.lua b/package/ddhcpd-nextnode/check_site.lua new file mode 100644 index 00000000..b26ac216 --- /dev/null +++ b/package/ddhcpd-nextnode/check_site.lua @@ -0,0 +1 @@ +need_string_match(in_domain({'next_node', 'ip4'}), '^%d+.%d+.%d+.%d+$') diff --git a/package/ddhcpd-nextnode/luasrc/lib/gluon/upgrade/500-ddhcpd-option-nextnode b/package/ddhcpd-nextnode/luasrc/lib/gluon/upgrade/500-ddhcpd-option-nextnode new file mode 100755 index 00000000..bea3d765 --- /dev/null +++ b/package/ddhcpd-nextnode/luasrc/lib/gluon/upgrade/500-ddhcpd-option-nextnode @@ -0,0 +1,21 @@ +#!/usr/bin/lua + +local uci = require('simple-uci').cursor() +local site = require "gluon.site" + +local payload = site.next_node.ip4() +local len = 4 -- this has to be 4 + +uci:section('ddhcpd', 'dhcp_option', 'nextnode_router', { + len = len, + payload = payload, + code = '3', +}) + +uci:section('ddhcpd', 'dhcp_option', 'nextnode_dns', { + len = len, + payload = payload, + code = '6', +}) + +uci:save('ddhcpd')