mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-29 21:26:51 +00:00
Support proxying & transparent proxying curtesy of libalias(3).
Order the alias command descriptions. Order the SEE ALSO entries.
This commit is contained in:
parent
ac8e3334de
commit
d318fe8e17
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44547
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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 ,
|
||||
|
|
|
@ -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 ,
|
||||
|
|
Loading…
Reference in a new issue