changeset 339:60459a8f4bd6

pptp ebuild that includes some stability patches from redhat
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 11 Jul 2012 13:20:47 +0200
parents 90ae974540be
children 9c4b58c14668
files net-dialup/pptpclient/Manifest net-dialup/pptpclient/files/pptp_fe.pl net-dialup/pptpclient/files/pptpclient-1.7.2-aliasing.patch net-dialup/pptpclient/files/pptpclient-1.7.2-const.patch net-dialup/pptpclient/files/pptpclient-1.7.2-field-init.patch net-dialup/pptpclient/files/pptpclient-1.7.2-ip-path.patch net-dialup/pptpclient/files/pptpclient-1.7.2-nested-externs.patch net-dialup/pptpclient/files/pptpclient-1.7.2-process-name.patch net-dialup/pptpclient/files/pptpclient-1.7.2-prototype.patch net-dialup/pptpclient/files/pptpclient-1.7.2-sign-compare.patch net-dialup/pptpclient/files/pptpclient-1.7.2-unused.patch net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild
diffstat 12 files changed, 1211 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/Manifest	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,13 @@
+AUX pptp_fe.pl 8100 RMD160 4b8c4591645a5f79daf2ba27e3e657db24323ffe SHA1 ec6102be37a7a2107f796bee974feadb7a3bd7a1 SHA256 f980fd3ff529bd4476852be39e05579bbeb9dc5c299795050a8d146ed6c4c648
+AUX pptpclient-1.7.2-aliasing.patch 6769 RMD160 6c264de3c0b17386e1e04e25001bc3030cadaac0 SHA1 9df2220cf79aa38578897fbc3eedd180882964f7 SHA256 88c4e95728878e83cdce677e7db7f983650ff1e0c297dc6a893fe603e0c76306
+AUX pptpclient-1.7.2-const.patch 2117 RMD160 2f518665aec91f5c9b2f6b4c65d6dd39a66deda1 SHA1 5604f4bdba30555d09348c52932a95878655cfa8 SHA256 750005ee3cd0e004802394cf41708d501e01e5472b744d51ab0e249d3f9e949a
+AUX pptpclient-1.7.2-field-init.patch 497 RMD160 8f79a324b822199fdd84f3a21ede7bb574c8425c SHA1 06666d73ab7abeeafede744925020cb37841e085 SHA256 140f9903f423404a285022ee1831d962831146864156580e63c84f6769951e65
+AUX pptpclient-1.7.2-ip-path.patch 883 RMD160 6c89e92f99e72c88bb3ac09422d0b60cef67ff74 SHA1 cda0eb529094b732f7def6cfe8cde7af23d21b6c SHA256 e4b30e07b7af6f0085044a98644d7d57689a74f2302f7b5a8a9108a7613179d6
+AUX pptpclient-1.7.2-nested-externs.patch 780 RMD160 e9b8c59158819540f011af248e600ea968d61568 SHA1 b35e6946971a2c79acd153d424f61ed3e4933e28 SHA256 c3e7a2bff092c7431c8a7016efd6a4f0545eaa62849d515a747f011602c4d83c
+AUX pptpclient-1.7.2-process-name.patch 1242 RMD160 fd10fc6506eb1e6ad2fdd1fc46dfb453d4623ec7 SHA1 b2edbe1f7ad781171142809bc48b6db05f0295ce SHA256 a16bc434f301af72f43cca41a17e8232006878295b0f4f2a3fc5dbe85b020b5e
+AUX pptpclient-1.7.2-prototype.patch 7270 RMD160 8aa8cc30791877d4e99ba60a806c4ba63e02673f SHA1 d55911bdb43d5f0f50171f8bf5fb6a10e92fab89 SHA256 a4a8be3c4df696f09eb37e98bc9838ce0014d14e5ec5b35b02a7d426276c4293
+AUX pptpclient-1.7.2-sign-compare.patch 6223 RMD160 267f362d3d9aa0198b81f419a768a25d4fa59dca SHA1 a0d7c043e4a3def2a6c555b34c34e7be0a0c00c9 SHA256 a62ff93b9b7c022f33e5bc93c70ea54151d2c79f80eb0aa2673c2ed31b5d03ff
+AUX pptpclient-1.7.2-unused.patch 2860 RMD160 8898f7fbb89845b45da2fa7a3a768ea174296bb2 SHA1 c7a1a107b212ff82675aade267e81e734e9afbbe SHA256 9234525f4c6d52e8432d4e802841bb83e7e8d738792ee8187c494e6ef8d8ab6c
+DIST pptp-1.7.2.tar.gz 81113 RMD160 fff47ef2c3546b06c69c27db01beebed7e6cda4b SHA1 1007eb1d4d21629fab390903e8b394d6157b4983 SHA256 e98ae0065d2a39fa3131654ff28cb7070e996f668ed6d0e7d9a445b8d37694bc
+DIST pptp-command-20050401.gz 7662 RMD160 1c02ad63aa90419bbe2151476d1463d7a26d6215 SHA1 546c437896ba00fe2b66b924671de884986de5d8 SHA256 49cfb115491b476a364ddc03f8c1b27f7ba19b6a231eabc11e823e3f32c5987d
+EBUILD pptpclient-1.7.2-r3.ebuild 1701 RMD160 4fe3219653279c8b711fd602c455bc6b1697a77d SHA1 e7ad662d596babe1f093cb0a0863728f29c3aa97 SHA256 86b90f3648b11e3c7a64973f57e1e43357ee3a04cba285ee6801ae52c3312886
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptp_fe.pl	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,370 @@
+#!/usr/bin/perl
+#
+#   $Id: pptp_fe.pl,v 1.1 2003/02/26 23:31:46 agriffis Exp $
+#
+#   pptp_fe.pl, privileged portion of xpptp_fe.pl
+#   Copyright (C) 2001  Smoot Carl-Mitchell (smoot@tic.com)
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+use strict;
+use Getopt::Std;
+use Time::localtime;
+use IO::Handle;
+
+my $Usage = "usage: pptp_fe [-c config_file] [-d] [-h] [-k] [-n network]
+		[-p] [-r routes] [-t timeout] [host]
+	where:
+	-c - configuration file (default is ~/.pptp_fe.conf)
+	-d - pppd debug flag
+	-h - this help message
+	-k - kill pppd daemon with route to network
+	-n - network number of remote private network in x.x.x.x/n notation
+	-r - routes to add to routing table separated by commas
+	-p - suppress prompting
+	-t - connection timeout retry interval in seconds (default 60 seconds)
+	host - remote PPTP server name
+";
+
+my %Opt;
+getopts("c:dhkn:pr:t:", \%Opt);
+
+my $Config_File = $Opt{'c'};
+$Config_File = "$ENV{'HOME'}/.pptp_fe.conf" unless $Opt{'c'};
+my $Config;
+my $Debug = $Opt{'d'};
+$Debug = 0 unless $Debug;
+my $Debug_Flag = "debug" if $Debug;
+my $Help = $Opt{'h'};
+my $Kill = $Opt{'k'};
+my $Net = $Opt{'n'};
+my $No_Prompt = $Opt{'p'};
+my $Route = $Opt{'r'};
+my $Timeout = $Opt{'t'}; $Timeout = 60 unless $Timeout;
+
+print($Usage), exit(1) if $Help; 
+
+my $Server = $ARGV[0];
+
+my $State = "disconnected";
+
+system("modprobe ppp-compress-18");
+
+$Config = cmd_read_config_file($Config_File);
+for my $cmd (@$Config) {
+	cmd_set($cmd, 1);
+}
+
+print "($State) > " unless $No_Prompt;
+STDOUT->flush;
+for (;;) {
+	my $rin = '';
+	my $rout = '';
+	vec($rin, fileno(STDIN), 1) = 1;
+	command() if select($rout=$rin,  undef, undef, 5);
+
+	my $interface = "";
+	if ($State eq "connected" && ! ($interface = net_interface_up($Net))) {
+		print "\n";
+		print "interface $interface for $Net not up - restarting\n";
+		cmd_connect();
+		print "($State) > " unless $No_Prompt;;
+	}
+}
+
+sub command {
+
+	my $input;
+	sysread(STDIN, $input, 1024);
+
+	for my $line1 (split("\n", $input)) {
+		my $line = $line1;
+		$line =~ s/\s*$//;
+		$line =~ s/^\s*//;
+		my ($command, $arguments) = split(" ", $line, 2);
+
+		if ($command eq "c") {
+			cmd_connect();
+		}
+		elsif ($command eq "d") {
+			cmd_disconnect();
+		}
+		elsif ($command eq "h") {
+			cmd_help();
+		}
+		elsif ($command eq "l") {
+			cmd_list();
+		}
+		elsif ($command eq "q") {
+			cmd_disconnect();
+			exit 0;
+		}
+		elsif ($command eq "r") {
+			$Config = cmd_read_config_file($arguments);
+		}
+		elsif ($command eq "s") {
+			cmd_set($arguments, 0);
+		}
+		elsif ($command eq "w") {
+			cmd_write_config_file($arguments);
+		}
+		elsif ($command ne "") {
+			print "unknown command\n";
+		}
+	}
+	print "($State) > " unless $No_Prompt;
+	STDOUT->flush;
+}
+
+sub cmd_connect {
+
+	cmd_disconnect() if $State eq "connected";
+
+	my $start_time = time();
+	my $date_string = ctime($start_time);
+	print "$date_string Running pptp $Server $Debug_Flag";
+	system("pptp $Server $Debug_Flag");
+	
+	my $interface = "";
+	
+	do {
+		sleep 1;
+		$interface = net_interface_up($Net);
+		print ".";
+	} until ($interface || time() > $start_time + $Timeout);
+	
+	if (time() > $start_time + $Timeout) {
+		print "timed out after $Timeout sec\n";
+		$State = "disconnected";
+		return 0;
+	}
+
+	print "\n";
+	
+	my $ifcfg = `ifconfig $interface`;
+	$ifcfg =~ /P-t-P:(.*)  Mask/;
+	my $ip = $1;
+	print "setting route to network $Net to interface $interface\n";
+	system("route add -net $Net dev $interface metric 2");
+	
+	# Routes are separated by commas
+	my @route = split(/,/, $Route);
+	for my $route (@route) {
+		my $net_flag = "";
+		$net_flag = "-net" if $route =~ /\//;
+	
+		print "setting route to $route to interface $interface\n";
+		system("route add $net_flag $route dev $interface");
+	}
+
+	$State = "connected";
+	print "connected\n";
+	return 1;
+}
+
+sub cmd_disconnect {
+
+	return 1 if $State eq "disconnected";
+
+	my $interface = net_interface_up($Net);
+	my $pid_file = "/var/run/$interface.pid";
+
+	# delete the named pipes - XXX this is a bit crude
+	system("rm -f /var/run/pptp/*");
+	
+	$State = "disconnected", return 1 unless $interface && -f $pid_file;
+
+	my $pid = `cat $pid_file`; 
+	chomp $pid;
+	print "killing pppd($pid)\n";
+	kill("HUP", $pid);
+	print "waiting for pppd to die";
+	do {
+		sleep 1;
+		print ".";
+	}
+	until (kill(0, $pid));
+
+	print "\n";
+	$State = "disconnected";
+	print "disconnected\n";
+	return 1;
+}
+
+sub cmd_list {
+
+	print "Server = $Server\n";
+	print "Network = $Net\n";
+	print "Routes = $Route\n";
+	print "Debug = $Debug_Flag\n";
+	print "No_Prompt = $No_Prompt\n";
+	print "Timeout = $Timeout\n";
+	print "\n";
+}
+
+sub cmd_help {
+
+	print "Commands are:\n";
+	print "c - initiate PPTP connection\n";
+	print "d - disconnect PPTP\n";
+	print "h - this help message\n";
+	print "l - list current configuration\n";
+	print "q - quite the program\n";
+	print "r - read configuration file\n";
+	print "s - set configuration variable (l for a list)\n";
+	print "w - write the configuration file\n";
+
+}
+
+sub cmd_set {
+	my $input = shift;
+	my $no_replace = shift;
+
+	my ($variable, $value) = split(/\s*=\s*/, $input);
+
+	$variable = "\L$variable";
+	if (! $variable) {
+		print "syntax: s variable = value\n";
+		return 0;
+	}
+
+	if ($variable eq "server") {
+		$Server = $value unless $no_replace && $Server;
+	}
+	elsif ($variable eq "network") {
+		$Net = $value unless $no_replace && $Net;
+	}
+	elsif ($variable eq "routes") {
+		$Route = $value unless $no_replace && $Route;
+	}
+	elsif ($variable eq "debug") {
+		$Debug_Flag = $value unless $no_replace && $Debug_Flag;
+	}
+	elsif ($variable eq "no_prompt") {
+		$No_Prompt = $value unless $no_replace && $No_Prompt;
+	}
+	elsif ($variable eq "timeout") {
+		$Timeout = $value unless $no_replace && $Timeout;
+	}
+	elsif ($variable eq "config_file") {
+		$Config_File = $value unless $no_replace && $Config_File;
+	}
+	else {
+		print "unknown variable\n";
+	}
+}
+
+sub cmd_read_config_file {
+	my $file = shift;
+
+	my $config = [];
+	$file = $Config_File unless $file; 
+	local *IN;
+	if (!open(IN, $file)) {
+		print "cannot open $file\n";
+		return $config;
+	}
+
+	my @config_file = <IN>;
+	close IN;
+	push @config_file, "\n";
+	chomp @config_file;
+
+	for my $line (@config_file) {
+		next if /\s*#/;
+
+		if ($line =~ /\S/) {
+			$line =~ s/^\s*//;
+			$line =~ s/\s*$//;
+			push @$config, $line;
+			next;
+		}
+	}
+	return $config;
+}
+
+sub cmd_write_config_file {
+	my $file = shift;
+
+	$file = $Config_File unless $file; 
+	local *OUT;
+	if (!open(OUT, ">$file")) {
+		print "cannot open $file\n";
+		return 0;
+	}
+
+	my $oldfh = select OUT;
+	cmd_list();
+	close OUT;
+	select $oldfh;
+
+	return 1;
+}
+
+sub net_interface_up {
+	my $cidr = shift;
+
+	# cidr is net/bits
+	my($net, $nbits) = split(/\//, $cidr);
+
+	# compute the network number
+	my $netnum = netnum($net, $nbits);
+	local(*INTERFACE);
+	open(INTERFACE, "ifconfig|") || die "cannot run ifconfig - $!\n";
+
+	my $interface = "";
+	my @interface = <INTERFACE>;
+	close INTERFACE;
+	for  (@interface) {
+		chomp;
+
+		# new interface
+		if (/^[a-zA-Z]/) {
+			if ($interface =~ /(.*)      Link.*P-t-P:(.*)  Mask/) {
+				my $interface_name = $1;
+				my $ip = $2;
+				return $interface_name
+					if netnum($ip, $nbits) == $netnum;
+			}
+			$interface = "";
+		}
+		$interface .= $_;
+	}
+	return "";
+}
+
+sub netnum {
+	my $net = shift;
+	my $bits = shift;
+
+	my @octets = split(/\./, $net);
+	my $netnum = 0;
+	for my $octet (@octets) {
+		$netnum <<= 8;
+		$netnum |= $octet;
+	}
+
+	my $mask = 0;
+	for (1..$bits) {
+		$mask <<= 1;
+		$mask |= 1;
+	}
+	$mask = $mask << (32-$bits);
+
+	$netnum &= $mask;
+
+	return $netnum;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-aliasing.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,172 @@
+diff -up pptp-1.7.2/pptp.c.alias pptp-1.7.2/pptp.c
+--- pptp-1.7.2/pptp.c.alias	2011-12-06 22:24:06.617318769 +0000
++++ pptp-1.7.2/pptp.c	2011-12-06 22:36:25.761692858 +0000
+@@ -463,7 +463,10 @@ int open_callmgr(struct in_addr inetaddr
+         char **envp, int pty_fd, int gre_fd)
+ {
+     /* Try to open unix domain socket to call manager. */
+-    struct sockaddr_un where;
++    union {
++        struct sockaddr a;
++        struct sockaddr_un u;
++    } where;
+     const int NUM_TRIES = 3;
+     int i, fd;
+     pid_t pid;
+@@ -473,12 +476,12 @@ int open_callmgr(struct in_addr inetaddr
+         fatal("Could not create unix domain socket: %s", strerror(errno));
+     }
+     /* Make address */
+-    callmgr_name_unixsock(&where, inetaddr, localbind);
++    callmgr_name_unixsock(&where.u, inetaddr, localbind);
+     for (i = 0; i < NUM_TRIES; i++) {
+-        if (connect(fd, (struct sockaddr *) &where, sizeof(where)) < 0) {
++        if (connect(fd, &where.a, sizeof(where.u)) < 0) {
+             /* couldn't connect.  We'll have to launch this guy. */
+ 
+-            unlink (where.sun_path);	
++            unlink (where.u.sun_path);
+ 
+             /* fork and launch call manager process */
+             switch (pid = fork()) {
+diff -up pptp-1.7.2/pptp_callmgr.c.alias pptp-1.7.2/pptp_callmgr.c
+--- pptp-1.7.2/pptp_callmgr.c.alias	2011-12-06 22:24:06.617318769 +0000
++++ pptp-1.7.2/pptp_callmgr.c	2011-12-06 22:34:46.142647941 +0000
+@@ -196,14 +196,17 @@ int callmgr_main(int argc, char **argv,
+         /* Step 5b: Handle new connection to UNIX socket */
+         if (FD_ISSET(unix_sock, &read_set)) {
+             /* New call! */
+-            struct sockaddr_un from;
+-            socklen_t len = sizeof(from);
++            union {
++                struct sockaddr a;
++                struct sockaddr_un u;
++            } from;
++            socklen_t len = sizeof(from.u);
+             PPTP_CALL * call;
+             struct local_callinfo *lci;
+             int s;
+             /* Accept the socket */
+             FD_CLR (unix_sock, &read_set);
+-            if ((s = accept(unix_sock, (struct sockaddr *) &from, &len)) < 0) {
++            if ((s = accept(unix_sock, &from.a, &len)) < 0) {
+                 warn("Socket not accepted: %s", strerror(errno));
+                 goto skip_accept;
+             }
+@@ -313,11 +316,14 @@ cleanup:
+ /*** open_inetsock ************************************************************/
+ int open_inetsock(struct in_addr inetaddr)
+ {
+-    struct sockaddr_in dest, src;
++    union {
++        struct sockaddr a;
++        struct sockaddr_in i;
++    } dest, src;
+     int s;
+-    dest.sin_family = AF_INET;
+-    dest.sin_port   = htons(PPTP_PORT);
+-    dest.sin_addr   = inetaddr;
++    dest.i.sin_family = AF_INET;
++    dest.i.sin_port   = htons(PPTP_PORT);
++    dest.i.sin_addr   = inetaddr;
+     if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+         warn("socket: %s", strerror(errno));
+         return s;
+@@ -332,14 +338,14 @@ int open_inetsock(struct in_addr inetadd
+ #endif
+     if (localbind.s_addr != INADDR_NONE) {
+         bzero(&src, sizeof(src));
+-        src.sin_family = AF_INET;
+-        src.sin_addr   = localbind;
+-        if (bind(s, (struct sockaddr *) &src, sizeof(src)) != 0) {
++        src.i.sin_family = AF_INET;
++        src.i.sin_addr   = localbind;
++        if (bind(s, &src.a, sizeof(src.i)) != 0) {
+             warn("bind: %s", strerror(errno));
+             close(s); return -1;
+         }
+     }
+-    if (connect(s, (struct sockaddr *) &dest, sizeof(dest)) < 0) {
++    if (connect(s, &dest.a, sizeof(dest.i)) < 0) {
+         warn("connect: %s", strerror(errno));
+         close(s); return -1;
+     }
+@@ -349,7 +355,10 @@ int open_inetsock(struct in_addr inetadd
+ /*** open_unixsock ************************************************************/
+ int open_unixsock(struct in_addr inetaddr)
+ {
+-    struct sockaddr_un where;
++    union {
++        struct sockaddr a;
++        struct sockaddr_un u;
++    } where;
+     struct stat st;
+     char *dir;
+     int s;
+@@ -357,21 +366,21 @@ int open_unixsock(struct in_addr inetadd
+         warn("socket: %s", strerror(errno));
+         return s;
+     }
+-    callmgr_name_unixsock( &where, inetaddr, localbind);
+-    if (stat(where.sun_path, &st) >= 0) {
++    callmgr_name_unixsock( &where.u, inetaddr, localbind);
++    if (stat(where.u.sun_path, &st) >= 0) {
+         warn("Call manager for %s is already running.", inet_ntoa(inetaddr));
+         close(s); return -1;
+     }
+     /* Make sure path is valid. */
+-    dir = dirname(where.sun_path);
++    dir = dirname(where.u.sun_path);
+     if (!make_valid_path(dir, 0770))
+-        fatal("Could not make path to %s: %s", where.sun_path, strerror(errno));
++        fatal("Could not make path to %s: %s", where.u.sun_path, strerror(errno));
+     free(dir);
+-    if (bind(s, (struct sockaddr *) &where, sizeof(where)) < 0) {
++    if (bind(s, &where.a, sizeof(where.u)) < 0) {
+         warn("bind: %s", strerror(errno));
+         close(s); return -1;
+     }
+-    chmod(where.sun_path, 0777);
++    chmod(where.u.sun_path, 0777);
+     listen(s, 127);
+     return s;
+ }
+diff -up pptp-1.7.2/pptp_gre.c.alias pptp-1.7.2/pptp_gre.c
+--- pptp-1.7.2/pptp_gre.c.alias	2011-12-06 22:24:06.627318773 +0000
++++ pptp-1.7.2/pptp_gre.c	2011-12-06 22:24:06.629318775 +0000
+@@ -85,7 +85,10 @@ uint64_t time_now_usecs(void)
+ /*** Open IP protocol socket **************************************************/
+ int pptp_gre_bind(struct in_addr inetaddr)
+ {
+-    struct sockaddr_in src_addr, loc_addr;
++    union {
++        struct sockaddr a;
++        struct sockaddr_in i;
++    } loc_addr, src_addr;
+     int s = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
+     if (s < 0) { warn("socket: %s", strerror(errno)); return -1; }
+ #ifdef SO_MARK
+@@ -98,16 +101,16 @@ int pptp_gre_bind(struct in_addr inetadd
+ #endif
+     if (localbind.s_addr != INADDR_NONE) {
+         bzero(&loc_addr, sizeof(loc_addr));
+-        loc_addr.sin_family = AF_INET;
+-        loc_addr.sin_addr   = localbind;
+-        if (bind(s, (struct sockaddr *) &loc_addr, sizeof(loc_addr)) != 0) {
++        loc_addr.i.sin_family = AF_INET;
++        loc_addr.i.sin_addr   = localbind;
++        if (bind(s, &loc_addr.a, sizeof(loc_addr.i)) != 0) {
+             warn("bind: %s", strerror(errno)); close(s); return -1;
+         }
+     }
+-    src_addr.sin_family = AF_INET;
+-    src_addr.sin_addr   = inetaddr;
+-    src_addr.sin_port   = 0;
+-    if (connect(s, (struct sockaddr *) &src_addr, sizeof(src_addr)) < 0) {
++    src_addr.i.sin_family = AF_INET;
++    src_addr.i.sin_addr   = inetaddr;
++    src_addr.i.sin_port   = 0;
++    if (connect(s, &src_addr.a, sizeof(src_addr.i)) < 0) {
+         warn("connect: %s", strerror(errno)); close(s); return -1;
+     }
+     my = test_redirections();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-const.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,52 @@
+diff -up pptp-1.7.2/pptp.c.const pptp-1.7.2/pptp.c
+--- pptp-1.7.2/pptp.c.const	2011-11-30 18:58:39.713148113 +0000
++++ pptp-1.7.2/pptp.c	2011-12-01 09:23:29.716446618 +0000
+@@ -565,10 +565,13 @@ int get_call_id(int sock, pid_t gre, pid
+ void launch_pppd(char *ttydev, int argc, char **argv)
+ {
+     char *new_argv[argc + 4];/* XXX if not using GCC, hard code a limit here. */
++    char str_pppd[] = PPPD_BINARY;
++    char str_direct[] = "-direct";
++    char str_38400[] = "38400";
+     int i = 0, j;
+-    new_argv[i++] = PPPD_BINARY;
++    new_argv[i++] = str_pppd;
+ #ifdef USER_PPP
+-    new_argv[i++] = "-direct";
++    new_argv[i++] = str_direct;
+     /* ppp expects to have stdin connected to ttydev */
+     if ((j = open(ttydev, O_RDWR)) == -1)
+         fatal("Cannot open %s: %s", ttydev, strerror(errno));
+@@ -577,7 +580,7 @@ void launch_pppd(char *ttydev, int argc,
+     close(j);
+ #else
+     new_argv[i++] = ttydev;
+-    new_argv[i++] = "38400";
++    new_argv[i++] = str_38400;
+ #endif
+     for (j = 0; j < argc; j++)
+         new_argv[i++] = argv[j];
+diff -up pptp-1.7.2/util.c.const pptp-1.7.2/util.c
+--- pptp-1.7.2/util.c.const	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/util.c	2011-11-30 18:58:39.719148114 +0000
+@@ -16,7 +16,7 @@
+ #endif
+ 
+ /* implementation of log_string, defined as extern in util.h */
+-char *log_string = "anon";
++const char *log_string = "anon";
+ 
+ static void open_log(void) __attribute__ ((constructor));
+ static void close_log(void) __attribute__ ((destructor));
+diff -up pptp-1.7.2/util.h.const pptp-1.7.2/util.h
+--- pptp-1.7.2/util.h.const	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/util.h	2011-11-30 18:59:47.458171318 +0000
+@@ -10,7 +10,7 @@
+ /* log_string is an identifier for this pptp process, passed from
+    command line using --log-string=X, and included with every log message.
+    Useful for people with multiple pptp sessions open at a time */
+-extern char * log_string;
++extern const char * log_string;
+ 
+ /* log_level sets the logging verbosity. Values range from 0 (errors only)
+    to 1 (errors and warnings) to 2 (high verbosity, for debugging) */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-field-init.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,11 @@
+--- pptp-1.7.2/orckit_quirks.c.field	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/orckit_quirks.c	2011-12-01 09:31:04.762035792 +0000
+@@ -62,7 +62,7 @@ int
+ orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet)
+ {
+     struct pptp_start_ctrl_conn fixed_packet = {
+-	{0}, /* we'll set the header later */
++	{0, 0, 0, 0, 0}, /* we'll set the header later */
+ 	hton16(PPTP_VERSION), 0, 0,
+ 	hton32(PPTP_FRAME_ASYNC), hton32(PPTP_BEARER_ANALOG),
+ 	hton16(0) /* max channels */,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-ip-path.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,29 @@
+diff -Nru pptp-1.7.2.orig/routing.c pptp-1.7.2/routing.c
+--- pptp-1.7.2.orig/routing.c	2008-05-14 08:33:55.000000000 +0200
++++ pptp-1.7.2/routing.c	2009-09-16 23:28:11.000000000 +0200
+@@ -55,7 +55,7 @@
+ 
+ void routing_init(char *ip) {
+   char buf[256];
+-  snprintf(buf, 255, "/bin/ip route get %s", ip);
++  snprintf(buf, 255, "/sbin/ip route get %s", ip);
+   FILE *p = popen(buf, "r");
+   fgets(buf, 255, p);
+   /* TODO: check for failure of fgets */
+@@ -66,14 +66,14 @@
+ 
+ void routing_start() {
+   char buf[256];
+-  snprintf(buf, 255, "/bin/ip route replace %s", route);
++  snprintf(buf, 255, "/sbin/ip route replace %s", route);
+   FILE *p = popen(buf, "r");
+   pclose(p);
+ }
+ 
+ void routing_end() {
+   char buf[256];
+-  snprintf(buf, 255, "/bin/ip route delete %s", route);
++  snprintf(buf, 255, "/sbin/ip route delete %s", route);
+   FILE *p = popen(buf, "r");
+   pclose(p);
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-nested-externs.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,22 @@
+diff -up pptp-1.7.2/pptp_gre.c.nested pptp-1.7.2/pptp_gre.c
+--- pptp-1.7.2/pptp_gre.c.nested	2011-12-06 16:45:34.605691678 +0000
++++ pptp-1.7.2/pptp_gre.c	2011-12-06 19:07:14.169449813 +0000
+@@ -23,6 +23,10 @@
+ #include "pqueue.h"
+ #include "test.h"
+ 
++/* globals from pptp.c */
++extern struct in_addr localbind;
++extern int rtmark;
++
+ #define PACKET_MAX 8196
+ /* test for a 32 bit counter overflow */
+ #define WRAPPED( curseq, lastseq) \
+@@ -82,7 +86,6 @@ uint64_t time_now_usecs(void)
+ int pptp_gre_bind(struct in_addr inetaddr)
+ {
+     struct sockaddr_in src_addr, loc_addr;
+-    extern struct in_addr localbind;
+     int s = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
+     if (s < 0) { warn("socket: %s", strerror(errno)); return -1; }
+     if (localbind.s_addr != INADDR_NONE) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-process-name.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,42 @@
+diff -Nru pptp-1.7.2.orig/pptp.c pptp-1.7.2/pptp.c
+--- pptp-1.7.2.orig/pptp.c	2008-05-14 08:33:55.000000000 +0200
++++ pptp-1.7.2/pptp.c	2009-06-20 10:53:07.000000000 +0200
+@@ -59,11 +59,7 @@
+ #include "pptp_callmgr.h"
+ #include "pptp_gre.h"
+ #include "version.h"
+-#if defined(__linux__)
+-#include <sys/prctl.h>
+-#else
+ #include "inststr.h"
+-#endif
+ #include "util.h"
+ #include "pptp_quirks.h"
+ #include "pqueue.h"
+@@ -394,12 +390,7 @@
+     char *tty_name = ttyname(tty_fd);
+     snprintf(buf, sizeof(buf), "pptp: GRE-to-PPP gateway on %s",
+               tty_name ? tty_name : "(null)");
+-#ifdef PR_SET_NAME
+-    rc = prctl(PR_SET_NAME, "pptpgw", 0, 0, 0);
+-    if (rc != 0) perror("prctl");
+-#else
+     inststr(argc, argv, envp, buf);
+-#endif
+     if (sigsetjmp(env, 1)!= 0) goto shutdown;
+ 
+     signal(SIGINT,  sighandler);
+@@ -495,13 +486,7 @@
+       char *my_argv[3] = { argv[0], inet_ntoa(inetaddr), phonenr };
+       char buf[128];
+       snprintf(buf, sizeof(buf), "pptp: call manager for %s", my_argv[1]);
+-#ifdef PR_SET_NAME
+-      int rc;
+-      rc = prctl(PR_SET_NAME, "pptpcm", 0, 0, 0);
+-      if (rc != 0) perror("prctl");
+-#else
+       inststr(argc, argv, envp, buf);
+-#endif
+       exit(callmgr_main(3, my_argv, envp));
+ }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-prototype.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,218 @@
+diff -up pptp-1.7.2/pptp_ctrl.c.prototype pptp-1.7.2/pptp_ctrl.c
+--- pptp-1.7.2/pptp_ctrl.c.prototype	2011-12-06 16:41:47.391574067 +0000
++++ pptp-1.7.2/pptp_ctrl.c	2011-12-06 16:41:47.405574074 +0000
+@@ -174,7 +174,7 @@ int max_echo_wait = PPTP_TIMEOUT;
+ 
+ /* Local prototypes */
+ static void pptp_reset_timer(void);
+-static void pptp_handle_timer();
++static void pptp_handle_timer(void);
+ /* Write/read as much as we can without blocking. */
+ int pptp_write_some(PPTP_CONN * conn);
+ int pptp_read_some(PPTP_CONN * conn);
+@@ -1059,7 +1059,7 @@ static void pptp_reset_timer(void)
+ 
+ 
+ /*** Handle keep-alive timer **************************************************/
+-static void pptp_handle_timer()
++static void pptp_handle_timer(void)
+ {
+     int i;
+     /* "Keep Alives and Timers, 1": check connection state */
+diff -up pptp-1.7.2/pptp_gre.c.prototype pptp-1.7.2/pptp_gre.c
+--- pptp-1.7.2/pptp_gre.c.prototype	2011-12-06 16:41:47.392574067 +0000
++++ pptp-1.7.2/pptp_gre.c	2011-12-06 16:45:34.605691678 +0000
+@@ -71,7 +71,7 @@ void print_packet(int fd, void *pack, un
+ #endif
+ 
+ /*** time_now_usecs ***********************************************************/
+-uint64_t time_now_usecs()
++uint64_t time_now_usecs(void)
+ {
+     struct timeval tv;
+     gettimeofday(&tv, NULL);
+diff -up pptp-1.7.2/pptp_quirks.c.prototype pptp-1.7.2/pptp_quirks.c
+--- pptp-1.7.2/pptp_quirks.c.prototype	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/pptp_quirks.c	2011-12-06 16:41:47.405574074 +0000
+@@ -30,7 +30,7 @@ int set_quirk_index(int index)
+     return -1;
+ }
+ 
+-int get_quirk_index()
++int get_quirk_index(void)
+ {
+     return quirk_index;
+ }
+diff -up pptp-1.7.2/pptp_quirks.h.prototype pptp-1.7.2/pptp_quirks.h
+--- pptp-1.7.2/pptp_quirks.h.prototype	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/pptp_quirks.h	2011-12-06 16:41:47.406574074 +0000
+@@ -53,7 +53,7 @@ int set_quirk_index(int index);
+ 
+ /* get the global quirk index. return the index on success,
+    -1 if no quirk is defined */
+-int get_quirk_index();
++int get_quirk_index(void);
+ 
+ 
+ #endif /* INC_PPTP_QUIRKS_H */
+diff -up pptp-1.7.2/pqueue.c.prototype pptp-1.7.2/pqueue.c
+--- pptp-1.7.2/pqueue.c.prototype	2011-12-06 16:41:47.392574067 +0000
++++ pptp-1.7.2/pqueue.c	2011-12-06 16:41:47.406574074 +0000
+@@ -217,7 +217,7 @@ int pqueue_del (pqueue_t *point) {
+ 
+ 
+ 
+-pqueue_t *pqueue_head () {
++pqueue_t *pqueue_head (void) {
+   return pq_head;
+ }
+ 
+diff -up pptp-1.7.2/pqueue.h.prototype pptp-1.7.2/pqueue.h
+--- pptp-1.7.2/pqueue.h.prototype	2011-12-06 16:41:47.392574067 +0000
++++ pptp-1.7.2/pqueue.h	2011-12-06 16:41:47.407574075 +0000
+@@ -24,7 +24,7 @@ typedef struct pqueue {
+ 
+ int       pqueue_add  (u_int32_t seq, unsigned char *packet, int packlen);
+ int       pqueue_del  (pqueue_t *point);
+-pqueue_t *pqueue_head ();
++pqueue_t *pqueue_head (void);
+ int       pqueue_expiry_time (pqueue_t *entry);
+ 
+ #endif /* PQUEUE_H */
+diff -up pptp-1.7.2/routing.c.prototype pptp-1.7.2/routing.c
+--- pptp-1.7.2/routing.c.prototype	2011-12-06 16:41:47.388574065 +0000
++++ pptp-1.7.2/routing.c	2011-12-06 16:41:47.407574075 +0000
+@@ -64,14 +64,14 @@ void routing_init(char *ip) {
+   /* TODO: check for failure of command */
+ }
+ 
+-void routing_start() {
++void routing_start(void) {
+   char buf[256];
+   snprintf(buf, 255, "/sbin/ip route replace %s", route);
+   FILE *p = popen(buf, "r");
+   pclose(p);
+ }
+ 
+-void routing_end() {
++void routing_end(void) {
+   char buf[256];
+   snprintf(buf, 255, "/sbin/ip route delete %s", route);
+   FILE *p = popen(buf, "r");
+diff -up pptp-1.7.2/routing.h.prototype pptp-1.7.2/routing.h
+--- pptp-1.7.2/routing.h.prototype	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/routing.h	2011-12-06 16:41:47.407574075 +0000
+@@ -1,3 +1,3 @@
+ void routing_init(char *ip);
+-void routing_start();
+-void routing_end();
++void routing_start(void);
++void routing_end(void);
+diff -up pptp-1.7.2/test.c.prototype pptp-1.7.2/test.c
+--- pptp-1.7.2/test.c.prototype	2011-12-06 16:41:47.393574067 +0000
++++ pptp-1.7.2/test.c	2011-12-06 16:41:47.408574076 +0000
+@@ -171,7 +171,7 @@ static ssize_t write_reordered(int fd, c
+   }
+ }
+ 
+-struct test_redirections *test_redirections()
++struct test_redirections *test_redirections(void)
+ {
+   static struct test_redirections *my = NULL;
+ 
+diff -up pptp-1.7.2/test.h.prototype pptp-1.7.2/test.h
+--- pptp-1.7.2/test.h.prototype	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/test.h	2011-12-06 16:41:47.408574076 +0000
+@@ -2,4 +2,4 @@ struct test_redirections {
+   ssize_t (*write)(int fd, const void *buf, size_t count);
+ };
+ 
+-struct test_redirections *test_redirections();
++struct test_redirections *test_redirections(void);
+diff -up pptp-1.7.2/util.c.prototype pptp-1.7.2/util.c
+--- pptp-1.7.2/util.c.prototype	2011-12-06 16:41:47.396574070 +0000
++++ pptp-1.7.2/util.c	2011-12-06 16:41:47.409574076 +0000
+@@ -87,7 +87,7 @@ int file2fd(const char *path, const char
+ static int sigpipe[2];
+ 
+ /* create a signal pipe, returns 0 for success, -1 with errno for failure */
+-int sigpipe_create()
++int sigpipe_create(void)
+ {
+   int rc;
+   
+@@ -133,20 +133,20 @@ void sigpipe_assign(int signum)
+ }
+ 
+ /* return the signal pipe read file descriptor for select(2) */
+-int sigpipe_fd()
++int sigpipe_fd(void)
+ {
+   return sigpipe[0];
+ }
+ 
+ /* read and return the pending signal from the pipe */
+-int sigpipe_read()
++int sigpipe_read(void)
+ {
+   int signum;
+   read(sigpipe[0], &signum, sizeof(signum));
+   return signum;
+ }
+ 
+-void sigpipe_close()
++void sigpipe_close(void)
+ {
+   close(sigpipe[0]);
+   close(sigpipe[1]);
+diff -up pptp-1.7.2/util.h.prototype pptp-1.7.2/util.h
+--- pptp-1.7.2/util.h.prototype	2011-12-06 16:41:47.396574070 +0000
++++ pptp-1.7.2/util.h	2011-12-06 16:41:47.409574076 +0000
+@@ -35,7 +35,7 @@ int file2fd(const char *path, const char
+ /* signal to pipe delivery implementation */
+ 
+ /* create a signal pipe, returns 0 for success, -1 with errno for failure */
+-int sigpipe_create();
++int sigpipe_create(void);
+ 
+ /* generic handler for signals, writes signal number to pipe */
+ void sigpipe_handler(int signum);
+@@ -44,11 +44,11 @@ void sigpipe_handler(int signum);
+ void sigpipe_assign(int signum);
+ 
+ /* return the signal pipe read file descriptor for select(2) */
+-int sigpipe_fd();
++int sigpipe_fd(void);
+ 
+ /* read and return the pending signal from the pipe */
+-int sigpipe_read();
++int sigpipe_read(void);
+ 
+-void sigpipe_close();
++void sigpipe_close(void);
+ 
+ #endif /* INC_UTIL_H */
+diff -up pptp-1.7.2/vector.c.prototype pptp-1.7.2/vector.c
+--- pptp-1.7.2/vector.c.prototype	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/vector.c	2011-12-06 16:41:47.409574076 +0000
+@@ -35,7 +35,7 @@ struct vector_struct {
+ static struct vector_item *binary_search(VECTOR *v, int key);
+ 
+ /*** vector_create ************************************************************/
+-VECTOR *vector_create()
++VECTOR *vector_create(void)
+ {
+     const int INITIAL_SIZE = 4;
+ 
+diff -up pptp-1.7.2/vector.h.prototype pptp-1.7.2/vector.h
+--- pptp-1.7.2/vector.h.prototype	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/vector.h	2011-12-06 16:41:47.410574077 +0000
+@@ -12,7 +12,7 @@
+ 
+ typedef struct vector_struct VECTOR;
+ 
+-VECTOR *vector_create();
++VECTOR *vector_create(void);
+ void vector_destroy(VECTOR *v);
+ 
+ int vector_size(VECTOR *v);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-sign-compare.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,150 @@
+diff -up pptp-1.7.2/pptp_ctrl.c.sign-compare pptp-1.7.2/pptp_ctrl.c
+--- pptp-1.7.2/pptp_ctrl.c.sign-compare	2011-11-30 16:33:00.877964659 +0000
++++ pptp-1.7.2/pptp_ctrl.c	2011-11-30 18:49:17.603973525 +0000
+@@ -193,7 +193,7 @@ int ctrlp_disp(PPTP_CONN * conn, void *
+ void pptp_set_link(PPTP_CONN * conn, int peer_call_id);
+ 
+ /*** log error information in control packets *********************************/
+-static void ctrlp_error( int result, int error, int cause,
++static void ctrlp_error( int result, u_int8_t error, int cause,
+         const char *result_text[], int max_result)
+ {
+     if( cause >= 0)
+@@ -238,7 +238,7 @@ static const char *ctrl_msg_types[] = {
+ #define MAX_CTRLMSG_TYPE 15
+          
+ /*** report a sent packet ****************************************************/
+-static void ctrlp_rep( void * buffer, int size, int isbuff)
++static void ctrlp_rep( void * buffer, size_t size, int isbuff)
+ {
+     struct pptp_header *packet = buffer;
+     unsigned int type;
+@@ -532,7 +532,7 @@ int pptp_write_some(PPTP_CONN * conn) {
+ 	    return -1;
+         }
+     }
+-    assert(retval <= conn->write_size);
++    assert((size_t)retval <= conn->write_size);
+     conn->write_size -= retval;
+     memmove(conn->write_buffer, conn->write_buffer + retval, conn->write_size);
+     ctrlp_rep(conn->write_buffer, retval, 0);
+diff -up pptp-1.7.2/pptp_gre.c.sign-compare pptp-1.7.2/pptp_gre.c
+--- pptp-1.7.2/pptp_gre.c.sign-compare	2011-11-30 16:33:00.899964648 +0000
++++ pptp-1.7.2/pptp_gre.c	2011-11-30 16:33:00.911964643 +0000
+@@ -200,8 +200,7 @@ void pptp_gre_copy(u_int16_t call_id, u_
+ int decaps_hdlc(int fd, int (*cb)(int cl, void *pack, unsigned int len), int cl)
+ {
+     unsigned char buffer[PACKET_MAX];
+-    unsigned int start = 0;
+-    int end;
++    ssize_t start = 0, end;
+     int status;
+     static unsigned int len = 0, escape = 0;
+     static unsigned char copy[PACKET_MAX];
+@@ -210,7 +209,7 @@ int decaps_hdlc(int fd, int (*cb)(int cl
+     /*  this is the only blocking read we will allow */
+     if ((end = read (fd, buffer, sizeof(buffer))) <= 0) {
+         int saved_errno = errno;
+-        warn("short read (%d): %s", end, strerror(saved_errno));
++        warn("short read (%zd): %s", end, strerror(saved_errno));
+ 	switch (saved_errno) {
+ 	  case EMSGSIZE: {
+ 	    socklen_t optval, optlen = sizeof(optval);
+@@ -499,7 +498,7 @@ int encaps_gre (int fd, void *pack, unsi
+                 if (errno == ENOBUFS)
+                     rc = 0;         /* Simply ignore it */
+                 stats.tx_failed++;
+-            } else if (rc < sizeof(u.header) - sizeof(u.header.seq)) {
++            } else if ((size_t)rc < sizeof(u.header) - sizeof(u.header.seq)) {
+                 stats.tx_short++;
+             } else {
+                 stats.tx_acks++;
+@@ -533,7 +532,7 @@ int encaps_gre (int fd, void *pack, unsi
+         if (errno == ENOBUFS)
+             rc = 0;         /* Simply ignore it */
+         stats.tx_failed++;
+-    } else if (rc < header_len + len) {
++    } else if ((size_t)rc < header_len + len) {
+         stats.tx_short++;
+     } else {
+         stats.tx_sent++;
+diff -up pptp-1.7.2/pqueue.c.sign-compare pptp-1.7.2/pqueue.c
+--- pptp-1.7.2/pqueue.c.sign-compare	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/pqueue.c	2011-11-30 16:41:39.598648652 +0000
+@@ -17,7 +17,7 @@
+ 
+ #define MIN_CAPACITY 128 /* min allocated buffer for a packet */
+ 
+-static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new);
++static int pqueue_alloc (u_int32_t seq, unsigned char *packet, int packlen, pqueue_t **new);
+ 
+ int packet_timeout_usecs = DEFAULT_PACKET_TIMEOUT * 1000000;
+ 
+@@ -29,7 +29,7 @@ static pqueue_t *pq_freelist_head = NULL
+ 
+ 
+ 
+-static int pqueue_alloc(int seq, unsigned char *packet, int packlen, pqueue_t **new) {
++static int pqueue_alloc(u_int32_t seq, unsigned char *packet, int packlen, pqueue_t **new) {
+ 
+   pqueue_t *newent;
+ 
+@@ -125,7 +125,7 @@ static int pqueue_alloc(int seq, unsigne
+ 
+ 
+ 
+-int pqueue_add (int seq, unsigned char *packet, int packlen) {
++int pqueue_add (u_int32_t seq, unsigned char *packet, int packlen) {
+   pqueue_t *newent, *point;
+ 
+   /* get a new entry */
+diff -up pptp-1.7.2/pqueue.h.sign-compare pptp-1.7.2/pqueue.h
+--- pptp-1.7.2/pqueue.h.sign-compare	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/pqueue.h	2011-11-30 18:42:16.733706666 +0000
+@@ -15,14 +15,14 @@ extern int packet_timeout_usecs;
+ typedef struct pqueue {
+   struct pqueue *next;
+   struct pqueue *prev;
+-  int seq;
++  u_int32_t seq;
+   struct timeval expires;
+   unsigned char *packet;
+   int packlen;
+   int capacity;
+ } pqueue_t;
+ 
+-int       pqueue_add  (int seq, unsigned char *packet, int packlen);
++int       pqueue_add  (u_int32_t seq, unsigned char *packet, int packlen);
+ int       pqueue_del  (pqueue_t *point);
+ pqueue_t *pqueue_head ();
+ int       pqueue_expiry_time (pqueue_t *entry);
+diff -up pptp-1.7.2/test.c.sign-compare pptp-1.7.2/test.c
+--- pptp-1.7.2/test.c.sign-compare	2008-05-14 07:33:55.000000000 +0100
++++ pptp-1.7.2/test.c	2011-11-30 18:45:44.553853995 +0000
+@@ -52,7 +52,7 @@ static ssize_t write_reordered_swap(int
+       test_ordering_phase = 0;
+       /* send the new packet first */
+       stat = write(fd, buf, count);
+-      if (stat != count) return stat;
++      if ((size_t)stat != count) return stat;
+       /* then send the old packet next */
+       stat = write(fd, pocket_buf, pocket_count);
+       free(pocket_buf);
+@@ -96,7 +96,7 @@ static ssize_t write_reordered_retransmi
+     test_ordering_phase = 0;
+     /* send the new packet first */
+     stat = write(fd, buf, count);
+-    if (stat != count) return stat;
++    if ((size_t)stat != count) return stat;
+     /* send the buffered packets in normal order */
+     for (n=0; n<test_length; n++) {
+       stat = write(fd, pocket_buf[n], pocket_count[n]);
+@@ -142,7 +142,7 @@ static ssize_t write_reordered_reverse(i
+     test_ordering_phase = 0;
+     /* send the new packet first */
+     stat = write(fd, buf, count);
+-    if (stat != count) return stat;
++    if ((size_t)stat != count) return stat;
+     /* send the buffered packets in reverse order */
+     for (n=test_length-1; n>0; n--) {
+       stat = write(fd, pocket_buf[n], pocket_count[n]);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/files/pptpclient-1.7.2-unused.patch	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,73 @@
+diff -up pptp-1.7.2/pptp_callmgr.c.unused pptp-1.7.2/pptp_callmgr.c
+--- pptp-1.7.2/pptp_callmgr.c.unused	2011-12-01 09:58:47.127960697 +0000
++++ pptp-1.7.2/pptp_callmgr.c	2011-12-01 09:58:47.149960723 +0000
+@@ -38,12 +38,12 @@ void close_unixsock(int fd, struct in_ad
+ 
+ sigjmp_buf callmgr_env;
+ 
+-void callmgr_sighandler(int sig) {
++void callmgr_sighandler(int sig __attribute__ ((unused))) {
+     /* TODO: according to signal(2), siglongjmp() is unsafe used here */
+     siglongjmp (callmgr_env, 1);
+ }
+ 
+-void callmgr_do_nothing(int sig) {
++void callmgr_do_nothing(int sig __attribute__ ((unused))) {
+     /* do nothing signal handler */
+ }
+ 
+@@ -104,7 +104,7 @@ void call_callback(PPTP_CONN *conn, PPTP
+  *****************************************************************************/
+ 
+ /*** Call Manager *************************************************************/
+-int callmgr_main(int argc, char **argv, char **envp)
++int callmgr_main(int argc, char **argv, char **envp __attribute__ ((unused)))
+ {
+     struct in_addr inetaddr;
+     int inet_sock, unix_sock;
+@@ -377,7 +377,7 @@ int open_unixsock(struct in_addr inetadd
+ }
+ 
+ /*** close_inetsock ***********************************************************/
+-void close_inetsock(int fd, struct in_addr inetaddr)
++void close_inetsock(int fd, struct in_addr inetaddr __attribute__ ((unused)))
+ {
+     close(fd);
+ }
+diff -up pptp-1.7.2/pptp.c.unused pptp-1.7.2/pptp.c
+--- pptp-1.7.2/pptp.c.unused	2011-12-01 09:58:47.143960715 +0000
++++ pptp-1.7.2/pptp.c	2011-12-01 10:01:40.171147875 +0000
+@@ -151,13 +151,13 @@ void do_nothing(int sig)
+ sigjmp_buf env;
+ 
+ /*** signal handler ***********************************************************/
+-void sighandler(int sig)
++void sighandler(int sig __attribute__ ((unused)))
+ {
+     siglongjmp(env, 1);
+ }
+ 
+ /*** report statistics signal handler (SIGUSR1) *******************************/
+-void sigstats(int sig)
++void sigstats(int sig __attribute__ ((unused)))
+ {
+     syslog(LOG_NOTICE, "GRE statistics:\n");
+ #define LOG(name,value) syslog(LOG_NOTICE, name "\n", stats .value)
+@@ -508,7 +508,7 @@ int open_callmgr(struct in_addr inetaddr
+ }
+ 
+ /*** call the call manager main ***********************************************/
+-void launch_callmgr(struct in_addr inetaddr, char *phonenr, int argc,
++void launch_callmgr(struct in_addr inetaddr, char *phonenr, int argc __attribute__ ((unused)),
+         char**argv,char**envp) 
+ {
+       char *my_argv[3] = { argv[0], inet_ntoa(inetaddr), phonenr };
+@@ -566,7 +566,7 @@ void launch_pppd(char *ttydev, int argc,
+ {
+     char *new_argv[argc + 4];/* XXX if not using GCC, hard code a limit here. */
+     char str_pppd[] = PPPD_BINARY;
+-    char str_direct[] = "-direct";
++    char str_direct[] __attribute__ ((unused)) = "-direct";
+     char str_38400[] = "38400";
+     int i = 0, j;
+     new_argv[i++] = str_pppd;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net-dialup/pptpclient/pptpclient-1.7.2-r3.ebuild	Wed Jul 11 13:20:47 2012 +0200
@@ -0,0 +1,59 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dialup/pptpclient/pptpclient-1.7.2-r2.ebuild,v 1.3 2010/04/29 19:46:17 truedfx Exp $
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+MY_P=${P/client}
+MY_CMD=pptp-command-20050401
+
+DESCRIPTION="Linux client for PPTP"
+HOMEPAGE="http://pptpclient.sourceforge.net/"
+SRC_URI="mirror://sourceforge/pptpclient/${MY_P}.tar.gz
+	mirror://gentoo/${MY_CMD}.gz"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="alpha amd64 ppc ppc64 x86"
+IUSE="tk"
+
+DEPEND="net-dialup/ppp
+	dev-lang/perl
+	tk? ( dev-perl/perl-tk )"
+RDEPEND="${DEPEND}
+	sys-apps/iproute2"
+
+RESTRICT="test" #make test is useless and vector_test.c is broken
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-process-name.patch
+	epatch "${FILESDIR}"/${P}-ip-path.patch
+	epatch "${FILESDIR}"/${P}-sign-compare.patch
+	epatch "${FILESDIR}"/${P}-const.patch
+	epatch "${FILESDIR}"/${P}-field-init.patch
+	epatch "${FILESDIR}"/${P}-unused.patch
+	epatch "${FILESDIR}"/${P}-prototype.patch
+	epatch "${FILESDIR}"/${P}-nested-externs.patch
+	epatch "${FILESDIR}"/${P}-aliasing.patch
+}
+
+src_compile() {
+	emake OPTIMISE= DEBUG= CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC="$(tc-getCC)" || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+	dodoc AUTHORS ChangeLog DEVELOPERS NEWS README TODO USING
+	dodoc Documentation/*
+	dodir /etc/pptp.d
+
+	# The current version of pptp-linux doesn't include the
+	# RH-specific portions, so include them ourselves.
+	newsbin "${WORKDIR}/${MY_CMD}" pptp-command
+	dosbin "${FILESDIR}/pptp_fe.pl"
+	use tk && dosbin "${FILESDIR}/xpptp_fe.pl"
+}