diff --git a/usr.sbin/ppp/alias_cmd.c b/usr.sbin/ppp/alias_cmd.c index 2c11e085b7c0..979b0b575a43 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 , * 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 @@ -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 072d3d121077..cf96bcf234cf 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 , * 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 e0fcf29f41ca..58dce7fd2ef1 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 @@ -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 2c11e085b7c0..979b0b575a43 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 , * 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 @@ -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 072d3d121077..cf96bcf234cf 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 , * 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 0d4a0671e784..7d2cb58633a8 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 0d4a0671e784..7d2cb58633a8 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