summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/ppp/ppp
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/ppp/ppp')
-rw-r--r--meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch75
-rw-r--r--meta/recipes-connectivity/ppp/ppp/08setupdns12
-rw-r--r--meta/recipes-connectivity/ppp/ppp/92removedns5
-rw-r--r--meta/recipes-connectivity/ppp/ppp/cifdefroute.patch292
-rw-r--r--meta/recipes-connectivity/ppp/ppp/copts.patch21
-rw-r--r--meta/recipes-connectivity/ppp/ppp/fix-CVE-2015-3310.patch29
-rwxr-xr-xmeta/recipes-connectivity/ppp/ppp/init57
-rwxr-xr-xmeta/recipes-connectivity/ppp/ppp/ip-down43
-rwxr-xr-xmeta/recipes-connectivity/ppp/ppp/ip-up44
-rw-r--r--meta/recipes-connectivity/ppp/ppp/makefile-remove-hard-usr-reference.patch37
-rw-r--r--meta/recipes-connectivity/ppp/ppp/makefile.patch95
-rw-r--r--meta/recipes-connectivity/ppp/ppp/pap22
-rw-r--r--meta/recipes-connectivity/ppp/ppp/poff26
-rw-r--r--meta/recipes-connectivity/ppp/ppp/pon9
-rw-r--r--meta/recipes-connectivity/ppp/ppp/ppp@.service9
-rw-r--r--meta/recipes-connectivity/ppp/ppp/ppp_on_boot21
-rw-r--r--meta/recipes-connectivity/ppp/ppp/pppd-resolv-varrun.patch45
-rw-r--r--meta/recipes-connectivity/ppp/ppp/provider35
18 files changed, 877 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch b/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch
new file mode 100644
index 0000000000..8aa2d2e678
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch
@@ -0,0 +1,75 @@
1From ba0f6058d1f25b2b60fc31ab2656bf12a71ffdab Mon Sep 17 00:00:00 2001
2From: Lu Chong <Chong.Lu@windriver.com>
3Date: Tue, 5 Nov 2013 17:32:56 +0800
4Subject: [PATCH] ppp: Fix compilation errors in Makefile
5
6This patch fixes below issues:
7
81. Make can't exit while compilation error occurs in subdir for plugins building.
9
102. If build ppp with newer kernel (3.10.10), it will pick 'if_pppox.h' from sysroot-dir and
11 'if_pppol2tp.h' from its own source dir, this cause below build errors:
12
13 bitbake_build/tmp/sysroots/intel-x86-64/usr/include/linux/if_pppox.h:84:26:
14 error: field 'pppol2tp' has incomplete type
15 struct pppol2tpin6_addr pppol2tp;
16 ^
17 bitbake_build/tmp/sysroots/intel-x86-64/usr/include/linux/if_pppox.h:99:28:
18 error: field 'pppol2tp' has incomplete type
19 struct pppol2tpv3in6_addr pppol2tp;
20 ^
21
22The 'sysroot-dir/if_pppox.h' enabled ipv6 support but the 'source-dir/if_pppol2tp.h' lost
23related structure definitions, we should use both header files from sysroots to fix this
24build failure.
25
26Upstream-Status: Pending
27
28Signed-off-by: Lu Chong <Chong.Lu@windriver.com>
29---
30 pppd/plugins/Makefile.linux | 2 +-
31 pppd/plugins/pppol2tp/Makefile.linux | 2 +-
32 pppd/plugins/rp-pppoe/Makefile.linux | 2 +-
33 3 files changed, 3 insertions(+), 3 deletions(-)
34
35diff --git a/pppd/plugins/Makefile.linux b/pppd/plugins/Makefile.linux
36index 0a7ec7b..2a2c15a 100644
37--- a/pppd/plugins/Makefile.linux
38+++ b/pppd/plugins/Makefile.linux
39@@ -20,7 +20,7 @@ include .depend
40 endif
41
42 all: $(PLUGINS)
43- for d in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$d all; done
44+ for d in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$d all || exit 1; done
45
46 %.so: %.c
47 $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^
48diff --git a/pppd/plugins/pppol2tp/Makefile.linux b/pppd/plugins/pppol2tp/Makefile.linux
49index 19eff67..feb2f52 100644
50--- a/pppd/plugins/pppol2tp/Makefile.linux
51+++ b/pppd/plugins/pppol2tp/Makefile.linux
52@@ -1,6 +1,6 @@
53 #CC = gcc
54 COPTS = -O2 -g
55-CFLAGS = $(COPTS) -I. -I../.. -I../../../include -fPIC
56+CFLAGS = $(COPTS) -I. -I../.. -fPIC
57 LDFLAGS = -shared
58 INSTALL = install
59
60diff --git a/pppd/plugins/rp-pppoe/Makefile.linux b/pppd/plugins/rp-pppoe/Makefile.linux
61index f078991..15b9118 100644
62--- a/pppd/plugins/rp-pppoe/Makefile.linux
63+++ b/pppd/plugins/rp-pppoe/Makefile.linux
64@@ -26,7 +26,7 @@ INSTALL = install
65 RP_VERSION=3.8p
66
67 COPTS=-O2 -g
68-CFLAGS=$(COPTS) -I../../../include '-DRP_VERSION="$(RP_VERSION)"'
69+CFLAGS=$(COPTS) '-DRP_VERSION="$(RP_VERSION)"'
70 all: rp-pppoe.so pppoe-discovery
71
72 pppoe-discovery: pppoe-discovery.o debug.o
73--
741.7.9.5
75
diff --git a/meta/recipes-connectivity/ppp/ppp/08setupdns b/meta/recipes-connectivity/ppp/ppp/08setupdns
new file mode 100644
index 0000000000..998219de97
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/08setupdns
@@ -0,0 +1,12 @@
1#!/bin/sh
2ACTUALCONF=/var/run/resolv.conf
3PPPCONF=/var/run/ppp/resolv.conf
4if [ -f $PPPCONF ] ; then
5 if [ -f $ACTUALCONF ] ; then
6 if [ ! -h $ACTUALCONF -o ! "`readlink $ACTUALCONF 2>&1`" = "$PPPCONF" ] ; then
7 mv $ACTUALCONF $ACTUALCONF.ppporig
8 fi
9 fi
10
11 ln -sf $PPPCONF $ACTUALCONF
12fi
diff --git a/meta/recipes-connectivity/ppp/ppp/92removedns b/meta/recipes-connectivity/ppp/ppp/92removedns
new file mode 100644
index 0000000000..2eadec6899
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/92removedns
@@ -0,0 +1,5 @@
1#!/bin/sh
2ACTUALCONF=/var/run/resolv.conf
3if [ -f $ACTUALCONF.ppporig ] ; then
4 mv $ACTUALCONF.ppporig $ACTUALCONF
5fi
diff --git a/meta/recipes-connectivity/ppp/ppp/cifdefroute.patch b/meta/recipes-connectivity/ppp/ppp/cifdefroute.patch
new file mode 100644
index 0000000000..db4dbc27a9
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/cifdefroute.patch
@@ -0,0 +1,292 @@
1This patch comes from OpenEmbedded.
2The original patch is from Debian / SuSE to implement replacedefaultroute
3Rebased it to fit ppp-2.4.5. Dongxiao Xu <dongxiao.xu@intel.com>
4
5Upstream-Status: Inappropriate [debian/suse patches]
6
7diff -urN ppp-2.4.5-orig/pppd/ipcp.c ppp-2.4.5/pppd/ipcp.c
8--- ppp-2.4.5-orig/pppd/ipcp.c 2010-06-30 15:51:12.050166398 +0800
9+++ ppp-2.4.5/pppd/ipcp.c 2010-06-30 16:40:00.478716855 +0800
10@@ -198,6 +198,16 @@
11 "disable defaultroute option", OPT_ALIAS | OPT_A2CLR,
12 &ipcp_wantoptions[0].default_route },
13
14+#ifdef __linux__
15+ { "replacedefaultroute", o_bool,
16+ &ipcp_wantoptions[0].replace_default_route,
17+ "Replace default route", 1
18+ },
19+ { "noreplacedefaultroute", o_bool,
20+ &ipcp_allowoptions[0].replace_default_route,
21+ "Never replace default route", OPT_A2COPY,
22+ &ipcp_wantoptions[0].replace_default_route },
23+#endif
24 { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp,
25 "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp },
26 { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
27@@ -271,7 +281,7 @@
28 ip_active_pkt
29 };
30
31-static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t));
32+static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool));
33 static void ipcp_script __P((char *, int)); /* Run an up/down script */
34 static void ipcp_script_done __P((void *));
35
36@@ -1742,7 +1752,12 @@
37 if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE))
38 return 0;
39 if (wo->default_route)
40+#ifndef __linux__
41 if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr))
42+#else
43+ if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr,
44+ wo->replace_default_route))
45+#endif
46 default_route_set[u] = 1;
47 if (wo->proxy_arp)
48 if (sifproxyarp(u, wo->hisaddr))
49@@ -1830,7 +1845,8 @@
50 */
51 if (demand) {
52 if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
53- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr);
54+ ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr,
55+ wo->replace_default_route);
56 if (go->ouraddr != wo->ouraddr) {
57 warn("Local IP address changed to %I", go->ouraddr);
58 script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
59@@ -1855,7 +1871,12 @@
60
61 /* assign a default route through the interface if required */
62 if (ipcp_wantoptions[f->unit].default_route)
63+#ifndef __linux__
64 if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
65+#else
66+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
67+ wo->replace_default_route))
68+#endif
69 default_route_set[f->unit] = 1;
70
71 /* Make a proxy ARP entry if requested. */
72@@ -1905,7 +1926,12 @@
73
74 /* assign a default route through the interface if required */
75 if (ipcp_wantoptions[f->unit].default_route)
76+#ifndef __linux__
77 if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
78+#else
79+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr,
80+ wo->replace_default_route))
81+#endif
82 default_route_set[f->unit] = 1;
83
84 /* Make a proxy ARP entry if requested. */
85@@ -1983,7 +2009,7 @@
86 sifnpmode(f->unit, PPP_IP, NPMODE_DROP);
87 sifdown(f->unit);
88 ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr,
89- ipcp_hisoptions[f->unit].hisaddr);
90+ ipcp_hisoptions[f->unit].hisaddr, 0);
91 }
92
93 /* Execute the ip-down script */
94@@ -1999,12 +2025,21 @@
95 * proxy arp entries, etc.
96 */
97 static void
98-ipcp_clear_addrs(unit, ouraddr, hisaddr)
99+ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute)
100 int unit;
101 u_int32_t ouraddr; /* local address */
102 u_int32_t hisaddr; /* remote address */
103+ bool replacedefaultroute;
104 {
105- if (proxy_arp_set[unit]) {
106+ /* If replacedefaultroute, sifdefaultroute will be called soon
107+ * with replacedefaultroute set and that will overwrite the current
108+ * default route. This is the case only when doing demand, otherwise
109+ * during demand, this cifdefaultroute would restore the old default
110+ * route which is not what we want in this case. In the non-demand
111+ * case, we'll delete the default route and restore the old if there
112+ * is one saved by an sifdefaultroute with replacedefaultroute.
113+ */
114+ if (!replacedefaultroute && default_route_set[unit]) {
115 cifproxyarp(unit, hisaddr);
116 proxy_arp_set[unit] = 0;
117 }
118diff -urN ppp-2.4.5-orig/pppd/ipcp.h ppp-2.4.5/pppd/ipcp.h
119--- ppp-2.4.5-orig/pppd/ipcp.h 2010-06-30 15:51:12.043682063 +0800
120+++ ppp-2.4.5/pppd/ipcp.h 2010-06-30 16:40:49.586203129 +0800
121@@ -70,6 +70,7 @@
122 bool old_addrs; /* Use old (IP-Addresses) option? */
123 bool req_addr; /* Ask peer to send IP address? */
124 bool default_route; /* Assign default route through interface? */
125+ bool replace_default_route; /* Replace default route through interface? */
126 bool proxy_arp; /* Make proxy ARP entry for peer? */
127 bool neg_vj; /* Van Jacobson Compression? */
128 bool old_vj; /* use old (short) form of VJ option? */
129diff -urN ppp-2.4.5-orig/pppd/pppd.8 ppp-2.4.5/pppd/pppd.8
130--- ppp-2.4.5-orig/pppd/pppd.8 2010-06-30 15:51:12.043682063 +0800
131+++ ppp-2.4.5/pppd/pppd.8 2010-06-30 16:42:47.102413859 +0800
132@@ -121,6 +121,13 @@
133 This entry is removed when the PPP connection is broken. This option
134 is privileged if the \fInodefaultroute\fR option has been specified.
135 .TP
136+.B replacedefaultroute
137+This option is a flag to the defaultroute option. If defaultroute is
138+set and this flag is also set, pppd replaces an existing default route
139+with the new default route.
140+
141+
142+.TP
143 .B disconnect \fIscript
144 Execute the command specified by \fIscript\fR, by passing it to a
145 shell, after
146@@ -717,7 +724,12 @@
147 .TP
148 .B nodefaultroute
149 Disable the \fIdefaultroute\fR option. The system administrator who
150-wishes to prevent users from creating default routes with pppd
151+wishes to prevent users from adding a default route with pppd
152+can do so by placing this option in the /etc/ppp/options file.
153+.TP
154+.B noreplacedefaultroute
155+Disable the \fIreplacedefaultroute\fR option. The system administrator who
156+wishes to prevent users from replacing a default route with pppd
157 can do so by placing this option in the /etc/ppp/options file.
158 .TP
159 .B nodeflate
160diff -urN ppp-2.4.5-orig/pppd/pppd.h ppp-2.4.5/pppd/pppd.h
161--- ppp-2.4.5-orig/pppd/pppd.h 2010-06-30 15:51:12.050166398 +0800
162+++ ppp-2.4.5/pppd/pppd.h 2010-06-30 16:43:36.514148327 +0800
163@@ -643,7 +643,11 @@
164 int cif6addr __P((int, eui64_t, eui64_t));
165 /* Remove an IPv6 address from i/f */
166 #endif
167+#ifndef __linux__
168 int sifdefaultroute __P((int, u_int32_t, u_int32_t));
169+#else
170+int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt));
171+#endif
172 /* Create default route through i/f */
173 int cifdefaultroute __P((int, u_int32_t, u_int32_t));
174 /* Delete default route through i/f */
175diff -urN ppp-2.4.5-orig/pppd/sys-linux.c ppp-2.4.5/pppd/sys-linux.c
176--- ppp-2.4.5-orig/pppd/sys-linux.c 2010-06-30 15:51:12.050166398 +0800
177+++ ppp-2.4.5/pppd/sys-linux.c 2010-06-30 16:54:00.362716231 +0800
178@@ -206,6 +206,8 @@
179
180 static int if_is_up; /* Interface has been marked up */
181 static int have_default_route; /* Gateway for default route added */
182+static struct rtentry old_def_rt; /* Old default route */
183+static int default_rt_repl_rest; /* replace and restore old default rt */
184 static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */
185 static char proxy_arp_dev[16]; /* Device for proxy arp entry */
186 static u_int32_t our_old_addr; /* for detecting address changes */
187@@ -1537,6 +1539,9 @@
188 p = NULL;
189 }
190
191+ SET_SA_FAMILY (rt->rt_dst, AF_INET);
192+ SET_SA_FAMILY (rt->rt_gateway, AF_INET);
193+
194 SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16);
195 SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16);
196 SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16);
197@@ -1606,20 +1611,51 @@
198 /********************************************************************
199 *
200 * sifdefaultroute - assign a default route through the address given.
201- */
202-
203-int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
204-{
205- struct rtentry rt;
206-
207- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) {
208- if (rt.rt_flags & RTF_GATEWAY)
209- error("not replacing existing default route via %I",
210- SIN_ADDR(rt.rt_gateway));
211- else
212- error("not replacing existing default route through %s",
213- rt.rt_dev);
214- return 0;
215+ *
216+ * If the global default_rt_repl_rest flag is set, then this function
217+ * already replaced the original system defaultroute with some other
218+ * route and it should just replace the current defaultroute with
219+ * another one, without saving the current route. Use: demand mode,
220+ * when pppd sets first a defaultroute it it's temporary ppp0 addresses
221+ * and then changes the temporary addresses to the addresses for the real
222+ * ppp connection when it has come up.
223+ */
224+
225+int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace)
226+{
227+ struct rtentry rt, tmp_rt;
228+ struct rtentry *del_rt = NULL;
229+
230+ if (default_rt_repl_rest) {
231+ /* We have already reclaced the original defaultroute, if we
232+ * are called again, we will delete the current default route
233+ * and set the new default route in this function.
234+ * - this is normally only the case the doing demand: */
235+ if (defaultroute_exists( &tmp_rt ))
236+ del_rt = &tmp_rt;
237+ } else if ( defaultroute_exists( &old_def_rt ) &&
238+ strcmp( old_def_rt.rt_dev, ifname ) != 0) {
239+ /* We did not yet replace an existing default route, let's
240+ * check if we should save and replace a default route:
241+ */
242+ u_int32_t old_gateway = SIN_ADDR(old_def_rt.rt_gateway);
243+ if (old_gateway != gateway) {
244+ if (!replace) {
245+ error("not replacing default route to %s [%I]",
246+ old_def_rt.rt_dev, old_gateway);
247+ return 0;
248+ } else {
249+ // we need to copy rt_dev because we need it permanent too:
250+ char * tmp_dev = malloc(strlen(old_def_rt.rt_dev)+1);
251+ strcpy(tmp_dev, old_def_rt.rt_dev);
252+ old_def_rt.rt_dev = tmp_dev;
253+
254+ notice("replacing old default route to %s [%I]",
255+ old_def_rt.rt_dev, old_gateway);
256+ default_rt_repl_rest = 1;
257+ del_rt = &old_def_rt;
258+ }
259+ }
260 }
261
262 memset (&rt, 0, sizeof (rt));
263@@ -1638,6 +1674,12 @@
264 error("default route ioctl(SIOCADDRT): %m");
265 return 0;
266 }
267+ if (default_rt_repl_rest && del_rt)
268+ if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) {
269+ if ( ! ok_error ( errno ))
270+ error("del old default route ioctl(SIOCDELRT): %m(%d)", errno);
271+ return 0;
272+ }
273
274 have_default_route = 1;
275 return 1;
276@@ -1673,6 +1715,16 @@
277 return 0;
278 }
279 }
280+ if (default_rt_repl_rest) {
281+ notice("restoring old default route to %s [%I]",
282+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway));
283+ if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) {
284+ if ( ! ok_error ( errno ))
285+ error("restore default route ioctl(SIOCADDRT): %m(%d)", errno);
286+ return 0;
287+ }
288+ default_rt_repl_rest = 0;
289+ }
290
291 return 1;
292 }
diff --git a/meta/recipes-connectivity/ppp/ppp/copts.patch b/meta/recipes-connectivity/ppp/ppp/copts.patch
new file mode 100644
index 0000000000..53ff06e03e
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/copts.patch
@@ -0,0 +1,21 @@
1ppp: use build system CFLAGS when compiling
2
3Upstream-Status: Pending
4
5Override the hard-coded COPTS make variables with
6CFLAGS. Add COPTS into one Makefile that did not
7use it.
8
9Signed-off-by: Joe Slater <jslater@windriver.com>
10
11--- a/pppd/plugins/radius/Makefile.linux
12+++ b/pppd/plugins/radius/Makefile.linux
13@@ -12,7 +12,7 @@ VERSION = $(shell awk -F '"' '/VERSION/
14 INSTALL = install
15
16 PLUGIN=radius.so radattr.so radrealms.so
17-CFLAGS=-I. -I../.. -I../../../include -O2 -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
18+CFLAGS=-I. -I../.. -I../../../include $(COPTS) -fPIC -DRC_LOG_FACILITY=LOG_DAEMON
19
20 # Uncomment the next line to include support for Microsoft's
21 # MS-CHAP authentication protocol.
diff --git a/meta/recipes-connectivity/ppp/ppp/fix-CVE-2015-3310.patch b/meta/recipes-connectivity/ppp/ppp/fix-CVE-2015-3310.patch
new file mode 100644
index 0000000000..c9edb30597
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/fix-CVE-2015-3310.patch
@@ -0,0 +1,29 @@
1ppp: Buffer overflow in radius plugin
2
3From: https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;bug=782450
4
5Upstream-Status: Backport
6
7On systems with more than 65535 processes running, pppd aborts when
8sending a "start" accounting message to the RADIUS server because of a
9buffer overflow in rc_mksid.
10
11The process id is used in rc_mksid to generate a pseudo-unique string,
12assuming that the hex representation of the pid will be at most 4
13characters (FFFF). __sprintf_chk(), used when compiling with
14optimization levels greater than 0 and FORTIFY_SOURCE, detects the
15buffer overflow and makes pppd crash.
16
17The following patch fixes the problem.
18
19--- ppp-2.4.6.orig/pppd/plugins/radius/util.c
20+++ ppp-2.4.6/pppd/plugins/radius/util.c
21@@ -77,7 +77,7 @@ rc_mksid (void)
22 static unsigned short int cnt = 0;
23 sprintf (buf, "%08lX%04X%02hX",
24 (unsigned long int) time (NULL),
25- (unsigned int) getpid (),
26+ (unsigned int) getpid () % 65535,
27 cnt & 0xFF);
28 cnt++;
29 return buf;
diff --git a/meta/recipes-connectivity/ppp/ppp/init b/meta/recipes-connectivity/ppp/ppp/init
new file mode 100755
index 0000000000..0c0136049b
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/init
@@ -0,0 +1,57 @@
1#!/bin/sh
2#
3# /etc/init.d/ppp: start or stop PPP link.
4#
5# If you want PPP started on boot time (most dialup systems won't need it)
6# rename the /etc/ppp/no_ppp_on_boot file to /etc/ppp/ppp_on_boot, and
7# follow the instructions in the comments in that file.
8
9# Source function library.
10. /etc/init.d/functions
11
12test -x /usr/sbin/pppd -a -f /etc/ppp/ppp_on_boot || exit 0
13if [ -x /etc/ppp/ppp_on_boot ]; then RUNFILE=1; fi
14
15case "$1" in
16 start)
17 echo -n "Starting up PPP link: pppd"
18 if [ "$RUNFILE" = "1" ]; then
19 /etc/ppp/ppp_on_boot
20 else
21 pppd call provider
22 fi
23 echo "."
24 ;;
25 stop)
26 echo -n "Shutting down PPP link: pppd"
27 if [ "$RUNFILE" = "1" ]; then
28 poff
29 else
30 poff provider
31 fi
32 echo "."
33 ;;
34 status)
35 status /usr/sbin/pppd;
36 exit $?
37 ;;
38 restart|force-reload)
39 echo -n "Restarting PPP link: pppd"
40 if [ "$RUNFILE" = "1" ]; then
41 poff
42 sleep 5
43 /etc/ppp/ppp_on_boot
44 else
45 poff provider
46 sleep 5
47 pppd call provider
48 fi
49 echo "."
50 ;;
51 *)
52 echo "Usage: /etc/init.d/ppp {start|stop|status|restart|force-reload}"
53 exit 1
54 ;;
55esac
56
57exit 0
diff --git a/meta/recipes-connectivity/ppp/ppp/ip-down b/meta/recipes-connectivity/ppp/ppp/ip-down
new file mode 100755
index 0000000000..06d35487a5
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/ip-down
@@ -0,0 +1,43 @@
1#!/bin/sh
2#
3# $Id: ip-down,v 1.2 1998/02/10 21:21:55 phil Exp $
4#
5# This script is run by the pppd _after_ the link is brought down.
6# It uses run-parts to run scripts in /etc/ppp/ip-down.d, so to delete
7# routes, unset IP addresses etc. you should create script(s) there.
8#
9# Be aware that other packages may include /etc/ppp/ip-down.d scripts (named
10# after that package), so choose local script names with that in mind.
11#
12# This script is called with the following arguments:
13# Arg Name Example
14# $1 Interface name ppp0
15# $2 The tty ttyS1
16# $3 The link speed 38400
17# $4 Local IP number 12.34.56.78
18# $5 Peer IP number 12.34.56.99
19# $6 Optional ``ipparam'' value foo
20
21# The environment is cleared before executing this script
22# so the path must be reset
23PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
24export PATH
25# These variables are for the use of the scripts run by run-parts
26PPP_IFACE="$1"
27PPP_TTY="$2"
28PPP_SPEED="$3"
29PPP_LOCAL="$4"
30PPP_REMOTE="$5"
31PPP_IPPARAM="$6"
32export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
33
34# as an additional convenience, $PPP_TTYNAME is set to the tty name,
35# stripped of /dev/ (if present) for easier matching.
36PPP_TTYNAME=`/usr/bin/basename "$2"`
37export PPP_TTYNAME
38
39# Main Script starts here
40
41run-parts /etc/ppp/ip-down.d
42
43# last line
diff --git a/meta/recipes-connectivity/ppp/ppp/ip-up b/meta/recipes-connectivity/ppp/ppp/ip-up
new file mode 100755
index 0000000000..fc2fae9fe0
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/ip-up
@@ -0,0 +1,44 @@
1#!/bin/sh
2#
3# $Id: ip-up,v 1.2 1998/02/10 21:25:34 phil Exp $
4#
5# This script is run by the pppd after the link is established.
6# It uses run-parts to run scripts in /etc/ppp/ip-up.d, so to add routes,
7# set IP address, run the mailq etc. you should create script(s) there.
8#
9# Be aware that other packages may include /etc/ppp/ip-up.d scripts (named
10# after that package), so choose local script names with that in mind.
11#
12# This script is called with the following arguments:
13# Arg Name Example
14# $1 Interface name ppp0
15# $2 The tty ttyS1
16# $3 The link speed 38400
17# $4 Local IP number 12.34.56.78
18# $5 Peer IP number 12.34.56.99
19# $6 Optional ``ipparam'' value foo
20
21# The environment is cleared before executing this script
22# so the path must be reset
23PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
24export PATH
25# These variables are for the use of the scripts run by run-parts
26PPP_IFACE="$1"
27PPP_TTY="$2"
28PPP_SPEED="$3"
29PPP_LOCAL="$4"
30PPP_REMOTE="$5"
31PPP_IPPARAM="$6"
32export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
33
34
35# as an additional convenience, $PPP_TTYNAME is set to the tty name,
36# stripped of /dev/ (if present) for easier matching.
37PPP_TTYNAME=`/usr/bin/basename "$2"`
38export PPP_TTYNAME
39
40# Main Script starts here
41
42run-parts /etc/ppp/ip-up.d
43
44# last line
diff --git a/meta/recipes-connectivity/ppp/ppp/makefile-remove-hard-usr-reference.patch b/meta/recipes-connectivity/ppp/ppp/makefile-remove-hard-usr-reference.patch
new file mode 100644
index 0000000000..d59717ebd3
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/makefile-remove-hard-usr-reference.patch
@@ -0,0 +1,37 @@
1The patch comes from OpenEmbedded.
2Rebased for ppp-2.4.5. Dongxiao Xu <dongxiao.xu@intel.com>
3
4Updated from OE-Classic to include the pcap hunk.
5Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
6
7Upstream-Status: Inappropriate [configuration]
8
9diff -urN ppp-2.4.5-orig/pppd/Makefile.linux ppp-2.4.5/pppd/Makefile.linux
10--- ppp-2.4.5-orig/pppd/Makefile.linux 2010-06-30 15:51:12.043682063 +0800
11+++ ppp-2.4.5/pppd/Makefile.linux 2010-06-30 17:08:21.806363042 +0800
12@@ -117,10 +117,10 @@
13 #LIBS += -lshadow $(LIBS)
14 endif
15
16-ifneq ($(wildcard /usr/include/crypt.h),)
17+#ifneq ($(wildcard /usr/include/crypt.h),)
18 CFLAGS += -DHAVE_CRYPT_H=1
19 LIBS += -lcrypt
20-endif
21+#endif
22
23 ifdef NEEDDES
24 ifndef USE_CRYPT
25@@ -169,10 +169,10 @@
26 endif
27
28 ifdef FILTER
29-ifneq ($(wildcard /usr/include/pcap-bpf.h),)
30+#ifneq ($(wildcard /usr/include/pcap-bpf.h),)
31 LIBS += -lpcap
32 CFLAGS += -DPPP_FILTER
33-endif
34+#endif
35 endif
36
37 ifdef HAVE_INET6
diff --git a/meta/recipes-connectivity/ppp/ppp/makefile.patch b/meta/recipes-connectivity/ppp/ppp/makefile.patch
new file mode 100644
index 0000000000..2d09baf5d0
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/makefile.patch
@@ -0,0 +1,95 @@
1The patch comes from OpenEmbedded
2Rebased for ppp-2.4.5. Dongxiao Xu <dongxiao.xu@intel.com>
3
4Upstream-Status: Inappropriate [configuration]
5
6diff -ruN ppp-2.4.5-orig/chat/Makefile.linux ppp-2.4.5/chat/Makefile.linux
7--- ppp-2.4.5-orig/chat/Makefile.linux 2010-06-30 15:51:12.050166398 +0800
8+++ ppp-2.4.5/chat/Makefile.linux 2010-06-30 15:51:30.450118446 +0800
9@@ -25,7 +25,7 @@
10
11 install: chat
12 mkdir -p $(BINDIR) $(MANDIR)
13- $(INSTALL) -s -c chat $(BINDIR)
14+ $(INSTALL) -c chat $(BINDIR)
15 $(INSTALL) -c -m 644 chat.8 $(MANDIR)
16
17 clean:
18diff -ruN ppp-2.4.5-orig/pppd/Makefile.linux ppp-2.4.5/pppd/Makefile.linux
19--- ppp-2.4.5-orig/pppd/Makefile.linux 2010-06-30 15:51:12.043682063 +0800
20+++ ppp-2.4.5/pppd/Makefile.linux 2010-06-30 15:52:11.214170607 +0800
21@@ -99,7 +99,7 @@
22 CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include
23 LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto
24 TARGETS += srp-entry
25-EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry
26+EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry
27 MANPAGES += srp-entry.8
28 EXTRACLEAN += srp-entry.o
29 NEEDDES=y
30@@ -200,7 +200,7 @@
31 install: pppd
32 mkdir -p $(BINDIR) $(MANDIR)
33 $(EXTRAINSTALL)
34- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
35+ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd
36 if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
37 chmod o-rx,u+s $(BINDIR)/pppd; fi
38 $(INSTALL) -c -m 444 pppd.8 $(MANDIR)
39diff -ruN ppp-2.4.5-orig/pppd/plugins/radius/Makefile.linux ppp-2.4.5/pppd/plugins/radius/Makefile.linux
40--- ppp-2.4.5-orig/pppd/plugins/radius/Makefile.linux 2010-06-30 15:51:12.047676187 +0800
41+++ ppp-2.4.5/pppd/plugins/radius/Makefile.linux 2010-06-30 15:53:47.750182267 +0800
42@@ -36,11 +36,11 @@
43
44 install: all
45 $(INSTALL) -d -m 755 $(LIBDIR)
46- $(INSTALL) -s -c -m 755 radius.so $(LIBDIR)
47- $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR)
48- $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR)
49- $(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR)
50- $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR)
51+ $(INSTALL) -c -m 755 radius.so $(LIBDIR)
52+ $(INSTALL) -c -m 755 radattr.so $(LIBDIR)
53+ $(INSTALL) -c -m 755 radrealms.so $(LIBDIR)
54+ $(INSTALL) -m 444 pppd-radius.8 $(MANDIR)
55+ $(INSTALL) -m 444 pppd-radattr.8 $(MANDIR)
56
57 radius.so: radius.o libradiusclient.a
58 $(CC) -o radius.so -shared radius.o libradiusclient.a
59diff -ruN ppp-2.4.5-orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.5/pppd/plugins/rp-pppoe/Makefile.linux
60--- ppp-2.4.5-orig/pppd/plugins/rp-pppoe/Makefile.linux 2010-06-30 15:51:12.047676187 +0800
61+++ ppp-2.4.5/pppd/plugins/rp-pppoe/Makefile.linux 2010-06-30 15:53:15.454486877 +0800
62@@ -43,9 +43,9 @@
63
64 install: all
65 $(INSTALL) -d -m 755 $(LIBDIR)
66- $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR)
67+ $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR)
68 $(INSTALL) -d -m 755 $(BINDIR)
69- $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR)
70+ $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR)
71
72 clean:
73 rm -f *.o *.so pppoe-discovery
74diff -ruN ppp-2.4.5-orig/pppdump/Makefile.linux ppp-2.4.5/pppdump/Makefile.linux
75--- ppp-2.4.5-orig/pppdump/Makefile.linux 2010-06-30 15:51:12.058183383 +0800
76+++ ppp-2.4.5/pppdump/Makefile.linux 2010-06-30 15:52:25.762183537 +0800
77@@ -17,5 +17,5 @@
78
79 install:
80 mkdir -p $(BINDIR) $(MANDIR)
81- $(INSTALL) -s -c pppdump $(BINDIR)
82+ $(INSTALL) -c pppdump $(BINDIR)
83 $(INSTALL) -c -m 444 pppdump.8 $(MANDIR)
84diff -ruN ppp-2.4.5-orig/pppstats/Makefile.linux ppp-2.4.5/pppstats/Makefile.linux
85--- ppp-2.4.5-orig/pppstats/Makefile.linux 2010-06-30 15:51:12.058183383 +0800
86+++ ppp-2.4.5/pppstats/Makefile.linux 2010-06-30 15:52:42.486341081 +0800
87@@ -22,7 +22,7 @@
88
89 install: pppstats
90 -mkdir -p $(MANDIR)
91- $(INSTALL) -s -c pppstats $(BINDIR)
92+ $(INSTALL) -c pppstats $(BINDIR)
93 $(INSTALL) -c -m 444 pppstats.8 $(MANDIR)
94
95 pppstats: $(PPPSTATSRCS)
diff --git a/meta/recipes-connectivity/ppp/ppp/pap b/meta/recipes-connectivity/ppp/ppp/pap
new file mode 100644
index 0000000000..093c32607a
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/pap
@@ -0,0 +1,22 @@
1# You can use this script unmodified to connect to sites which allow
2# authentication via PAP, CHAP and similar protocols.
3# This script can be shared among different pppd peer configurations.
4# To use it, add something like this to your /etc/ppp/peers/ file:
5#
6# connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T PHONE-NUMBER"
7# user YOUR-USERNAME-IN-PAP-SECRETS
8# noauth
9
10# Uncomment the following line to see the connect speed.
11# It will be logged to stderr or to the file specified with the -r chat option.
12#REPORT CONNECT
13
14ABORT BUSY
15ABORT VOICE
16ABORT "NO CARRIER"
17ABORT "NO DIALTONE"
18ABORT "NO DIAL TONE"
19"" ATZ
20OK ATDT\T
21CONNECT ""
22
diff --git a/meta/recipes-connectivity/ppp/ppp/poff b/meta/recipes-connectivity/ppp/ppp/poff
new file mode 100644
index 0000000000..0521a9406a
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/poff
@@ -0,0 +1,26 @@
1#!/bin/sh
2
3# Lets see how many pppds are running....
4set -- `cat /var/run/ppp*.pid 2>/dev/null`
5
6case $# in
7 0) # pppd only creates a pid file once ppp is up, so let's try killing pppd
8 # on the assumption that we've not got that far yet.
9 killall pppd
10 ;;
11 1) # If only one was running then it can be killed (apparently killall
12 # caused problems for some, so lets try killing the pid from the file)
13 kill $1
14 ;;
15 *) # More than one! Aieehh.. Dont know which one to kill.
16 echo "More than one pppd running. None stopped"
17 exit 1
18 ;;
19esac
20
21if [ -r /var/run/ppp-quick ]
22then
23 rm -f /var/run/ppp-quick
24fi
25
26exit 0
diff --git a/meta/recipes-connectivity/ppp/ppp/pon b/meta/recipes-connectivity/ppp/ppp/pon
new file mode 100644
index 0000000000..91c059501a
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/pon
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3if [ "$1" = "quick" ]
4then
5 touch /var/run/ppp-quick
6 shift
7fi
8
9/usr/sbin/pppd call ${1:-provider}
diff --git a/meta/recipes-connectivity/ppp/ppp/ppp@.service b/meta/recipes-connectivity/ppp/ppp/ppp@.service
new file mode 100644
index 0000000000..2bf0b5e347
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/ppp@.service
@@ -0,0 +1,9 @@
1[Unit]
2Description=PPP link to %I
3Before=network.target
4
5[Service]
6ExecStart=@SBINDIR@/pppd call %I nodetach nolog
7
8[Install]
9WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/ppp/ppp/ppp_on_boot b/meta/recipes-connectivity/ppp/ppp/ppp_on_boot
new file mode 100644
index 0000000000..9793761840
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/ppp_on_boot
@@ -0,0 +1,21 @@
1###!/bin/sh
2#
3# Rename this file to ppp_on_boot and pppd will be fired up as
4# soon as the system comes up, connecting to `provider'.
5#
6# If you also make this file executable, and replace the first line
7# with just "#!/bin/sh", the commands below will be executed instead.
8#
9
10# The location of the ppp daemon itself (shouldn't need to be changed)
11PPPD=/usr/sbin/pppd
12
13# The default provider to connect to
14$PPPD call provider
15
16# Additional connections, which would just use settings from
17# /etc/ppp/options.<tty>
18#$PPPD ttyS0
19#$PPPD ttyS1
20#$PPPD ttyS2
21#$PPPD ttyS3
diff --git a/meta/recipes-connectivity/ppp/ppp/pppd-resolv-varrun.patch b/meta/recipes-connectivity/ppp/ppp/pppd-resolv-varrun.patch
new file mode 100644
index 0000000000..a72414ff8a
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/pppd-resolv-varrun.patch
@@ -0,0 +1,45 @@
1The patch comes from OpenEmbedded
2Rebased for ppp-2.4.5. Dongxiao Xu <dongxiao.xu@intel.com>
3
4Upstream-Status: Inappropriate [embedded specific]
5
6diff -ruN ppp-2.4.5-orig/pppd/ipcp.c ppp-2.4.5/pppd/ipcp.c
7--- ppp-2.4.5-orig/pppd/ipcp.c 2010-06-30 15:51:12.050166398 +0800
8+++ ppp-2.4.5/pppd/ipcp.c 2010-06-30 17:02:33.930393283 +0800
9@@ -55,6 +55,8 @@
10 #include <sys/socket.h>
11 #include <netinet/in.h>
12 #include <arpa/inet.h>
13+#include <sys/stat.h>
14+#include <unistd.h>
15
16 #include "pppd.h"
17 #include "fsm.h"
18@@ -2095,6 +2097,14 @@
19 u_int32_t peerdns1, peerdns2;
20 {
21 FILE *f;
22+ struct stat dirinfo;
23+
24+ if(stat(_PATH_OUTDIR, &dirinfo)) {
25+ if(mkdir(_PATH_OUTDIR, 0775)) {
26+ error("Failed to create directory %s: %m", _PATH_OUTDIR);
27+ return;
28+ }
29+ }
30
31 f = fopen(_PATH_RESOLV, "w");
32 if (f == NULL) {
33diff -ruN ppp-2.4.5-orig/pppd/pathnames.h ppp-2.4.5/pppd/pathnames.h
34--- ppp-2.4.5-orig/pppd/pathnames.h 2010-06-30 15:51:12.043682063 +0800
35+++ ppp-2.4.5/pppd/pathnames.h 2010-06-30 17:03:20.594371055 +0800
36@@ -30,7 +30,8 @@
37 #define _PATH_TTYOPT _ROOT_PATH "/etc/ppp/options."
38 #define _PATH_CONNERRS _ROOT_PATH "/etc/ppp/connect-errors"
39 #define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/"
40-#define _PATH_RESOLV _ROOT_PATH "/etc/ppp/resolv.conf"
41+#define _PATH_OUTDIR _ROOT_PATH _PATH_VARRUN "/ppp"
42+#define _PATH_RESOLV _PATH_OUTDIR "/resolv.conf"
43
44 #define _PATH_USEROPT ".ppprc"
45 #define _PATH_PSEUDONYM ".ppp_pseudonym"
diff --git a/meta/recipes-connectivity/ppp/ppp/provider b/meta/recipes-connectivity/ppp/ppp/provider
new file mode 100644
index 0000000000..e74d71a8eb
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/provider
@@ -0,0 +1,35 @@
1# example configuration for a dialup connection authenticated with PAP or CHAP
2#
3# This is the default configuration used by pon(1) and poff(1).
4# See the manual page pppd(8) for information on all the options.
5
6# MUST CHANGE: replace myusername@realm with the PPP login name given to
7# your by your provider.
8# There should be a matching entry with the password in /etc/ppp/pap-secrets
9# and/or /etc/ppp/chap-secrets.
10user "myusername@realm"
11
12# MUST CHANGE: replace ******** with the phone number of your provider.
13# The /etc/chatscripts/pap chat script may be modified to change the
14# modem initialization string.
15connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T ********"
16
17# Serial device to which the modem is connected.
18/dev/modem
19
20# Speed of the serial line.
21115200
22
23# Assumes that your IP address is allocated dynamically by the ISP.
24noipdefault
25# Try to get the name server addresses from the ISP.
26usepeerdns
27# Use this connection as the default route.
28defaultroute
29
30# Makes pppd "dial again" when the connection is lost.
31persist
32
33# Do not ask the remote to authenticate.
34noauth
35