Commit 28648190 authored by Natanael Copa's avatar Natanael Copa

main/ppp: upgrade to 2.4.6 and ship net/ppp_defs.h

parent 80e7a7e8
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ppp
pkgver=2.4.5
pkgrel=8
pkgver=2.4.6
pkgrel=0
pkgdesc="A daemon which implements the PPP protocol for dial-up networking"
url="http://www.samba.org/ppp/"
arch="all"
......@@ -32,7 +32,7 @@ prepare() {
done
}
build () {
build () {
cd "$_builddir"
# fix CFLAGS
......@@ -61,7 +61,9 @@ build () {
package() {
cd "$_builddir"
make INSTROOT="$pkgdir" install
make INSTROOT="$pkgdir" install || return 1
install -Dm644 include/net/ppp_defs.h \
"$pkgdir"/usr/include/net/ppp_defs.h || return 1
install -D -m644 "$srcdir"/options "$pkgdir"/etc/ppp/options
install -D -m755 "$srcdir"/ip-up "$pkgdir"/etc/ppp/ip-up
......@@ -74,9 +76,9 @@ package() {
install -D -m644 "$srcdir"/pon.1 "$pkgdir"/usr/share/man/man1/pon.1
mkdir -p "$pkgdir"/etc/ppp/peers
}
md5sums="4621bc56167b6953ec4071043fe0ec57 ppp-2.4.5.tar.gz
e26f807a61490fedbc9a7632caebd973 defaultroute-metric.3.patch
a1fde30d2ae6e7e6fcef470afc90d13f musl-fix-headers.patch
md5sums="3434d2cc9327167a0723aaaa8670083b ppp-2.4.6.tar.gz
5a5c2d1bdca62979d9ed7a5a648e86d1 defaultroute-metric.3.patch
8d2128c74d62a2844491a24794b05a3e musl-fix-headers.patch
9185f645bb433b22a9951d9d12f79c35 options
48c024f73a80c8b69c4def22f86902cc pon
2d811f8470ccdea3b8c4505a438483e9 poff
......@@ -84,9 +86,9 @@ a1fde30d2ae6e7e6fcef470afc90d13f musl-fix-headers.patch
44cc662ba9aa61dd9add3ddd4c5ded57 pon.1
fac0c773490371ea673f4be0977a230f ip-up
a88b40b1bf91eb5cca3762b7195e4fe2 ip-down"
sha256sums="43317afec9299f9920b96f840414c977f0385410202d48e56d2fdb8230003505 ppp-2.4.5.tar.gz
b6b01f0022120d4575359663b03518e630aa671b11695f2e20776a83f62228e6 defaultroute-metric.3.patch
32bff6e2ffc34677f483d6d7860851270251fb3ce935fcffc7126bfaad10d26d musl-fix-headers.patch
sha256sums="1b33181a03962c8a092c055fb9980e9722728a8d98a4bb7ec7acda17c1b1b49d ppp-2.4.6.tar.gz
1f69c03747ed68eaaaa8b2f0a239e57f167967fc90a6f89d802dcfe77026846f defaultroute-metric.3.patch
b136d5366e64a686a3ea24baaaeb4a37c2654c098dd7fcb263caebf9e9281956 musl-fix-headers.patch
9f473800a48bbaec41b465817ae9c4c53d6b0ce865b4298d9353b30707a39605 options
c92e0721c4f53987dd0a02fe7089d0f5a58cdb7bb9f26d1bddc28111406ce6c2 pon
ee1e1e5f164effe49bc7ffab3fbde6efbd46d186c58192913f749257026d75e2 poff
......@@ -94,9 +96,9 @@ ee1e1e5f164effe49bc7ffab3fbde6efbd46d186c58192913f749257026d75e2 poff
9bb35eac78898cdc75184bb70fea11fb2e2889e1e2cadf0b7bb8320d7cae0959 pon.1
7d44e21ed945434c32a385f44c690826f74c3d5ddac353deae8174692d8d1beb ip-up
84f2b44c9f4b8abdbc9cfbfffb669fa19385b80da55f9c292df115189dc62bd6 ip-down"
sha512sums="3688720a0f9ee47802e72dc6aa3d47c7312c195007f37a6ceb087fdb6f1f77ad75e922a568cffed6d1a857f06d79460d6d38b56e179310e493a0380a0c5a4f6e ppp-2.4.5.tar.gz
135cd073f1a1b6a1213f87b4d201dc3a298f40c0474ecc3ef0bd01bf61f8273d94e22b5a38b54dfa8d5315a64fc53a0bec3bb68123881ea6bb2c22ef759ccd21 defaultroute-metric.3.patch
9423da37d3b002ff0b554419b293bc8507f1c6d0404dfed42bb37194b981a4927ee7cef62798e31b14e46693c6c4a5c1986876c3fafb798e160d99f92601d23c musl-fix-headers.patch
sha512sums="65d6967ba43cd8b4d3f63f52ff69f6fed964f748fc780dff982629668213c2cd1891671f6f4a0c1c22118a382e282fabdd2328e60a120d9b984d3c17f9355cc6 ppp-2.4.6.tar.gz
fccc7a6809ae4a617796ccf1d2132de8edb1cc0c71d76a95393585a5970b92be2a54da558702db355c8aea8d37b4dfffc64406129a2b3322f0b10e8f0481f685 defaultroute-metric.3.patch
2f071ea9db15e4abf1bed6cce8130dc81b710a31bfef5fa8f9370c353f845dbc47674b1551b8e040478e5156add6f98d480530206125e8bb308f0f4288d1eec6 musl-fix-headers.patch
cabcaa8d44f0da399326b7f93267d4786b32f69c6fa7a78ab451575a8cc594f2a259406166c874d88ecfc0861b8b4abdb3b653cf1cb00e2f2838ea880962f6ee options
29233c8010f511792c2dcf54ee06ede271994ef029b6b526aeeb17433233ef6b638b96346d81db55c2a6bb25fb07633328415cd3af55dadd78a32b1d45b07dd8 pon
3605ce49bad21473ef5f3ff2421e1ef7687e9267986503deca63ae3a2baa6308e8d031cb1da2f93b5b73dc292206a49c59cea17b80c129272cc975e07e3c6142 poff
......
Default route metric
From ddea82ad5cb547f3582060d6a0265bb96a0634ea Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 3 Jun 2014 08:53:47 +0000
Subject: [PATCH] pppd: add support for defaultroute-metric option
Define the metric of the default route and only add it if there
is no other default route with the same metric. With the default
value of -1, the route is only added if there is no default route
at all.
This allows user to specify the 'metric' (or 'prio') for the default
route set by pppd. This is useful in multi-ISP setups where there
might be more than one default gateway.
Olivier Mehani <olivier.mehani@nicta.com.au>
Index: ppp-2.4.4/pppd/options.c
===================================================================
--- ppp-2.4.4.orig/pppd/options.c 2006-06-18 21:26:00.000000000 +1000
+++ ppp-2.4.4/pppd/options.c 2010-04-22 17:08:38.000000000 +1000
@@ -119,6 +119,7 @@
bool dryrun; /* print out option values and exit */
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
pppd/options.c | 5 +++++
pppd/pppd.8 | 6 ++++++
pppd/sys-linux.c | 24 ++++++++++++++++--------
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/pppd/options.c b/pppd/options.c
index 45fa742..ca3f875 100644
--- a/pppd/options.c
+++ b/pppd/options.c
@@ -121,6 +121,7 @@ bool dryrun; /* print out option values and exit */
char *domain; /* domain name set by domain option */
int child_wait = 5; /* # seconds to wait for children at exit */
struct userenv *userenv_list; /* user environment variables */
+int dfl_route_metric = -1; /* metric of the default route to set over the PPP link */
#ifdef MAXOCTETS
unsigned int maxoctets = 0; /* default - no limit */
@@ -281,6 +282,10 @@
"Number of seconds to wait for child processes at exit",
OPT_PRIO },
@@ -299,6 +300,10 @@ option_t general_options[] = {
"Unset user environment variable",
OPT_A2PRINTER | OPT_NOPRINT, (void *)user_unsetprint },
+ { "defaultroute-metric", o_int, &dfl_route_metric,
+ "Metric to use for the default route (Linux only; -1 for default behavior)",
......@@ -29,11 +37,28 @@ Index: ppp-2.4.4/pppd/options.c
#ifdef HAVE_MULTILINK
{ "multilink", o_bool, &multilink,
"Enable multilink operation", OPT_PRIO | 1 },
Index: ppp-2.4.4/pppd/sys-linux.c
===================================================================
--- ppp-2.4.4.orig/pppd/sys-linux.c 2005-08-27 08:44:35.000000000 +1000
+++ ppp-2.4.4/pppd/sys-linux.c 2010-04-22 17:09:44.000000000 +1000
@@ -232,7 +232,7 @@
diff --git a/pppd/pppd.8 b/pppd/pppd.8
index e2768b1..c508d27 100644
--- a/pppd/pppd.8
+++ b/pppd/pppd.8
@@ -121,6 +121,12 @@ the gateway, when IPCP negotiation is successfully completed.
This entry is removed when the PPP connection is broken. This option
is privileged if the \fInodefaultroute\fR option has been specified.
.TP
+.B defaultroute-metric
+Define the metric of the \fIdefaultroute\fR and only add it if there
+is no other default route with the same metric. With the default
+value of -1, the route is only added if there is no default route at
+all.
+.TP
.B disconnect \fIscript
Execute the command specified by \fIscript\fR, by passing it to a
shell, after
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
index 72a7727..6d71530 100644
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -232,7 +232,7 @@ static int baud_rate_of (int speed);
static void close_route_table (void);
static int open_route_table (void);
static int read_route_table (struct rtentry *rt);
......@@ -42,7 +67,7 @@ Index: ppp-2.4.4/pppd/sys-linux.c
static int get_ether_addr (u_int32_t ipaddr, struct sockaddr *hwaddr,
char *name, int namelen);
static void decode_version (char *buf, int *version, int *mod, int *patch);
@@ -242,6 +242,8 @@
@@ -242,6 +242,8 @@ static int make_ppp_unit(void);
extern u_char inpacket_buf[]; /* borrowed from main.c */
......@@ -51,7 +76,7 @@ Index: ppp-2.4.4/pppd/sys-linux.c
/*
* SET_SA_FAMILY - set the sa_family field of a struct sockaddr,
* if it exists.
@@ -1526,9 +1528,10 @@
@@ -1550,9 +1552,10 @@ static int read_route_table(struct rtentry *rt)
/********************************************************************
*
* defaultroute_exists - determine if there is a default route
......@@ -63,7 +88,7 @@ Index: ppp-2.4.4/pppd/sys-linux.c
{
int result = 0;
@@ -1541,7 +1544,8 @@
@@ -1565,7 +1568,8 @@ static int defaultroute_exists (struct rtentry *rt)
if (kernel_version > KVERSION(2,1,0) && SIN_ADDR(rt->rt_genmask) != 0)
continue;
......@@ -73,7 +98,7 @@ Index: ppp-2.4.4/pppd/sys-linux.c
result = 1;
break;
}
@@ -1588,13 +1592,13 @@
@@ -1612,13 +1616,13 @@ int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
{
struct rtentry rt;
......@@ -92,7 +117,7 @@ Index: ppp-2.4.4/pppd/sys-linux.c
return 0;
}
@@ -1602,6 +1606,7 @@
@@ -1626,6 +1630,7 @@ int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
SET_SA_FAMILY (rt.rt_dst, AF_INET);
rt.rt_dev = ifname;
......@@ -100,9 +125,9 @@ Index: ppp-2.4.4/pppd/sys-linux.c
if (kernel_version > KVERSION(2,1,0)) {
SET_SA_FAMILY (rt.rt_genmask, AF_INET);
@@ -1634,6 +1639,9 @@
SET_SA_FAMILY (rt.rt_dst, AF_INET);
SET_SA_FAMILY (rt.rt_gateway, AF_INET);
@@ -1660,6 +1665,9 @@ int cifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
rt.rt_dev = ifname;
+ rt.rt_dev = ifname;
+ rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */
......@@ -110,20 +135,6 @@ Index: ppp-2.4.4/pppd/sys-linux.c
if (kernel_version > KVERSION(2,1,0)) {
SET_SA_FAMILY (rt.rt_genmask, AF_INET);
SIN_ADDR(rt.rt_genmask) = 0L;
Index: ppp-2.4.4/pppd/pppd.8
===================================================================
--- ppp-2.4.4.orig/pppd/pppd.8 2006-06-16 10:01:23.000000000 +1000
+++ ppp-2.4.4/pppd/pppd.8 2010-04-22 17:08:38.000000000 +1000
@@ -121,6 +121,12 @@
This entry is removed when the PPP connection is broken. This option
is privileged if the \fInodefaultroute\fR option has been specified.
.TP
+.B defaultroute-metric
+Define the metric of the \fIdefaultroute\fR and only add it if there
+is no other default route with the same metric. With the default
+value of -1, the route is only added if there is no default route at
+all.
+.TP
.B disconnect \fIscript
Execute the command specified by \fIscript\fR, by passing it to a
shell, after
--
2.0.0
--- ppp-2.4.5.orig/include/net/ppp_defs.h
+++ ppp-2.4.5/include/net/ppp_defs.h
diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h
index b06eda5..dafa36c 100644
--- a/include/net/ppp_defs.h
+++ b/include/net/ppp_defs.h
@@ -38,6 +38,8 @@
#ifndef _PPP_DEFS_H_
#define _PPP_DEFS_H_
......@@ -9,18 +11,23 @@
/*
* The basic PPP frame.
*/
--- ppp-2.4.5.orig/pppd/ipv6cp.c
+++ ppp-2.4.5/pppd/ipv6cp.c
@@ -151,6 +151,7 @@
*/
diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
index a74c914..7acd2cf 100644
--- a/pppd/Makefile.linux
+++ b/pppd/Makefile.linux
@@ -126,7 +126,7 @@ LIBS += -lcrypt
endif
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
--- ppp-2.4.5.orig/pppd/magic.h
+++ ppp-2.4.5/pppd/magic.h
ifdef USE_LIBUTIL
-CFLAGS += -DHAVE_LOGWTMP=1
+#CFLAGS += -DHAVE_LOGWTMP=1
LIBS += -lutil
endif
diff --git a/pppd/magic.h b/pppd/magic.h
index c81213b..305aece 100644
--- a/pppd/magic.h
+++ b/pppd/magic.h
@@ -42,6 +42,8 @@
* $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $
*/
......@@ -30,31 +37,11 @@
void magic_init __P((void)); /* Initialize the magic number generator */
u_int32_t magic __P((void)); /* Returns the next magic number */
--- ppp-2.4.5.orig/pppd/sys-linux.c
+++ ppp-2.4.5/pppd/sys-linux.c
@@ -102,19 +102,11 @@
#define MAX_ADDR_LEN 7
#endif
-#if __GLIBC__ >= 2
#include <asm/types.h> /* glibc 2 conflicts with linux/types.h */
#include <net/if.h>
#include <net/if_arp.h>
#include <net/route.h>
#include <netinet/if_ether.h>
-#else
-#include <linux/types.h>
-#include <linux/if.h>
-#include <linux/if_arp.h>
-#include <linux/route.h>
-#include <linux/if_ether.h>
-#endif
#include <netinet/in.h>
#include <arpa/inet.h>
--- ppp-2.4.5.orig/pppd/plugins/rp-pppoe/if.c
+++ ppp-2.4.5/pppd/plugins/rp-pppoe/if.c
@@ -30,10 +30,6 @@
diff --git a/pppd/plugins/rp-pppoe/if.c b/pppd/plugins/rp-pppoe/if.c
index 91e9a57..9c0fac3 100644
--- a/pppd/plugins/rp-pppoe/if.c
+++ b/pppd/plugins/rp-pppoe/if.c
@@ -30,10 +30,6 @@ static char const RCSID[] =
#include <linux/if_packet.h>
#endif
......@@ -65,18 +52,22 @@
#ifdef HAVE_ASM_TYPES_H
#include <asm/types.h>
#endif
--- ppp-2.4.5.orig/pppd/plugins/rp-pppoe/plugin.c
+++ ppp-2.4.5/pppd/plugins/rp-pppoe/plugin.c
@@ -46,7 +46,6 @@
diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c
index a8c2bb4..ca34d79 100644
--- a/pppd/plugins/rp-pppoe/plugin.c
+++ b/pppd/plugins/rp-pppoe/plugin.c
@@ -46,7 +46,6 @@ static char const RCSID[] =
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
-#include <net/ethernet.h>
#include <net/if_arp.h>
#include <linux/ppp_defs.h>
#include <linux/if_ppp.h>
--- ppp-2.4.5.orig/pppd/plugins/rp-pppoe/pppoe-discovery.c
+++ ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe-discovery.c
#include <linux/if_pppox.h>
diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c
index 3d3bf4e..b5f82d3 100644
--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
+++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
@@ -27,10 +27,6 @@
#include <linux/if_packet.h>
#endif
......@@ -88,9 +79,20 @@
#ifdef HAVE_ASM_TYPES_H
#include <asm/types.h>
#endif
--- ppp-2.4.5.orig/pppd/plugins/rp-pppoe/pppoe.h
+++ ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe.h
@@ -86,18 +86,6 @@
@@ -55,6 +51,8 @@ void die(int status)
exit(status);
}
+#define error(x...) fprintf(stderr, x)
+
/* Initialize frame types to RFC 2516 values. Some broken peers apparently
use different frame types... sigh... */
diff --git a/pppd/plugins/rp-pppoe/pppoe.h b/pppd/plugins/rp-pppoe/pppoe.h
index 9ab2eee..4d68147 100644
--- a/pppd/plugins/rp-pppoe/pppoe.h
+++ b/pppd/plugins/rp-pppoe/pppoe.h
@@ -86,18 +86,6 @@ typedef unsigned long UINT32_t;
#include <netinet/in.h>
......@@ -109,15 +111,27 @@
/* Ethernet frame types according to RFC 2516 */
#define ETH_PPPOE_DISCOVERY 0x8863
Only in ppp-2.4.5/pppd/plugins/rp-pppoe: pppoe-discovery
--- ppp-2.4.5.orig/pppd/plugins/rp-pppoe/pppoe-discovery.c
+++ ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe-discovery.c
@@ -51,6 +51,8 @@
exit(status);
}
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
index 6d71530..86d224e 100644
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -102,19 +102,11 @@
#define MAX_ADDR_LEN 7
#endif
+#define error(x...) fprintf(stderr, x)
+
/* Initialize frame types to RFC 2516 values. Some broken peers apparently
use different frame types... sigh... */
-#if __GLIBC__ >= 2
#include <asm/types.h> /* glibc 2 conflicts with linux/types.h */
#include <net/if.h>
#include <net/if_arp.h>
#include <net/route.h>
#include <netinet/if_ether.h>
-#else
-#include <linux/types.h>
-#include <linux/if.h>
-#include <linux/if_arp.h>
-#include <linux/route.h>
-#include <linux/if_ether.h>
-#endif
#include <netinet/in.h>
#include <arpa/inet.h>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment