ppp: backport security fixes
[openwrt/openwrt.git] / package / network / services / ppp / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=ppp
12 PKG_RELEASE:=3
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/paulusmack/ppp
16 PKG_SOURCE_DATE:=2019-05-25
17 PKG_SOURCE_VERSION:=8e77984ac5d7acbe68b2b2f590abd17564c9730d
18 PKG_MIRROR_HASH:=7e7e74f0261db2c45770d79c6114e768382e85bfeb3f5a83179f270d6c15006d
19 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
20 PKG_LICENSE:=BSD-4-Clause
21 PKG_CPE_ID:=cpe:/a:samba:ppp
22
23 PKG_RELEASE_VERSION:=2.4.7
24 PKG_VERSION:=$(PKG_RELEASE_VERSION).git-$(PKG_SOURCE_DATE)
25
26 PKG_BUILD_DEPENDS:=libpcap
27
28 PKG_BUILD_PARALLEL:=1
29 PKG_INSTALL:=1
30
31 include $(INCLUDE_DIR)/package.mk
32
33 define Package/ppp/Default
34 SECTION:=net
35 CATEGORY:=Network
36 URL:=https://ppp.samba.org/
37 endef
38
39 define Package/ppp
40 $(call Package/ppp/Default)
41 DEPENDS:=+kmod-ppp
42 TITLE:=PPP daemon
43 VARIANT:=default
44 endef
45
46 define Package/ppp-multilink
47 $(call Package/ppp/Default)
48 DEPENDS:=+kmod-ppp
49 TITLE:=PPP daemon (with multilink support)
50 VARIANT:=multilink
51 endef
52
53 define Package/ppp/description
54 This package contains the PPP (Point-to-Point Protocol) daemon.
55 endef
56
57 define Package/ppp/conffiles
58 /etc/ppp/chap-secrets
59 /etc/ppp/filter
60 /etc/ppp/ip-down
61 /etc/ppp/ip-up
62 /etc/ppp/ipv6-down
63 /etc/ppp/ipv6-up
64 /etc/ppp/options
65 endef
66
67 define Package/ppp-mod-pppoa
68 $(call Package/ppp/Default)
69 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +linux-atm +kmod-pppoa
70 TITLE:=PPPoA plugin
71 endef
72
73 define Package/ppp-mod-pppoa/description
74 This package contains a PPPoA (PPP over ATM) plugin for ppp.
75 endef
76
77 define Package/ppp-mod-pppoe
78 $(call Package/ppp/Default)
79 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +kmod-pppoe
80 TITLE:=PPPoE plugin
81 endef
82
83 define Package/ppp-mod-pppoe/description
84 This package contains a PPPoE (PPP over Ethernet) plugin for ppp.
85 endef
86
87 define Package/ppp-mod-radius
88 $(call Package/ppp/Default)
89 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
90 TITLE:=RADIUS plugin
91 endef
92
93 define Package/ppp-mod-radius/description
94 This package contains a RADIUS (Remote Authentication Dial-In User Service)
95 plugin for ppp.
96 endef
97
98 define Package/ppp-mod-radius/conffiles
99 /etc/ppp/radius.conf
100 /etc/ppp/radius/
101 endef
102
103 define Package/ppp-mod-pppol2tp
104 $(call Package/ppp/Default)
105 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +kmod-pppol2tp
106 TITLE:=PPPoL2TP plugin
107 endef
108
109 define Package/ppp-mod-pppol2tp/description
110 This package contains a PPPoL2TP (PPP over L2TP) plugin for ppp.
111 endef
112
113 define Package/ppp-mod-pptp
114 $(call Package/ppp/Default)
115 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +kmod-pptp +kmod-mppe +resolveip
116 TITLE:=PPtP plugin
117 endef
118
119 define Package/ppp-mod-pptp/description
120 This package contains a PPtP plugin for ppp.
121 endef
122
123 define Package/ppp-mod-passwordfd
124 $(call Package/ppp/Default)
125 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
126 TITLE:=pap/chap secret from filedescriptor
127 endef
128
129 define Package/ppp-mod-passwordfd/description
130 This package allows to pass the PAP/CHAP secret from a filedescriptor.
131 Eliminates the need for a secrets file.
132 endef
133
134 define Package/chat
135 $(call Package/ppp/Default)
136 TITLE:=Establish conversation with a modem
137 endef
138
139 define Package/chat/description
140 This package contains an utility to establish conversation with other PPP servers
141 (via a modem).
142 endef
143
144 define Package/pppdump
145 $(call Package/ppp/Default)
146 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
147 TITLE:=Read PPP record file
148 endef
149
150 define Package/pppdump/description
151 This package contains an utility to read PPP record file.
152 endef
153
154 define Package/pppstats
155 $(call Package/ppp/Default)
156 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink)
157 TITLE:=Report PPP statistics
158 endef
159
160 define Package/pppstats/description
161 This package contains an utility to report PPP statistics.
162 endef
163
164 define Package/pppoe-discovery
165 $(call Package/ppp/Default)
166 DEPENDS:=@(PACKAGE_ppp||PACKAGE_ppp-multilink) +ppp-mod-pppoe
167 TITLE:=Perform a PPPoE-discovery process
168 endef
169
170 define Package/pppoe-discovery/description
171 This tool performs the same discovery process as pppoe, but does
172 not initiate a session. Can be useful to debug pppoe.
173 endef
174
175
176 define Build/Configure
177 $(call Build/Configure/Default,, \
178 UNAME_S="Linux" \
179 UNAME_R="$(LINUX_VERSION)" \
180 UNAME_M="$(ARCH)" \
181 )
182 mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux
183 $(CP) \
184 $(LINUX_DIR)/include/linux/compiler.h \
185 $(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \
186 $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
187
188 # Kernel 4.14.9+ only, ignore the exit status of cp in case the file
189 # doesn't exits
190 -$(CP) $(LINUX_DIR)/include/linux/compiler_types.h \
191 $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/
192 endef
193
194 TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
195 TARGET_LDFLAGS += -Wl,--gc-sections -flto -fuse-linker-plugin
196
197 MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \
198 PRECOMPILED_FILTER=1 \
199 STAGING_DIR="$(STAGING_DIR)"
200
201 ifeq ($(BUILD_VARIANT),multilink)
202 MAKE_FLAGS += HAVE_MULTILINK=y
203 else
204 MAKE_FLAGS += HAVE_MULTILINK=
205 endif
206
207 ifdef CONFIG_USE_MUSL
208 MAKE_FLAGS += USE_LIBUTIL=
209 endif
210
211 define Build/InstallDev
212 $(INSTALL_DIR) $(1)/usr/include
213 $(CP) $(PKG_INSTALL_DIR)/include/pppd $(1)/usr/include/
214 endef
215
216 define Package/ppp/script_install
217 endef
218
219 define Package/ppp/install
220 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
221 $(INSTALL_DIR) $(1)/usr/sbin
222 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppd $(1)/usr/sbin/
223 $(INSTALL_DIR) $(1)/etc/ppp
224 $(INSTALL_CONF) ./files/etc/ppp/chap-secrets $(1)/etc/ppp/
225 $(INSTALL_DATA) ./files/etc/ppp/filter $(1)/etc/ppp/
226 $(INSTALL_DATA) ./files/etc/ppp/options $(1)/etc/ppp/
227 $(LN) /tmp/resolv.conf.ppp $(1)/etc/ppp/resolv.conf
228 $(INSTALL_DIR) $(1)/lib/netifd/proto
229 $(INSTALL_BIN) ./files/ppp.sh $(1)/lib/netifd/proto/
230 $(INSTALL_BIN) ./files/lib/netifd/ppp-up $(1)/lib/netifd/
231 $(INSTALL_BIN) ./files/lib/netifd/ppp6-up $(1)/lib/netifd/
232 $(INSTALL_BIN) ./files/lib/netifd/ppp-down $(1)/lib/netifd/
233 endef
234 Package/ppp-multilink/install=$(Package/ppp/install)
235
236 define Package/ppp-mod-pppoa/install
237 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
238 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoatm.so \
239 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
240 endef
241
242 define Package/ppp-mod-pppoe/install
243 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
244 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/rp-pppoe.so \
245 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
246 endef
247
248 define Package/ppp-mod-radius/install
249 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
250 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/radius.so \
251 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
252 $(INSTALL_DIR) $(1)/etc/ppp
253 $(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/
254 $(INSTALL_DIR) $(1)/etc/ppp/radius
255 $(INSTALL_DATA) ./files/etc/ppp/radius/dictionary* \
256 $(1)/etc/ppp/radius/
257 $(INSTALL_CONF) ./files/etc/ppp/radius/servers \
258 $(1)/etc/ppp/radius/
259 endef
260
261 define Package/ppp-mod-pppol2tp/install
262 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
263 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppol2tp.so \
264 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
265 endef
266
267 define Package/ppp-mod-pptp/install
268 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
269 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pptp.so \
270 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
271 $(INSTALL_DIR) $(1)/etc/ppp
272 $(INSTALL_DATA) ./files/etc/ppp/options.pptp $(1)/etc/ppp/
273 endef
274
275 define Package/ppp-mod-passwordfd/install
276 $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)
277 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/passwordfd.so \
278 $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/
279 endef
280
281 define Package/chat/install
282 $(INSTALL_DIR) $(1)/usr/sbin
283 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/chat $(1)/usr/sbin/
284 endef
285
286 define Package/pppdump/install
287 $(INSTALL_DIR) $(1)/usr/sbin
288 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppdump $(1)/usr/sbin/
289 endef
290
291 define Package/pppstats/install
292 $(INSTALL_DIR) $(1)/usr/sbin
293 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppstats $(1)/usr/sbin/
294 endef
295
296 define Package/pppoe-discovery/install
297 $(INSTALL_DIR) $(1)/usr/sbin
298 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppoe-discovery $(1)/usr/sbin/
299 endef
300
301 $(eval $(call BuildPackage,ppp))
302 $(eval $(call BuildPackage,ppp-multilink))
303 $(eval $(call BuildPackage,ppp-mod-pppoa))
304 $(eval $(call BuildPackage,ppp-mod-pppoe))
305 $(eval $(call BuildPackage,ppp-mod-radius))
306 $(eval $(call BuildPackage,ppp-mod-pppol2tp))
307 $(eval $(call BuildPackage,ppp-mod-pptp))
308 $(eval $(call BuildPackage,ppp-mod-passwordfd))
309 $(eval $(call BuildPackage,chat))
310 $(eval $(call BuildPackage,pppdump))
311 $(eval $(call BuildPackage,pppstats))
312 $(eval $(call BuildPackage,pppoe-discovery))