diff options
author | brian <brian@FreeBSD.org> | 1999-03-07 15:02:38 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-03-07 15:02:38 +0000 |
commit | 121ec0cce66ec860abef535b8f62d1bddb4e0c85 (patch) | |
tree | 0b34de9f3a4509264f8524780f736217e7fcc4c3 /usr.sbin | |
parent | 1b7dfc80704fcc1053303fab23f411f404a7e856 (diff) | |
download | FreeBSD-src-121ec0cce66ec860abef535b8f62d1bddb4e0c85.zip FreeBSD-src-121ec0cce66ec860abef535b8f62d1bddb4e0c85.tar.gz |
Support proxying & transparent proxying curtesy of libalias(3).
Order the alias command descriptions.
Order the SEE ALSO entries.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/alias_cmd.c | 25 | ||||
-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 | 25 | ||||
-rw-r--r-- | usr.sbin/ppp/nat_cmd.h | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 46 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 46 |
7 files changed, 112 insertions, 42 deletions
diff --git a/usr.sbin/ppp/alias_cmd.c b/usr.sbin/ppp/alias_cmd.c index 3a86a8e..2c11e08 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.18 1998/09/17 00:45:25 brian Exp $ + * $Id: alias_cmd.c,v 1.19 1999/01/28 01:56:30 brian Exp $ */ #include <sys/param.h> @@ -216,3 +216,26 @@ StrToAddrAndPort(const char *str, struct in_addr *addr, u_short *port, const cha return StrToPort(colon+1, port, proto); } + +int +alias_ProxyRule(struct cmdargs const *arg) +{ + char cmd[LINE_LEN]; + int f, pos; + size_t len; + + if (arg->argn >= arg->argc) + return -1; + + for (f = arg->argn, pos = 0; f < arg->argc; f++) { + len = strlen(arg->argv[f]); + if (sizeof cmd - pos < len + (f ? 1 : 0)) + break; + if (f) + cmd[pos++] = ' '; + strcpy(cmd + pos, arg->argv[f]); + pos += len; + } + + return PacketAliasProxyRule(cmd); +} diff --git a/usr.sbin/ppp/alias_cmd.h b/usr.sbin/ppp/alias_cmd.h index 495397c..072d3d1 100644 --- a/usr.sbin/ppp/alias_cmd.h +++ b/usr.sbin/ppp/alias_cmd.h @@ -2,10 +2,11 @@ * 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.7.2.2 1998/05/01 19:23:44 brian Exp $ + * $Id: alias_cmd.h,v 1.8 1998/05/21 21:43:45 brian Exp $ */ struct cmdargs; extern int alias_RedirectPort(struct cmdargs const *); extern int alias_RedirectAddr(struct cmdargs const *); +extern int alias_ProxyRule(struct cmdargs const *); diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index dda1df7..e0fcf29 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.185 1999/03/03 23:00:39 brian Exp $ + * $Id: command.c,v 1.186 1999/03/04 17:42:15 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/03 23:00:39 $"; +const char VersionDate[] = "$Date: 1999/03/04 17:42:15 $"; 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]"}, + {"proxy", NULL, alias_ProxyRule, LOCAL_AUTH, + "proxy control", "alias proxy server host[:port] ..."}, {"same_ports", NULL, AliasOption, LOCAL_AUTH, "try to leave port numbers unchanged", "alias same_ports [yes|no]", (const void *) PKT_ALIAS_SAME_PORTS}, diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c index 3a86a8e..2c11e08 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.18 1998/09/17 00:45:25 brian Exp $ + * $Id: alias_cmd.c,v 1.19 1999/01/28 01:56:30 brian Exp $ */ #include <sys/param.h> @@ -216,3 +216,26 @@ StrToAddrAndPort(const char *str, struct in_addr *addr, u_short *port, const cha return StrToPort(colon+1, port, proto); } + +int +alias_ProxyRule(struct cmdargs const *arg) +{ + char cmd[LINE_LEN]; + int f, pos; + size_t len; + + if (arg->argn >= arg->argc) + return -1; + + for (f = arg->argn, pos = 0; f < arg->argc; f++) { + len = strlen(arg->argv[f]); + if (sizeof cmd - pos < len + (f ? 1 : 0)) + break; + if (f) + cmd[pos++] = ' '; + strcpy(cmd + pos, arg->argv[f]); + pos += len; + } + + return PacketAliasProxyRule(cmd); +} diff --git a/usr.sbin/ppp/nat_cmd.h b/usr.sbin/ppp/nat_cmd.h index 495397c..072d3d1 100644 --- a/usr.sbin/ppp/nat_cmd.h +++ b/usr.sbin/ppp/nat_cmd.h @@ -2,10 +2,11 @@ * 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.7.2.2 1998/05/01 19:23:44 brian Exp $ + * $Id: alias_cmd.h,v 1.8 1998/05/21 21:43:45 brian Exp $ */ struct cmdargs; extern int alias_RedirectPort(struct cmdargs const *); extern int alias_RedirectAddr(struct cmdargs const *); +extern int alias_ProxyRule(struct cmdargs const *); diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 393120a..0d4a067 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.154 1999/03/04 17:42:15 brian Exp $ +.\" $Id: ppp.8,v 1.155 1999/03/07 11:54:42 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Os FreeBSD @@ -2648,6 +2648,22 @@ The .Fl alias command line flag is synonymous with .Dq alias enable yes . +.It alias addr Op Ar addr_local addr_alias +This command allows data for +.Ar addr_alias +to be redirected to +.Ar addr_local . +It is useful if you own a small number of real IP numbers that +you wish to map to specific machines behind your gateway. +.It alias deny_incoming [yes|no] +If set to yes, this command will refuse all incoming connections +by dropping the packets in much the same way as a firewall would. +.It alias help|? +This command gives a summary of available alias commands. +.It alias log [yes|no] +This option causes various aliasing statistics and information to +be logged to the file +.Pa /var/log/alias.log . .It alias port Op Ar proto targetIP:targetPORT [aliasIP:]aliasPORT This command allows us to redirect connections arriving at .Ar aliasPORT @@ -2665,22 +2681,15 @@ 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 addr Op Ar addr_local addr_alias -This command allows data for -.Ar addr_alias -to be redirected to -.Ar addr_local . -It is useful if you own a small number of real IP numbers that -you wish to map to specific machines behind your gateway. -.It alias deny_incoming [yes|no] -If set to yes, this command will refuse all incoming connections -by dropping the packets in much the same way as a firewall would. -.It alias help|? -This command gives a summary of available alias commands. -.It alias log [yes|no] -This option causes various aliasing statistics and information to -be logged to the file -.Pa /var/log/alias.log . +.It "alias proxy cmd" Ar arg Ns No ... +This command tells +.Nm +to proxy certain connections, redirecting them to a given server. Refer +to the description of +.Fn PacketAliasProxyRule +in +.Xr libalias 3 +for details of the available commands. .It alias same_ports [yes|no] When enabled, this command will tell the alias library attempt to avoid changing the port number on outgoing packets. This is useful @@ -4241,11 +4250,13 @@ This socket is used to pass links between different instances of .Xr login 1 , .Xr tcpdump 1 , .Xr telnet 1 , +.Xr libalias 3 , .Xr syslog 3 , .Xr uucplock 3 , .Xr crontab 5 , .Xr group 5 , .Xr passwd 5 , +.Xr radius.conf 5 , .Xr resolv.conf 5 , .Xr syslog.conf 5 , .Xr adduser 8 , @@ -4257,7 +4268,6 @@ This socket is used to pass links between different instances of .Xr ping 8 , .Xr pppctl 8 , .Xr pppd 8 , -.Xr radius.conf 5 , .Xr route 8 , .Xr syslogd 8 , .Xr traceroute 8 , diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 393120a..0d4a067 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.154 1999/03/04 17:42:15 brian Exp $ +.\" $Id: ppp.8,v 1.155 1999/03/07 11:54:42 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Os FreeBSD @@ -2648,6 +2648,22 @@ The .Fl alias command line flag is synonymous with .Dq alias enable yes . +.It alias addr Op Ar addr_local addr_alias +This command allows data for +.Ar addr_alias +to be redirected to +.Ar addr_local . +It is useful if you own a small number of real IP numbers that +you wish to map to specific machines behind your gateway. +.It alias deny_incoming [yes|no] +If set to yes, this command will refuse all incoming connections +by dropping the packets in much the same way as a firewall would. +.It alias help|? +This command gives a summary of available alias commands. +.It alias log [yes|no] +This option causes various aliasing statistics and information to +be logged to the file +.Pa /var/log/alias.log . .It alias port Op Ar proto targetIP:targetPORT [aliasIP:]aliasPORT This command allows us to redirect connections arriving at .Ar aliasPORT @@ -2665,22 +2681,15 @@ 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 addr Op Ar addr_local addr_alias -This command allows data for -.Ar addr_alias -to be redirected to -.Ar addr_local . -It is useful if you own a small number of real IP numbers that -you wish to map to specific machines behind your gateway. -.It alias deny_incoming [yes|no] -If set to yes, this command will refuse all incoming connections -by dropping the packets in much the same way as a firewall would. -.It alias help|? -This command gives a summary of available alias commands. -.It alias log [yes|no] -This option causes various aliasing statistics and information to -be logged to the file -.Pa /var/log/alias.log . +.It "alias proxy cmd" Ar arg Ns No ... +This command tells +.Nm +to proxy certain connections, redirecting them to a given server. Refer +to the description of +.Fn PacketAliasProxyRule +in +.Xr libalias 3 +for details of the available commands. .It alias same_ports [yes|no] When enabled, this command will tell the alias library attempt to avoid changing the port number on outgoing packets. This is useful @@ -4241,11 +4250,13 @@ This socket is used to pass links between different instances of .Xr login 1 , .Xr tcpdump 1 , .Xr telnet 1 , +.Xr libalias 3 , .Xr syslog 3 , .Xr uucplock 3 , .Xr crontab 5 , .Xr group 5 , .Xr passwd 5 , +.Xr radius.conf 5 , .Xr resolv.conf 5 , .Xr syslog.conf 5 , .Xr adduser 8 , @@ -4257,7 +4268,6 @@ This socket is used to pass links between different instances of .Xr ping 8 , .Xr pppctl 8 , .Xr pppd 8 , -.Xr radius.conf 5 , .Xr route 8 , .Xr syslogd 8 , .Xr traceroute 8 , |