diff options
author | brian <brian@FreeBSD.org> | 1999-03-07 18:13:44 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-03-07 18:13:44 +0000 |
commit | 7ae299d980b74227ffb2395df09111e9e75a0a58 (patch) | |
tree | d5731c08a6815e59b928ad94609d3ec1c9b4c8c9 /usr.sbin | |
parent | 8b7bf74482a8f02d04eb893476a0bbe5281f9741 (diff) | |
download | FreeBSD-src-7ae299d980b74227ffb2395df09111e9e75a0a58.zip FreeBSD-src-7ae299d980b74227ffb2395df09111e9e75a0a58.tar.gz |
Support PPTP via libalias (``alias pptp addr'').
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/alias_cmd.c | 26 | ||||
-rw-r--r-- | usr.sbin/ppp/alias_cmd.h | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/command.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/nat_cmd.c | 26 | ||||
-rw-r--r-- | usr.sbin/ppp/nat_cmd.h | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 25 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 25 |
7 files changed, 106 insertions, 8 deletions
diff --git a/usr.sbin/ppp/alias_cmd.c b/usr.sbin/ppp/alias_cmd.c index 2c11e08..979b0b5 100644 --- a/usr.sbin/ppp/alias_cmd.c +++ b/usr.sbin/ppp/alias_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.c,v 1.19 1999/01/28 01:56:30 brian Exp $ + * $Id: alias_cmd.c,v 1.20 1999/03/07 15:02:37 brian Exp $ */ #include <sys/param.h> @@ -239,3 +239,27 @@ alias_ProxyRule(struct cmdargs const *arg) return PacketAliasProxyRule(cmd); } + +int +alias_Pptp(struct cmdargs const *arg) +{ + struct in_addr addr; + + if (arg->argc == arg->argn) { + addr.s_addr = INADDR_NONE; + PacketAliasPptp(addr); + return 0; + } + + if (arg->argc != arg->argn + 1) + return -1; + + addr = GetIpAddr(arg->argv[arg->argn]); + if (addr.s_addr == INADDR_NONE) { + log_Printf(LogWARN, "%s: invalid address\n", arg->argv[arg->argn]); + return 1; + } + + PacketAliasPptp(addr); + return 0; +} diff --git a/usr.sbin/ppp/alias_cmd.h b/usr.sbin/ppp/alias_cmd.h index 072d3d1..cf96bcf 100644 --- a/usr.sbin/ppp/alias_cmd.h +++ b/usr.sbin/ppp/alias_cmd.h @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.h,v 1.8 1998/05/21 21:43:45 brian Exp $ + * $Id: alias_cmd.h,v 1.9 1999/03/07 15:02:37 brian Exp $ */ struct cmdargs; @@ -10,3 +10,4 @@ struct cmdargs; extern int alias_RedirectPort(struct cmdargs const *); extern int alias_RedirectAddr(struct cmdargs const *); extern int alias_ProxyRule(struct cmdargs const *); +extern int alias_Pptp(struct cmdargs const *); diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index e0fcf29..58dce7f 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.186 1999/03/04 17:42:15 brian Exp $ + * $Id: command.c,v 1.187 1999/03/07 15:02:37 brian Exp $ * */ #include <sys/param.h> @@ -141,7 +141,7 @@ #define NEG_DNS 52 const char Version[] = "2.11"; -const char VersionDate[] = "$Date: 1999/03/04 17:42:15 $"; +const char VersionDate[] = "$Date: 1999/03/07 15:02:37 $"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); @@ -554,6 +554,8 @@ static struct cmdtab const AliasCommands[] = (const void *) PKT_ALIAS_LOG}, {"port", NULL, alias_RedirectPort, LOCAL_AUTH, "port redirection", "alias port [proto addr_local:port_local port_alias]"}, + {"pptp", NULL, alias_Pptp, LOCAL_AUTH, + "Set the PPTP address", "alias pptp IP"}, {"proxy", NULL, alias_ProxyRule, LOCAL_AUTH, "proxy control", "alias proxy server host[:port] ..."}, {"same_ports", NULL, AliasOption, LOCAL_AUTH, diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c index 2c11e08..979b0b5 100644 --- a/usr.sbin/ppp/nat_cmd.c +++ b/usr.sbin/ppp/nat_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.c,v 1.19 1999/01/28 01:56:30 brian Exp $ + * $Id: alias_cmd.c,v 1.20 1999/03/07 15:02:37 brian Exp $ */ #include <sys/param.h> @@ -239,3 +239,27 @@ alias_ProxyRule(struct cmdargs const *arg) return PacketAliasProxyRule(cmd); } + +int +alias_Pptp(struct cmdargs const *arg) +{ + struct in_addr addr; + + if (arg->argc == arg->argn) { + addr.s_addr = INADDR_NONE; + PacketAliasPptp(addr); + return 0; + } + + if (arg->argc != arg->argn + 1) + return -1; + + addr = GetIpAddr(arg->argv[arg->argn]); + if (addr.s_addr == INADDR_NONE) { + log_Printf(LogWARN, "%s: invalid address\n", arg->argv[arg->argn]); + return 1; + } + + PacketAliasPptp(addr); + return 0; +} diff --git a/usr.sbin/ppp/nat_cmd.h b/usr.sbin/ppp/nat_cmd.h index 072d3d1..cf96bcf 100644 --- a/usr.sbin/ppp/nat_cmd.h +++ b/usr.sbin/ppp/nat_cmd.h @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.h,v 1.8 1998/05/21 21:43:45 brian Exp $ + * $Id: alias_cmd.h,v 1.9 1999/03/07 15:02:37 brian Exp $ */ struct cmdargs; @@ -10,3 +10,4 @@ struct cmdargs; extern int alias_RedirectPort(struct cmdargs const *); extern int alias_RedirectAddr(struct cmdargs const *); extern int alias_ProxyRule(struct cmdargs const *); +extern int alias_Pptp(struct cmdargs const *); diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 0d4a067..7d2cb58 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.155 1999/03/07 11:54:42 brian Exp $ +.\" $Id: ppp.8,v 1.156 1999/03/07 15:02:38 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Os FreeBSD @@ -2681,6 +2681,29 @@ or and only connections of the given protocol are matched. This option is useful if you wish to run things like Internet phone on the machines behind your gateway. +.It "alias pptp" Op Ar addr +This tells +.Nm +to alias any +.Em G Ns No eneral +.Em R Ns No outing +.Em E Ns No encapsulated +.Pq Dv IPPROTO_GRE +packets using +.Ar addr +rather than the local interface address. This allows the uses of the +.Em P Ns No oint +to +.Em P Ns No oint +.Em T Ns No unneling +.Em P Ns No rotocol +on a machine on the internal network. +.Pp +If +.Ar addr +is not specified, +.Dv PPTP +aliasing is disabled. .It "alias proxy cmd" Ar arg Ns No ... This command tells .Nm diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 0d4a067..7d2cb58 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.155 1999/03/07 11:54:42 brian Exp $ +.\" $Id: ppp.8,v 1.156 1999/03/07 15:02:38 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Os FreeBSD @@ -2681,6 +2681,29 @@ or and only connections of the given protocol are matched. This option is useful if you wish to run things like Internet phone on the machines behind your gateway. +.It "alias pptp" Op Ar addr +This tells +.Nm +to alias any +.Em G Ns No eneral +.Em R Ns No outing +.Em E Ns No encapsulated +.Pq Dv IPPROTO_GRE +packets using +.Ar addr +rather than the local interface address. This allows the uses of the +.Em P Ns No oint +to +.Em P Ns No oint +.Em T Ns No unneling +.Em P Ns No rotocol +on a machine on the internal network. +.Pp +If +.Ar addr +is not specified, +.Dv PPTP +aliasing is disabled. .It "alias proxy cmd" Ar arg Ns No ... This command tells .Nm |