Magellan Linux

Annotation of /trunk/ppp/patches/ppp-2.4.4-defaultmetric.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 797 - (hide annotations) (download)
Mon May 11 09:46:04 2009 UTC (15 years, 1 month ago) by niro
File size: 4190 byte(s)
-added patches from gentoo

1 niro 797 diff -Nru ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c
2     --- ppp-2.4.4.orig/pppd/options.c 2007-08-07 22:19:31.000000000 +0300
3     +++ ppp-2.4.4/pppd/options.c 2007-08-07 22:22:51.000000000 +0300
4     @@ -94,6 +94,7 @@
5     int kdebugflag = 0; /* Tell kernel to print debug messages */
6     int default_device = 1; /* Using /dev/tty or equivalent */
7     char devnam[MAXPATHLEN]; /* Device name */
8     +int defaultmetric = 0; /* Metric of the default route */
9     bool nodetach = 0; /* Don't detach from controlling tty */
10     bool updetach = 0; /* Detach once link is up */
11     int maxconnect = 0; /* Maximum connect time */
12     @@ -289,6 +290,10 @@
13     "Number of seconds to wait for child processes at exit",
14     OPT_PRIO },
15    
16     + { "defaultmetric", o_int, &defaultmetric,
17     + "The metric of the default route",
18     + OPT_LIMITS, 0, 32766 },
19     +
20     #ifdef HAVE_MULTILINK
21     { "multilink", o_bool, &multilink,
22     "Enable multilink operation", OPT_PRIO | 1 },
23     diff -Nru ppp-2.4.4.orig/pppd/pppd.8 ppp-2.4.4/pppd/pppd.8
24     --- ppp-2.4.4.orig/pppd/pppd.8 2007-08-07 22:19:31.000000000 +0300
25     +++ ppp-2.4.4/pppd/pppd.8 2007-08-07 22:21:33.000000000 +0300
26     @@ -121,6 +121,9 @@
27     This entry is removed when the PPP connection is broken. This option
28     is privileged if the \fInodefaultroute\fR option has been specified.
29     .TP
30     +.B defaultmetric \fIn
31     +The metric of the default route configured by pppd; default is 0.
32     +.TP
33     .B disconnect \fIscript
34     Execute the command specified by \fIscript\fR, by passing it to a
35     shell, after
36     diff -Nru ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h
37     --- ppp-2.4.4.orig/pppd/pppd.h 2007-08-07 22:19:31.000000000 +0300
38     +++ ppp-2.4.4/pppd/pppd.h 2007-08-07 22:24:09.000000000 +0300
39     @@ -276,6 +276,7 @@
40     extern int kdebugflag; /* Tell kernel to print debug messages */
41     extern int default_device; /* Using /dev/tty or equivalent */
42     extern char devnam[MAXPATHLEN]; /* Device name */
43     +extern int defaultmetric; /* Metric of the default route */
44     extern int crtscts; /* Use hardware flow control */
45     extern bool modem; /* Use modem control lines */
46     extern int inspeed; /* Input/Output speed requested */
47     diff -Nru ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c
48     --- ppp-2.4.4.orig/pppd/sys-linux.c 2007-08-07 22:19:31.000000000 +0300
49     +++ ppp-2.4.4/pppd/sys-linux.c 2007-08-07 22:21:33.000000000 +0300
50     @@ -1441,7 +1441,7 @@
51     FILE *route_fd = (FILE *) 0;
52     static char route_buffer[512];
53     static int route_dev_col, route_dest_col, route_gw_col;
54     -static int route_flags_col, route_mask_col;
55     +static int route_flags_col, route_mask_col, route_metric_col;
56     static int route_num_cols;
57    
58     static int open_route_table (void);
59     @@ -1484,6 +1484,7 @@
60     route_dest_col = 1;
61     route_gw_col = 2;
62     route_flags_col = 3;
63     + route_metric_col = 6;
64     route_mask_col = 7;
65     route_num_cols = 8;
66    
67     @@ -1503,6 +1504,8 @@
68     route_gw_col = col;
69     else if (strcasecmp(q, "flags") == 0)
70     route_flags_col = col;
71     + else if (strcasecmp(q, "metric") == 0)
72     + route_metric_col = col;
73     else if (strcasecmp(q, "mask") == 0)
74     route_mask_col = col;
75     else
76     @@ -1545,6 +1548,7 @@
77    
78     rt->rt_flags = (short) strtoul(cols[route_flags_col], NULL, 16);
79     rt->rt_dev = cols[route_dev_col];
80     + rt->rt_metric = (short) strtoul(cols[route_metric_col], NULL, 16);
81    
82     return 1;
83     }
84     @@ -1567,6 +1571,8 @@
85    
86     if (kernel_version > KVERSION(2,1,0) && SIN_ADDR(rt->rt_genmask) != 0)
87     continue;
88     + if (rt->rt_metric != defaultmetric) /* consider only routes with the same metric */
89     + continue;
90     if (SIN_ADDR(rt->rt_dst) == 0L) {
91     result = 1;
92     break;
93     @@ -1637,6 +1643,7 @@
94     SIN_ADDR(rt.rt_gateway) = gateway;
95    
96     rt.rt_flags = RTF_UP | RTF_GATEWAY;
97     + rt.rt_metric = defaultmetric + 1; /* +1 for binary compatibility */
98     if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) {
99     if ( ! ok_error ( errno ))
100     error("default route ioctl(SIOCADDRT): %m");
101     @@ -1670,6 +1677,7 @@
102     SIN_ADDR(rt.rt_gateway) = gateway;
103    
104     rt.rt_flags = RTF_UP | RTF_GATEWAY;
105     + rt.rt_metric = defaultmetric + 1; /* +1 for binary compatibility */
106     if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) {
107     if (still_ppp()) {
108     if ( ! ok_error ( errno ))