blob: 984acac76e24eebbb0374fdcfe9788f31f3042cf [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001SUMMARY = "An IP address pool manager"
2DESCRIPTION = "IpPool is implemented as a separate server daemon \
3to allow any application to use its address pools. This makes it possible \
4to define address pools that are shared by PPP, L2TP, PPTP etc. It may be \
5useful in some VPN server setups. IpPool comes with a command line \
6management application, ippoolconfig to manage and query address pool \
7status. A pppd plugin is supplied which allows pppd to request IP \
8addresses from ippoold. \
9"
10HOMEPAGE = "http://www.openl2tp.org/"
11SECTION = "console/network"
Andrew Geissler9aee5002022-03-30 16:27:02 +000012LICENSE = "GPL-2.0-or-later"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013
14SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
15 file://runtest.sh \
16 file://ippool.service \
17 file://ippool_usl_timer.patch \
18 file://ippool_parallel_make_and_pic.patch \
19 file://ippool_init.d.patch \
20 file://always_syslog.patch \
21 file://makefile-add-ldflags.patch \
22 file://0001-usl_timer-Check-for-return-value-of-write-API.patch \
23 file://0001-Respect-flags-from-env.patch \
24 file://0001-read-returns-ssize_t.patch \
25 file://0002-Mark-first-element-of-a-string-as-null.patch \
26 file://0003-cli-Mark-return-of-strtol-as-long-int.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 file://0002-link-with-libtirpc.patch \
28 file://0003-musl-fixes.patch \
Brad Bishope42b3e32020-01-15 22:08:42 -050029 file://strncpy-truncation.patch \
Andrew Geissler87f5cff2022-09-30 13:13:31 -050030 file://0001-pppd-ippool.c-Fix-type-casting-issues-between-in_add.patch \
31 file://0002-ippool_rpc_server.c-Add-missing-prototype-for-ippool.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050032 "
33
34LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"
35SRC_URI[md5sum] = "e2401e65db26a3764585b97212888fae"
36SRC_URI[sha256sum] = "d3eab7d6cad5da8ccc9d1e31d5303e27a39622c07bdb8fa3618eea314412075b"
37
38inherit systemd
39
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040DEPENDS = "readline ppp ncurses gzip-native rpcsvc-proto-native libtirpc"
Patrick Williams213cb262021-08-07 19:21:33 -050041RDEPENDS:${PN} = "rpcbind"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050042
43EXTRA_OEMAKE = "CC='${CC}' AS='${AS}' LD='${LD}' AR='${AR}' NM='${NM}' STRIP='${STRIP}'"
44EXTRA_OEMAKE += "PPPD_VERSION=${PPPD_VERSION} SYS_LIBDIR=${libdir}"
45# enable self tests
46EXTRA_OEMAKE += "IPPOOL_TEST=y"
47
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080048CPPFLAGS += "${SELECTED_OPTIMIZATION} -I${STAGING_INCDIR}/tirpc"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050049
Patrick Williams213cb262021-08-07 19:21:33 -050050SYSTEMD_SERVICE:${PN} = "ippool.service"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050051SYSTEMD_AUTO_ENABLE = "disable"
52
53
Patrick Williams213cb262021-08-07 19:21:33 -050054do_compile:prepend() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055 # fix the CFLAGS= and CPPFLAGS= in main Makefile, to have the extra CFLAGS in env
56 sed -i -e "s/^CFLAGS=/CFLAGS+=/" ${S}/Makefile
57 sed -i -e "s/^CPPFLAGS=/CPPFLAGS+=/" ${S}/Makefile
58
59 sed -i -e "s:-I/usr/include/pppd:-I=/usr/include/pppd:" ${S}/pppd/Makefile
60
61}
62
63
64do_install() {
65 oe_runmake DESTDIR=${D} install
66
67 install -D -m 0755 ${S}/debian/init.d ${D}${sysconfdir}/init.d/ippoold
68 install -D -m 0644 ${WORKDIR}/ippool.service ${D}${systemd_system_unitdir}/ippool.service
69 sed -i -e 's:@SBINDIR@:${sbindir}:g' ${D}${systemd_system_unitdir}/ippool.service
70
71 # install self test
72 install -d ${D}/opt/${BPN}
73 install ${S}/test/all.tcl ${S}/test/ippool.test \
74 ${S}/test/test_procs.tcl ${D}/opt/${BPN}
75 install ${WORKDIR}/runtest.sh ${D}/opt/${BPN}
76 # fix the ../ippoolconfig in test_procs.tcl
77 sed -i -e "s:../ippoolconfig:ippoolconfig:" \
78 ${D}/opt/${BPN}/test_procs.tcl
79}
80
81
82PACKAGES =+ "${PN}-test"
83
Patrick Williams213cb262021-08-07 19:21:33 -050084FILES:${PN} += "${libdir}/pppd/${PPPD_VERSION}/ippool.so"
85FILES:${PN}-dbg += "${libdir}/pppd/${PPPD_VERSION}/.debug/ippool.so"
86FILES:${PN}-test = "/opt/${BPN}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050087
88# needs tcl to run tests
Patrick Williams213cb262021-08-07 19:21:33 -050089RDEPENDS:${PN}-test += "tcl ${BPN}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050090
91PPPD_VERSION="${@get_ppp_version(d)}"
92
93def get_ppp_version(d):
94 import re
95
96 pppd_plugin = d.expand('${STAGING_LIBDIR}/pppd')
97 if not os.path.isdir(pppd_plugin):
98 return None
99
100 bb.debug(1, "pppd plugin dir %s" % pppd_plugin)
Andrew Geissler595f6302022-01-24 19:11:47 +0000101 r = re.compile(r"\d*\.\d*\.\d*")
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500102 for f in os.listdir(pppd_plugin):
103 if os.path.isdir(os.path.join(pppd_plugin, f)):
104 ma = r.match(f)
105 if ma:
106 bb.debug(1, "pppd version dir %s" % f)
107 return f
108 else:
109 bb.debug(1, "under pppd plugin dir %s" % f)
110
111 return None
112