diff options
| author | Richard Purdie <richard@openedhand.com> | 2005-08-31 10:45:47 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2005-08-31 10:45:47 +0000 |
| commit | 4b46c1f6e891b1ddd5968536440b888661fade3e (patch) | |
| tree | e0ba2c1f56f61b868bf746da5c4feabb25b800b2 /openembedded/packages/ppp | |
| download | poky-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.gz | |
Initial population
git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/packages/ppp')
| -rw-r--r-- | openembedded/packages/ppp/files/08setupdns | 12 | ||||
| -rw-r--r-- | openembedded/packages/ppp/files/92removedns | 5 | ||||
| -rwxr-xr-x | openembedded/packages/ppp/files/init | 50 | ||||
| -rwxr-xr-x | openembedded/packages/ppp/files/ip-down | 43 | ||||
| -rwxr-xr-x | openembedded/packages/ppp/files/ip-up | 44 | ||||
| -rw-r--r-- | openembedded/packages/ppp/files/poff | 26 | ||||
| -rw-r--r-- | openembedded/packages/ppp/files/pon | 9 | ||||
| -rw-r--r-- | openembedded/packages/ppp/ppp-2.4.3/cifdefroute.patch | 286 | ||||
| -rw-r--r-- | openembedded/packages/ppp/ppp-2.4.3/makefile.patch | 89 | ||||
| -rw-r--r-- | openembedded/packages/ppp/ppp-2.4.3/plugins-fix-CC.patch | 7 | ||||
| -rw-r--r-- | openembedded/packages/ppp/ppp-2.4.3/pppd-resolv-varrun.patch | 43 | ||||
| -rw-r--r-- | openembedded/packages/ppp/ppp_2.4.3.bb | 65 |
12 files changed, 679 insertions, 0 deletions
diff --git a/openembedded/packages/ppp/files/08setupdns b/openembedded/packages/ppp/files/08setupdns new file mode 100644 index 0000000000..998219de97 --- /dev/null +++ b/openembedded/packages/ppp/files/08setupdns | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | ACTUALCONF=/var/run/resolv.conf | ||
| 3 | PPPCONF=/var/run/ppp/resolv.conf | ||
| 4 | if [ -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 | ||
| 12 | fi | ||
diff --git a/openembedded/packages/ppp/files/92removedns b/openembedded/packages/ppp/files/92removedns new file mode 100644 index 0000000000..2eadec6899 --- /dev/null +++ b/openembedded/packages/ppp/files/92removedns | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | ACTUALCONF=/var/run/resolv.conf | ||
| 3 | if [ -f $ACTUALCONF.ppporig ] ; then | ||
| 4 | mv $ACTUALCONF.ppporig $ACTUALCONF | ||
| 5 | fi | ||
diff --git a/openembedded/packages/ppp/files/init b/openembedded/packages/ppp/files/init new file mode 100755 index 0000000000..5b3b7abe2f --- /dev/null +++ b/openembedded/packages/ppp/files/init | |||
| @@ -0,0 +1,50 @@ | |||
| 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 | test -x /usr/sbin/pppd -a -f /etc/ppp/ppp_on_boot || exit 0 | ||
| 10 | if [ -x /etc/ppp/ppp_on_boot ]; then RUNFILE=1; fi | ||
| 11 | |||
| 12 | case "$1" in | ||
| 13 | start) | ||
| 14 | echo -n "Starting up PPP link: pppd" | ||
| 15 | if [ "$RUNFILE" = "1" ]; then | ||
| 16 | /etc/ppp/ppp_on_boot | ||
| 17 | else | ||
| 18 | pppd call provider | ||
| 19 | fi | ||
| 20 | echo "." | ||
| 21 | ;; | ||
| 22 | stop) | ||
| 23 | echo -n "Shutting down PPP link: pppd" | ||
| 24 | if [ "$RUNFILE" = "1" ]; then | ||
| 25 | poff | ||
| 26 | else | ||
| 27 | poff provider | ||
| 28 | fi | ||
| 29 | echo "." | ||
| 30 | ;; | ||
| 31 | restart|force-reload) | ||
| 32 | echo -n "Restarting PPP link: pppd" | ||
| 33 | if [ "$RUNFILE" = "1" ]; then | ||
| 34 | poff | ||
| 35 | sleep 5 | ||
| 36 | /etc/ppp/ppp_on_boot | ||
| 37 | else | ||
| 38 | poff provider | ||
| 39 | sleep 5 | ||
| 40 | pppd call provider | ||
| 41 | fi | ||
| 42 | echo "." | ||
| 43 | ;; | ||
| 44 | *) | ||
| 45 | echo "Usage: /etc/init.d/ppp {start|stop|restart|force-reload}" | ||
| 46 | exit 1 | ||
| 47 | ;; | ||
| 48 | esac | ||
| 49 | |||
| 50 | exit 0 | ||
diff --git a/openembedded/packages/ppp/files/ip-down b/openembedded/packages/ppp/files/ip-down new file mode 100755 index 0000000000..06d35487a5 --- /dev/null +++ b/openembedded/packages/ppp/files/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 | ||
| 23 | PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin | ||
| 24 | export PATH | ||
| 25 | # These variables are for the use of the scripts run by run-parts | ||
| 26 | PPP_IFACE="$1" | ||
| 27 | PPP_TTY="$2" | ||
| 28 | PPP_SPEED="$3" | ||
| 29 | PPP_LOCAL="$4" | ||
| 30 | PPP_REMOTE="$5" | ||
| 31 | PPP_IPPARAM="$6" | ||
| 32 | export 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. | ||
| 36 | PPP_TTYNAME=`/usr/bin/basename "$2"` | ||
| 37 | export PPP_TTYNAME | ||
| 38 | |||
| 39 | # Main Script starts here | ||
| 40 | |||
| 41 | run-parts /etc/ppp/ip-down.d | ||
| 42 | |||
| 43 | # last line | ||
diff --git a/openembedded/packages/ppp/files/ip-up b/openembedded/packages/ppp/files/ip-up new file mode 100755 index 0000000000..fc2fae9fe0 --- /dev/null +++ b/openembedded/packages/ppp/files/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 | ||
| 23 | PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin | ||
| 24 | export PATH | ||
| 25 | # These variables are for the use of the scripts run by run-parts | ||
| 26 | PPP_IFACE="$1" | ||
| 27 | PPP_TTY="$2" | ||
| 28 | PPP_SPEED="$3" | ||
| 29 | PPP_LOCAL="$4" | ||
| 30 | PPP_REMOTE="$5" | ||
| 31 | PPP_IPPARAM="$6" | ||
| 32 | export 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. | ||
| 37 | PPP_TTYNAME=`/usr/bin/basename "$2"` | ||
| 38 | export PPP_TTYNAME | ||
| 39 | |||
| 40 | # Main Script starts here | ||
| 41 | |||
| 42 | run-parts /etc/ppp/ip-up.d | ||
| 43 | |||
| 44 | # last line | ||
diff --git a/openembedded/packages/ppp/files/poff b/openembedded/packages/ppp/files/poff new file mode 100644 index 0000000000..0521a9406a --- /dev/null +++ b/openembedded/packages/ppp/files/poff | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Lets see how many pppds are running.... | ||
| 4 | set -- `cat /var/run/ppp*.pid 2>/dev/null` | ||
| 5 | |||
| 6 | case $# 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 | ;; | ||
| 19 | esac | ||
| 20 | |||
| 21 | if [ -r /var/run/ppp-quick ] | ||
| 22 | then | ||
| 23 | rm -f /var/run/ppp-quick | ||
| 24 | fi | ||
| 25 | |||
| 26 | exit 0 | ||
diff --git a/openembedded/packages/ppp/files/pon b/openembedded/packages/ppp/files/pon new file mode 100644 index 0000000000..91c059501a --- /dev/null +++ b/openembedded/packages/ppp/files/pon | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | if [ "$1" = "quick" ] | ||
| 4 | then | ||
| 5 | touch /var/run/ppp-quick | ||
| 6 | shift | ||
| 7 | fi | ||
| 8 | |||
| 9 | /usr/sbin/pppd call ${1:-provider} | ||
diff --git a/openembedded/packages/ppp/ppp-2.4.3/cifdefroute.patch b/openembedded/packages/ppp/ppp-2.4.3/cifdefroute.patch new file mode 100644 index 0000000000..d61b920c50 --- /dev/null +++ b/openembedded/packages/ppp/ppp-2.4.3/cifdefroute.patch | |||
| @@ -0,0 +1,286 @@ | |||
| 1 | |||
| 2 | # | ||
| 3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
| 4 | # | ||
| 5 | |||
| 6 | --- ppp-2.4.3/pppd/ipcp.c~cifdefroute.patch | ||
| 7 | +++ ppp-2.4.3/pppd/ipcp.c | ||
| 8 | @@ -197,6 +197,16 @@ | ||
| 9 | "disable defaultroute option", OPT_ALIAS | OPT_A2CLR, | ||
| 10 | &ipcp_wantoptions[0].default_route }, | ||
| 11 | |||
| 12 | +#ifdef __linux__ | ||
| 13 | + { "replacedefaultroute", o_bool, | ||
| 14 | + &ipcp_wantoptions[0].replace_default_route, | ||
| 15 | + "Replace default route", 1 | ||
| 16 | + }, | ||
| 17 | + { "noreplacedefaultroute", o_bool, | ||
| 18 | + &ipcp_allowoptions[0].replace_default_route, | ||
| 19 | + "Never replace default route", OPT_A2COPY, | ||
| 20 | + &ipcp_wantoptions[0].replace_default_route }, | ||
| 21 | +#endif | ||
| 22 | { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp, | ||
| 23 | "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp }, | ||
| 24 | { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp, | ||
| 25 | @@ -263,7 +273,7 @@ | ||
| 26 | ip_active_pkt | ||
| 27 | }; | ||
| 28 | |||
| 29 | -static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t)); | ||
| 30 | +static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool)); | ||
| 31 | static void ipcp_script __P((char *)); /* Run an up/down script */ | ||
| 32 | static void ipcp_script_done __P((void *)); | ||
| 33 | |||
| 34 | @@ -1659,7 +1669,12 @@ | ||
| 35 | if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE)) | ||
| 36 | return 0; | ||
| 37 | if (wo->default_route) | ||
| 38 | +#ifndef __linux__ | ||
| 39 | if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr)) | ||
| 40 | +#else | ||
| 41 | + if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr, | ||
| 42 | + wo->replace_default_route)) | ||
| 43 | +#endif | ||
| 44 | default_route_set[u] = 1; | ||
| 45 | if (wo->proxy_arp) | ||
| 46 | if (sifproxyarp(u, wo->hisaddr)) | ||
| 47 | @@ -1741,7 +1756,8 @@ | ||
| 48 | */ | ||
| 49 | if (demand) { | ||
| 50 | if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) { | ||
| 51 | - ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr); | ||
| 52 | + ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr, | ||
| 53 | + wo->replace_default_route); | ||
| 54 | if (go->ouraddr != wo->ouraddr) { | ||
| 55 | warn("Local IP address changed to %I", go->ouraddr); | ||
| 56 | script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0); | ||
| 57 | @@ -1766,7 +1782,12 @@ | ||
| 58 | |||
| 59 | /* assign a default route through the interface if required */ | ||
| 60 | if (ipcp_wantoptions[f->unit].default_route) | ||
| 61 | +#ifndef __linux__ | ||
| 62 | if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) | ||
| 63 | +#else | ||
| 64 | + if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, | ||
| 65 | + wo->replace_default_route)) | ||
| 66 | +#endif | ||
| 67 | default_route_set[f->unit] = 1; | ||
| 68 | |||
| 69 | /* Make a proxy ARP entry if requested. */ | ||
| 70 | @@ -1813,7 +1834,12 @@ | ||
| 71 | |||
| 72 | /* assign a default route through the interface if required */ | ||
| 73 | if (ipcp_wantoptions[f->unit].default_route) | ||
| 74 | +#ifndef __linux__ | ||
| 75 | if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) | ||
| 76 | +#else | ||
| 77 | + if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, | ||
| 78 | + wo->replace_default_route)) | ||
| 79 | +#endif | ||
| 80 | default_route_set[f->unit] = 1; | ||
| 81 | |||
| 82 | /* Make a proxy ARP entry if requested. */ | ||
| 83 | @@ -1890,7 +1916,7 @@ | ||
| 84 | sifnpmode(f->unit, PPP_IP, NPMODE_DROP); | ||
| 85 | sifdown(f->unit); | ||
| 86 | ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, | ||
| 87 | - ipcp_hisoptions[f->unit].hisaddr); | ||
| 88 | + ipcp_hisoptions[f->unit].hisaddr, 0); | ||
| 89 | } | ||
| 90 | |||
| 91 | /* Execute the ip-down script */ | ||
| 92 | @@ -1906,16 +1932,25 @@ | ||
| 93 | * proxy arp entries, etc. | ||
| 94 | */ | ||
| 95 | static void | ||
| 96 | -ipcp_clear_addrs(unit, ouraddr, hisaddr) | ||
| 97 | +ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute) | ||
| 98 | int unit; | ||
| 99 | u_int32_t ouraddr; /* local address */ | ||
| 100 | u_int32_t hisaddr; /* remote address */ | ||
| 101 | + bool replacedefaultroute; | ||
| 102 | { | ||
| 103 | if (proxy_arp_set[unit]) { | ||
| 104 | cifproxyarp(unit, hisaddr); | ||
| 105 | proxy_arp_set[unit] = 0; | ||
| 106 | } | ||
| 107 | - if (default_route_set[unit]) { | ||
| 108 | + /* If replacedefaultroute, sifdefaultroute will be called soon | ||
| 109 | + * with replacedefaultroute set and that will overwrite the current | ||
| 110 | + * default route. This is the case only when doing demand, otherwise | ||
| 111 | + * during demand, this cifdefaultroute would restore the old default | ||
| 112 | + * route which is not what we want in this case. In the non-demand | ||
| 113 | + * case, we'll delete the default route and restore the old if there | ||
| 114 | + * is one saved by an sifdefaultroute with replacedefaultroute. | ||
| 115 | + */ | ||
| 116 | + if (!replacedefaultroute && default_route_set[unit]) { | ||
| 117 | cifdefaultroute(unit, ouraddr, hisaddr); | ||
| 118 | default_route_set[unit] = 0; | ||
| 119 | } | ||
| 120 | --- ppp-2.4.3/pppd/ipcp.h~cifdefroute.patch | ||
| 121 | +++ ppp-2.4.3/pppd/ipcp.h | ||
| 122 | @@ -70,6 +70,7 @@ | ||
| 123 | bool old_addrs; /* Use old (IP-Addresses) option? */ | ||
| 124 | bool req_addr; /* Ask peer to send IP address? */ | ||
| 125 | bool default_route; /* Assign default route through interface? */ | ||
| 126 | + bool replace_default_route; /* Replace default route through interface? */ | ||
| 127 | bool proxy_arp; /* Make proxy ARP entry for peer? */ | ||
| 128 | bool neg_vj; /* Van Jacobson Compression? */ | ||
| 129 | bool old_vj; /* use old (short) form of VJ option? */ | ||
| 130 | --- ppp-2.4.3/pppd/pppd.8~cifdefroute.patch | ||
| 131 | +++ ppp-2.4.3/pppd/pppd.8 | ||
| 132 | @@ -120,6 +120,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 | @@ -701,7 +708,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 | ||
| 160 | --- ppp-2.4.3/pppd/pppd.h~cifdefroute.patch | ||
| 161 | +++ ppp-2.4.3/pppd/pppd.h | ||
| 162 | @@ -640,7 +640,11 @@ | ||
| 163 | int cif6addr __P((int, eui64_t, eui64_t)); | ||
| 164 | /* Remove an IPv6 address from i/f */ | ||
| 165 | #endif | ||
| 166 | +#ifndef __linux__ | ||
| 167 | int sifdefaultroute __P((int, u_int32_t, u_int32_t)); | ||
| 168 | +#else | ||
| 169 | +int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt)); | ||
| 170 | +#endif | ||
| 171 | /* Create default route through i/f */ | ||
| 172 | int cifdefaultroute __P((int, u_int32_t, u_int32_t)); | ||
| 173 | /* Delete default route through i/f */ | ||
| 174 | --- ppp-2.4.3/pppd/sys-linux.c~cifdefroute.patch | ||
| 175 | +++ ppp-2.4.3/pppd/sys-linux.c | ||
| 176 | @@ -206,6 +206,8 @@ | ||
| 177 | |||
| 178 | static int if_is_up; /* Interface has been marked up */ | ||
| 179 | static u_int32_t default_route_gateway; /* Gateway for default route added */ | ||
| 180 | +static struct rtentry old_def_rt; /* Old default route */ | ||
| 181 | +static int default_rt_repl_rest; /* replace and restore old default rt */ | ||
| 182 | static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */ | ||
| 183 | static char proxy_arp_dev[16]; /* Device for proxy arp entry */ | ||
| 184 | static u_int32_t our_old_addr; /* for detecting address changes */ | ||
| 185 | @@ -1513,6 +1515,9 @@ | ||
| 186 | p = NULL; | ||
| 187 | } | ||
| 188 | |||
| 189 | + SET_SA_FAMILY (rt->rt_dst, AF_INET); | ||
| 190 | + SET_SA_FAMILY (rt->rt_gateway, AF_INET); | ||
| 191 | + | ||
| 192 | SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16); | ||
| 193 | SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16); | ||
| 194 | SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16); | ||
| 195 | @@ -1582,19 +1587,53 @@ | ||
| 196 | /******************************************************************** | ||
| 197 | * | ||
| 198 | * sifdefaultroute - assign a default route through the address given. | ||
| 199 | + * | ||
| 200 | + * If the global default_rt_repl_rest flag is set, then this function | ||
| 201 | + * already replaced the original system defaultroute with some other | ||
| 202 | + * route and it should just replace the current defaultroute with | ||
| 203 | + * another one, without saving the current route. Use: demand mode, | ||
| 204 | + * when pppd sets first a defaultroute it it's temporary ppp0 addresses | ||
| 205 | + * and then changes the temporary addresses to the addresses for the real | ||
| 206 | + * ppp connection when it has come up. | ||
| 207 | */ | ||
| 208 | |||
| 209 | -int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway) | ||
| 210 | +int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace) | ||
| 211 | { | ||
| 212 | - struct rtentry rt; | ||
| 213 | + struct rtentry rt, tmp_rt; | ||
| 214 | + struct rtentry *del_rt = NULL; | ||
| 215 | |||
| 216 | - if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) { | ||
| 217 | - u_int32_t old_gateway = SIN_ADDR(rt.rt_gateway); | ||
| 218 | + | ||
| 219 | + if (default_rt_repl_rest) { | ||
| 220 | + /* We have already reclaced the original defaultroute, if we | ||
| 221 | + * are called again, we will delete the current default route | ||
| 222 | + * and set the new default route in this function. | ||
| 223 | + * - this is normally only the case the doing demand: */ | ||
| 224 | + if (defaultroute_exists( &tmp_rt )) | ||
| 225 | + del_rt = &tmp_rt; | ||
| 226 | + } else if ( defaultroute_exists( &old_def_rt ) && | ||
| 227 | + strcmp( old_def_rt.rt_dev, ifname ) != 0) { | ||
| 228 | + /* We did not yet replace an existing default route, let's | ||
| 229 | + * check if we should save and replace a default route: | ||
| 230 | + */ | ||
| 231 | + u_int32_t old_gateway = SIN_ADDR(old_def_rt.rt_gateway); | ||
| 232 | |||
| 233 | - if (old_gateway != gateway) | ||
| 234 | - error("not replacing existing default route to %s [%I]", | ||
| 235 | - rt.rt_dev, old_gateway); | ||
| 236 | - return 0; | ||
| 237 | + if (old_gateway != gateway) { | ||
| 238 | + if (!replace) { | ||
| 239 | + error("not replacing default route to %s [%I]", | ||
| 240 | + old_def_rt.rt_dev, old_gateway); | ||
| 241 | + return 0; | ||
| 242 | + } else { | ||
| 243 | + // we need to copy rt_dev because we need it permanent too: | ||
| 244 | + char * tmp_dev = malloc(strlen(old_def_rt.rt_dev)+1); | ||
| 245 | + strcpy(tmp_dev, old_def_rt.rt_dev); | ||
| 246 | + old_def_rt.rt_dev = tmp_dev; | ||
| 247 | + | ||
| 248 | + notice("replacing old default route to %s [%I]", | ||
| 249 | + old_def_rt.rt_dev, old_gateway); | ||
| 250 | + default_rt_repl_rest = 1; | ||
| 251 | + del_rt = &old_def_rt; | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | } | ||
| 255 | |||
| 256 | memset (&rt, '\0', sizeof (rt)); | ||
| 257 | @@ -1616,6 +1655,12 @@ | ||
| 258 | error("default route ioctl(SIOCADDRT): %m"); | ||
| 259 | return 0; | ||
| 260 | } | ||
| 261 | + if (default_rt_repl_rest && del_rt) | ||
| 262 | + if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) { | ||
| 263 | + if ( ! ok_error ( errno )) | ||
| 264 | + error("del old default route ioctl(SIOCDELRT): %m(%d)", errno); | ||
| 265 | + return 0; | ||
| 266 | + } | ||
| 267 | |||
| 268 | default_route_gateway = gateway; | ||
| 269 | return 1; | ||
| 270 | @@ -1651,6 +1696,16 @@ | ||
| 271 | return 0; | ||
| 272 | } | ||
| 273 | } | ||
| 274 | + if (default_rt_repl_rest) { | ||
| 275 | + notice("restoring old default route to %s [%I]", | ||
| 276 | + old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway)); | ||
| 277 | + if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) { | ||
| 278 | + if ( ! ok_error ( errno )) | ||
| 279 | + error("restore default route ioctl(SIOCADDRT): %m(%d)", errno); | ||
| 280 | + return 0; | ||
| 281 | + } | ||
| 282 | + default_rt_repl_rest = 0; | ||
| 283 | + } | ||
| 284 | |||
| 285 | return 1; | ||
| 286 | } | ||
diff --git a/openembedded/packages/ppp/ppp-2.4.3/makefile.patch b/openembedded/packages/ppp/ppp-2.4.3/makefile.patch new file mode 100644 index 0000000000..4b9cf30cdd --- /dev/null +++ b/openembedded/packages/ppp/ppp-2.4.3/makefile.patch | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | |||
| 2 | # | ||
| 3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
| 4 | # | ||
| 5 | |||
| 6 | --- ppp-2.4.3/chat/Makefile.linux~pppd.patch | ||
| 7 | +++ ppp-2.4.3/chat/Makefile.linux | ||
| 8 | @@ -25,7 +25,7 @@ | ||
| 9 | |||
| 10 | install: chat | ||
| 11 | mkdir -p $(BINDIR) | ||
| 12 | - $(INSTALL) -s -c chat $(BINDIR) | ||
| 13 | + $(INSTALL) -c chat $(BINDIR) | ||
| 14 | $(INSTALL) -c -m 644 chat.8 $(MANDIR) | ||
| 15 | |||
| 16 | clean: | ||
| 17 | --- ppp-2.4.3/pppd/Makefile.linux~pppd.patch | ||
| 18 | +++ ppp-2.4.3/pppd/Makefile.linux | ||
| 19 | @@ -99,7 +99,7 @@ | ||
| 20 | CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include | ||
| 21 | LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto | ||
| 22 | TARGETS += srp-entry | ||
| 23 | -EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry | ||
| 24 | +EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry | ||
| 25 | MANPAGES += srp-entry.8 | ||
| 26 | EXTRACLEAN += srp-entry.o | ||
| 27 | NEEDDES=y | ||
| 28 | @@ -202,7 +202,7 @@ | ||
| 29 | install: pppd | ||
| 30 | mkdir -p $(BINDIR) $(MANDIR) | ||
| 31 | $(EXTRAINSTALL) | ||
| 32 | - $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd | ||
| 33 | + $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd | ||
| 34 | if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \ | ||
| 35 | chmod o-rx,u+s $(BINDIR)/pppd; fi | ||
| 36 | $(INSTALL) -c -m 444 pppd.8 $(MANDIR) | ||
| 37 | --- ppp-2.4.3/pppdump/Makefile.linux~pppd.patch | ||
| 38 | +++ ppp-2.4.3/pppdump/Makefile.linux | ||
| 39 | @@ -17,5 +17,5 @@ | ||
| 40 | |||
| 41 | install: | ||
| 42 | mkdir -p $(BINDIR) $(MANDIR) | ||
| 43 | - $(INSTALL) -s -c pppdump $(BINDIR) | ||
| 44 | + $(INSTALL) -c pppdump $(BINDIR) | ||
| 45 | $(INSTALL) -c -m 444 pppdump.8 $(MANDIR) | ||
| 46 | --- ppp-2.4.3/pppstats/Makefile.linux~pppd.patch | ||
| 47 | +++ ppp-2.4.3/pppstats/Makefile.linux | ||
| 48 | @@ -22,7 +22,7 @@ | ||
| 49 | |||
| 50 | install: pppstats | ||
| 51 | -mkdir -p $(MANDIR) | ||
| 52 | - $(INSTALL) -s -c pppstats $(BINDIR) | ||
| 53 | + $(INSTALL) -c pppstats $(BINDIR) | ||
| 54 | $(INSTALL) -c -m 444 pppstats.8 $(MANDIR) | ||
| 55 | |||
| 56 | pppstats: $(PPPSTATSRCS) | ||
| 57 | --- ppp-2.4.3/pppd/plugins/rp-pppoe/Makefile.linux~pppd.patch | ||
| 58 | +++ ppp-2.4.3/pppd/plugins/rp-pppoe/Makefile.linux | ||
| 59 | @@ -39,9 +39,9 @@ | ||
| 60 | |||
| 61 | install: all | ||
| 62 | $(INSTALL) -d -m 755 $(LIBDIR) | ||
| 63 | - $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR) | ||
| 64 | + $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR) | ||
| 65 | $(INSTALL) -d -m 755 $(BINDIR) | ||
| 66 | - $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR) | ||
| 67 | + $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR) | ||
| 68 | |||
| 69 | clean: | ||
| 70 | rm -f *.o *.so | ||
| 71 | --- ppp-2.4.3/pppd/plugins/radius/Makefile.linux~pppd.patch | ||
| 72 | +++ ppp-2.4.3/pppd/plugins/radius/Makefile.linux | ||
| 73 | @@ -36,11 +36,11 @@ | ||
| 74 | |||
| 75 | install: all | ||
| 76 | $(INSTALL) -d -m 755 $(LIBDIR) | ||
| 77 | - $(INSTALL) -s -c -m 755 radius.so $(LIBDIR) | ||
| 78 | - $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR) | ||
| 79 | - $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR) | ||
| 80 | - $(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR) | ||
| 81 | - $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) | ||
| 82 | + $(INSTALL) -c -m 755 radius.so $(LIBDIR) | ||
| 83 | + $(INSTALL) -c -m 755 radattr.so $(LIBDIR) | ||
| 84 | + $(INSTALL) -c -m 755 radrealms.so $(LIBDIR) | ||
| 85 | + $(INSTALL) -m 444 pppd-radius.8 $(MANDIR) | ||
| 86 | + $(INSTALL) -m 444 pppd-radattr.8 $(MANDIR) | ||
| 87 | |||
| 88 | radius.so: radius.o libradiusclient.a | ||
| 89 | $(CC) -o radius.so -shared radius.o libradiusclient.a | ||
diff --git a/openembedded/packages/ppp/ppp-2.4.3/plugins-fix-CC.patch b/openembedded/packages/ppp/ppp-2.4.3/plugins-fix-CC.patch new file mode 100644 index 0000000000..ac3822ac1d --- /dev/null +++ b/openembedded/packages/ppp/ppp-2.4.3/plugins-fix-CC.patch | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | --- ppp-2.4.3/pppd/plugins/Makefile.linux~ 2004-11-13 23:57:35.000000000 -0800 | ||
| 2 | +++ ppp-2.4.3/pppd/plugins/Makefile.linux 2005-08-11 17:19:28.000000000 -0700 | ||
| 3 | @@ -1,4 +1,3 @@ | ||
| 4 | -CC = gcc | ||
| 5 | COPTS = -O2 -g | ||
| 6 | CFLAGS = $(COPTS) -I.. -I../../include -fPIC | ||
| 7 | LDFLAGS = -shared | ||
diff --git a/openembedded/packages/ppp/ppp-2.4.3/pppd-resolv-varrun.patch b/openembedded/packages/ppp/ppp-2.4.3/pppd-resolv-varrun.patch new file mode 100644 index 0000000000..c22d8cc085 --- /dev/null +++ b/openembedded/packages/ppp/ppp-2.4.3/pppd-resolv-varrun.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | |||
| 2 | # | ||
| 3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
| 4 | # | ||
| 5 | |||
| 6 | --- ppp-2.4.3/pppd/ipcp.c~pppd-resolv-varrun.patch | ||
| 7 | +++ ppp-2.4.3/pppd/ipcp.c | ||
| 8 | @@ -55,6 +55,8 @@ | ||
| 9 | #include <sys/socket.h> | ||
| 10 | #include <netinet/in.h> | ||
| 11 | #include <arpa/inet.h> | ||
| 12 | +#include <sys/stat.h> | ||
| 13 | +#include <unistd.h> | ||
| 14 | |||
| 15 | #include "pppd.h" | ||
| 16 | #include "fsm.h" | ||
| 17 | @@ -2032,6 +2034,14 @@ | ||
| 18 | u_int32_t peerdns1, peerdns2; | ||
| 19 | { | ||
| 20 | FILE *f; | ||
| 21 | + struct stat dirinfo; | ||
| 22 | + | ||
| 23 | + if(stat(_PATH_OUTDIR, &dirinfo)) { | ||
| 24 | + if(mkdir(_PATH_OUTDIR, 0775)) { | ||
| 25 | + error("Failed to create directory %s: %m", _PATH_OUTDIR); | ||
| 26 | + return; | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | |||
| 30 | f = fopen(_PATH_RESOLV, "w"); | ||
| 31 | if (f == NULL) { | ||
| 32 | --- ppp-2.4.3/pppd/pathnames.h~pppd-resolv-varrun.patch | ||
| 33 | +++ ppp-2.4.3/pppd/pathnames.h | ||
| 34 | @@ -29,7 +29,8 @@ | ||
| 35 | #define _PATH_TTYOPT _ROOT_PATH "/etc/ppp/options." | ||
| 36 | #define _PATH_CONNERRS _ROOT_PATH "/etc/ppp/connect-errors" | ||
| 37 | #define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/" | ||
| 38 | -#define _PATH_RESOLV _ROOT_PATH "/etc/ppp/resolv.conf" | ||
| 39 | +#define _PATH_OUTDIR _ROOT_PATH _PATH_VARRUN "/ppp" | ||
| 40 | +#define _PATH_RESOLV _PATH_OUTDIR "/resolv.conf" | ||
| 41 | |||
| 42 | #define _PATH_USEROPT ".ppprc" | ||
| 43 | #define _PATH_PSEUDONYM ".ppp_pseudonym" | ||
diff --git a/openembedded/packages/ppp/ppp_2.4.3.bb b/openembedded/packages/ppp/ppp_2.4.3.bb new file mode 100644 index 0000000000..29ce2b520d --- /dev/null +++ b/openembedded/packages/ppp/ppp_2.4.3.bb | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | SECTION = "console/network" | ||
| 2 | DESCRIPTION = "Point-to-Point Protocol (PPP) daemon" | ||
| 3 | HOMEPAGE = "http://samba.org/ppp/" | ||
| 4 | DEPENDS = "libpcap" | ||
| 5 | LICENSE = "BSD GPLv2" | ||
| 6 | PR = "r0" | ||
| 7 | |||
| 8 | SRC_URI = "ftp://ftp.samba.org/pub/ppp/ppp-${PV}.tar.gz \ | ||
| 9 | file://makefile.patch;patch=1 \ | ||
| 10 | file://cifdefroute.patch;patch=1 \ | ||
| 11 | file://pppd-resolv-varrun.patch;patch=1 \ | ||
| 12 | file://plugins-fix-CC.patch;patch=1 \ | ||
| 13 | file://pon \ | ||
| 14 | file://poff \ | ||
| 15 | file://init \ | ||
| 16 | file://ip-up \ | ||
| 17 | file://ip-down \ | ||
| 18 | file://08setupdns \ | ||
| 19 | file://92removedns" | ||
| 20 | |||
| 21 | |||
| 22 | inherit autotools | ||
| 23 | |||
| 24 | EXTRA_OEMAKE = "STRIPPROG=${STRIP} MANDIR=${D}${datadir}/man/man8 INCDIR=${D}/usr/include LIBDIR=${D}/usr/lib/pppd/${PV} BINDIR=${D}/usr/sbin" | ||
| 25 | EXTRA_OECONF = --disable-strip | ||
| 26 | |||
| 27 | do_install_append () { | ||
| 28 | make install-etcppp ETCDIR=${D}/${sysconfdir}/ppp | ||
| 29 | mkdir -p ${D}${bindir}/ ${D}${sysconfdir}/init.d | ||
| 30 | mkdir -p ${D}${sysconfdir}/ppp/ip-up.d/ | ||
| 31 | mkdir -p ${D}${sysconfdir}/ppp/ip-down.d/ | ||
| 32 | install -m 0755 ${WORKDIR}/pon ${D}${bindir}/pon | ||
| 33 | install -m 0755 ${WORKDIR}/poff ${D}${bindir}/poff | ||
| 34 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/ppp | ||
| 35 | install -m 0755 ${WORKDIR}/ip-up ${D}${sysconfdir}/ppp/ | ||
| 36 | install -m 0755 ${WORKDIR}/ip-down ${D}${sysconfdir}/ppp/ | ||
| 37 | install -m 0755 ${WORKDIR}/08setupdns ${D}${sysconfdir}/ppp/ip-up.d/ | ||
| 38 | install -m 0755 ${WORKDIR}/92removedns ${D}${sysconfdir}/ppp/ip-down.d/ | ||
| 39 | rm -rf ${D}/${mandir}/man8/man8 | ||
| 40 | } | ||
| 41 | |||
| 42 | CONFFILES_${PN} = "${sysconfdir}/ppp/pap-secrets ${sysconfdir}/ppp/chap-secrets ${sysconfdir}/ppp/options" | ||
| 43 | PACKAGES += "ppp-oe ppp-radius ppp-winbind ppp-minconn ppp-password ppp-tools" | ||
| 44 | FILES_${PN} = "/etc /usr/bin /usr/sbin/chat /usr/sbin/pppd" | ||
| 45 | FILES_ppp-oe = "/usr/sbin/pppoe-discovery /usr/lib/pppd/2.4.3/rp-pppoe.so" | ||
| 46 | FILES_ppp-radius = "/usr/lib/pppd/2.4.3/radius.so /usr/lib/pppd/2.4.3/radattr.so /usr/lib/pppd/2.4.3/radrealms.so" | ||
| 47 | FILES_ppp-winbind = "/usr/lib/pppd/2.4.3/winbind.so" | ||
| 48 | FILES_ppp-minconn = "/usr/lib/pppd/2.4.3/minconn.so" | ||
| 49 | FILES_ppp-password = "/usr/lib/pppd/2.4.3/pass*.so" | ||
| 50 | FILES_ppp-tools = "/usr/sbin/pppstats /usr/sbin/pppdump" | ||
| 51 | DESCRIPTION_ppp-oe = "Plugin for PPP needed for PPP-over-Ethernet" | ||
| 52 | DESCRIPTION_ppp-radius = "Plugin for PPP that are related to RADIUS" | ||
| 53 | DESCRIPTION_ppp-winbind = "Plugin for PPP to authenticate against Samba or Windows" | ||
| 54 | DESCRIPTION_ppp-minconn = "Plugin for PPP to specify a minimum connect time before the idle timeout applies" | ||
| 55 | DESCRIPTION_ppp-password = "Plugin for PPP to get passwords via a pipe" | ||
| 56 | DESCRIPTION_ppp-tools = "The pppdump and pppstats utitilities" | ||
| 57 | RDEPENDS_ppp_minconn += "libpcap0.8" | ||
| 58 | |||
| 59 | pkg_postinst() { | ||
| 60 | if test "x$D" != "x"; then | ||
| 61 | exit 1 | ||
| 62 | else | ||
| 63 | chmod u+s ${sbindir}/pppd | ||
| 64 | fi | ||
| 65 | } | ||
