aboutsummaryrefslogtreecommitdiffstats
path: root/main/ppp/defaultroute-metric.3.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-06-03 09:12:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-06-03 09:21:26 +0000
commit28648190fd6f9d06d4db3f636dd91af48f293158 (patch)
tree0d2c64a20a3bd54951221dd8a3b451972410c2a4 /main/ppp/defaultroute-metric.3.patch
parent80e7a7e86c28c23fff4fd31edce1fdf48727a6ce (diff)
downloadaports-28648190fd6f9d06d4db3f636dd91af48f293158.tar.bz2
aports-28648190fd6f9d06d4db3f636dd91af48f293158.tar.xz
main/ppp: upgrade to 2.4.6 and ship net/ppp_defs.h
Diffstat (limited to 'main/ppp/defaultroute-metric.3.patch')
-rw-r--r--main/ppp/defaultroute-metric.3.patch101
1 files changed, 56 insertions, 45 deletions
diff --git a/main/ppp/defaultroute-metric.3.patch b/main/ppp/defaultroute-metric.3.patch
index 2eee724c23..d4dc5df325 100644
--- a/main/ppp/defaultroute-metric.3.patch
+++ b/main/ppp/defaultroute-metric.3.patch
@@ -1,26 +1,34 @@
-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
+