A new API function PacketAliasRedirectDynamic() can be used
to mark a fully specified static link as dynamic; i.e. make it a one-time link.
This commit is contained in:
parent
0bbe770d6f
commit
234dfc904a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115650
@ -69,6 +69,7 @@ int PacketAliasAddServer(struct alias_link *_link,
|
||||
struct alias_link *
|
||||
PacketAliasRedirectAddr(struct in_addr _src_addr,
|
||||
struct in_addr _alias_addr);
|
||||
int PacketAliasRedirectDynamic(struct alias_link *_link);
|
||||
void PacketAliasRedirectDelete(struct alias_link *_link);
|
||||
struct alias_link *
|
||||
PacketAliasRedirectPort(struct in_addr _src_addr,
|
||||
|
@ -2358,6 +2358,7 @@ UninitPacketAliasLog(void)
|
||||
PacketAliasAddServer()
|
||||
PacketAliasRedirectProto()
|
||||
PacketAliasRedirectAddr()
|
||||
PacketAliasRedirectDynamic()
|
||||
PacketAliasRedirectDelete()
|
||||
PacketAliasSetAddress()
|
||||
PacketAliasInit()
|
||||
@ -2499,6 +2500,20 @@ PacketAliasRedirectAddr(struct in_addr src_addr,
|
||||
}
|
||||
|
||||
|
||||
/* Mark the aliasing link dynamic */
|
||||
int
|
||||
PacketAliasRedirectDynamic(struct alias_link *link)
|
||||
{
|
||||
|
||||
if (link->flags & LINK_PARTIALLY_SPECIFIED)
|
||||
return (-1);
|
||||
else {
|
||||
link->flags &= ~LINK_PERMANENT;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PacketAliasRedirectDelete(struct alias_link *link)
|
||||
{
|
||||
|
@ -545,7 +545,26 @@ the
|
||||
.Fa port
|
||||
argument is ignored and could have any value, e.g. htons(~0).
|
||||
.Pp
|
||||
This function returns 0 on success, -1 otherwise.
|
||||
This function returns 0 on success, \-1 otherwise.
|
||||
.Ed
|
||||
.Pp
|
||||
.Ft int
|
||||
.Fn PacketAliasRedirectDynamic "struct alias_link *link"
|
||||
.Bd -ragged -offset indent
|
||||
This function marks the specified static redirect rule entered by
|
||||
.Fn PacketAliasRedirectPort
|
||||
as dynamic.
|
||||
This can be used to e.g. dynamically redirect a single TCP connection,
|
||||
after which the rule is removed.
|
||||
Only fully specified links can be made dynamic.
|
||||
(See the
|
||||
.Sx STATIC AND DYNAMIC LINKS
|
||||
and
|
||||
.Sx PARTIALLY SPECIFIED ALIASING LINKS
|
||||
sections below for a definition of static vs. dynamic,
|
||||
and partially vs. fully specified links.)
|
||||
.Pp
|
||||
This function returns 0 on success, \-1 otherwise.
|
||||
.Ed
|
||||
.Pp
|
||||
.Ft void
|
||||
|
@ -69,6 +69,7 @@ int PacketAliasAddServer(struct alias_link *_link,
|
||||
struct alias_link *
|
||||
PacketAliasRedirectAddr(struct in_addr _src_addr,
|
||||
struct in_addr _alias_addr);
|
||||
int PacketAliasRedirectDynamic(struct alias_link *_link);
|
||||
void PacketAliasRedirectDelete(struct alias_link *_link);
|
||||
struct alias_link *
|
||||
PacketAliasRedirectPort(struct in_addr _src_addr,
|
||||
|
@ -2358,6 +2358,7 @@ UninitPacketAliasLog(void)
|
||||
PacketAliasAddServer()
|
||||
PacketAliasRedirectProto()
|
||||
PacketAliasRedirectAddr()
|
||||
PacketAliasRedirectDynamic()
|
||||
PacketAliasRedirectDelete()
|
||||
PacketAliasSetAddress()
|
||||
PacketAliasInit()
|
||||
@ -2499,6 +2500,20 @@ PacketAliasRedirectAddr(struct in_addr src_addr,
|
||||
}
|
||||
|
||||
|
||||
/* Mark the aliasing link dynamic */
|
||||
int
|
||||
PacketAliasRedirectDynamic(struct alias_link *link)
|
||||
{
|
||||
|
||||
if (link->flags & LINK_PARTIALLY_SPECIFIED)
|
||||
return (-1);
|
||||
else {
|
||||
link->flags &= ~LINK_PERMANENT;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PacketAliasRedirectDelete(struct alias_link *link)
|
||||
{
|
||||
|
@ -545,7 +545,26 @@ the
|
||||
.Fa port
|
||||
argument is ignored and could have any value, e.g. htons(~0).
|
||||
.Pp
|
||||
This function returns 0 on success, -1 otherwise.
|
||||
This function returns 0 on success, \-1 otherwise.
|
||||
.Ed
|
||||
.Pp
|
||||
.Ft int
|
||||
.Fn PacketAliasRedirectDynamic "struct alias_link *link"
|
||||
.Bd -ragged -offset indent
|
||||
This function marks the specified static redirect rule entered by
|
||||
.Fn PacketAliasRedirectPort
|
||||
as dynamic.
|
||||
This can be used to e.g. dynamically redirect a single TCP connection,
|
||||
after which the rule is removed.
|
||||
Only fully specified links can be made dynamic.
|
||||
(See the
|
||||
.Sx STATIC AND DYNAMIC LINKS
|
||||
and
|
||||
.Sx PARTIALLY SPECIFIED ALIASING LINKS
|
||||
sections below for a definition of static vs. dynamic,
|
||||
and partially vs. fully specified links.)
|
||||
.Pp
|
||||
This function returns 0 on success, \-1 otherwise.
|
||||
.Ed
|
||||
.Pp
|
||||
.Ft void
|
||||
|
Loading…
Reference in New Issue
Block a user