summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2000-04-02 01:36:21 +0000
committerbrian <brian@cvs.openbsd.org>2000-04-02 01:36:21 +0000
commite9e895c13021b60e9ab1016e6d30178cd4da2f72 (patch)
tree6c36dcbb5884e51e5a6886c7053b81b8aa84d8ee /usr.sbin
parent02365800cc1cf82a6ea3e4c357c38bc26e86f3c5 (diff)
Make the default ``nat target'' address INADDR_NONE, meaning
incoming connections go to the NAT address. Make a ``nat target'' address of INADDR_ANY allow connections from outside directly into the internal network. Change some s_addr == 0 to s_addr == INADDR_ANY
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ppp/alias_db.c28
-rw-r--r--usr.sbin/ppp/ppp/nat_cmd.c4
2 files changed, 17 insertions, 15 deletions
diff --git a/usr.sbin/ppp/ppp/alias_db.c b/usr.sbin/ppp/ppp/alias_db.c
index d299b0ec1e0..ecb99645a0b 100644
--- a/usr.sbin/ppp/ppp/alias_db.c
+++ b/usr.sbin/ppp/ppp/alias_db.c
@@ -105,7 +105,7 @@
See HISTORY file for additional revisions.
- $OpenBSD: alias_db.c,v 1.7 2000/03/19 10:33:32 brian Exp $
+ $OpenBSD: alias_db.c,v 1.8 2000/04/02 01:36:20 brian Exp $
*/
@@ -863,7 +863,7 @@ AddLink(struct in_addr src_addr,
link->src_addr = src_addr;
link->dst_addr = dst_addr;
link->alias_addr = alias_addr;
- link->proxy_addr.s_addr = 0;
+ link->proxy_addr.s_addr = INADDR_ANY;
link->src_port = src_port;
link->dst_port = dst_port;
link->proxy_port = 0;
@@ -893,7 +893,7 @@ AddLink(struct in_addr src_addr,
}
/* Determine alias flags */
- if (dst_addr.s_addr == 0)
+ if (dst_addr.s_addr == INADDR_ANY)
link->flags |= LINK_UNKNOWN_DEST_ADDR;
if (dst_port == 0)
link->flags |= LINK_UNKNOWN_DEST_PORT;
@@ -1127,7 +1127,7 @@ _FindLinkIn(struct in_addr dst_addr,
loop will have to know about this. */
flags_in = 0;
- if (dst_addr.s_addr == 0)
+ if (dst_addr.s_addr == INADDR_ANY)
flags_in |= LINK_UNKNOWN_DEST_ADDR;
if (dst_port == 0)
flags_in |= LINK_UNKNOWN_DEST_PORT;
@@ -1455,14 +1455,16 @@ FindOriginalAddress(struct in_addr alias_addr)
if (link == NULL)
{
newDefaultLink = 1;
- if (targetAddress.s_addr != 0)
- return targetAddress;
- else
+ if (targetAddress.s_addr == INADDR_ANY)
return alias_addr;
+ else if (targetAddress.s_addr == INADDR_NONE)
+ return aliasAddress;
+ else
+ return targetAddress;
}
else
{
- if (link->src_addr.s_addr == 0)
+ if (link->src_addr.s_addr == INADDR_ANY)
return aliasAddress;
else
return link->src_addr;
@@ -1483,7 +1485,7 @@ FindAliasAddress(struct in_addr original_addr)
}
else
{
- if (link->alias_addr.s_addr == 0)
+ if (link->alias_addr.s_addr == INADDR_ANY)
return aliasAddress;
else
return link->alias_addr;
@@ -1601,7 +1603,7 @@ GetStateOut(struct alias_link *link)
struct in_addr
GetOriginalAddress(struct alias_link *link)
{
- if (link->src_addr.s_addr == 0)
+ if (link->src_addr.s_addr == INADDR_ANY)
return aliasAddress;
else
return(link->src_addr);
@@ -1618,7 +1620,7 @@ GetDestAddress(struct alias_link *link)
struct in_addr
GetAliasAddress(struct alias_link *link)
{
- if (link->alias_addr.s_addr == 0)
+ if (link->alias_addr.s_addr == INADDR_ANY)
return aliasAddress;
else
return link->alias_addr;
@@ -2139,8 +2141,8 @@ PacketAliasInit(void)
deleteAllLinks = 0;
}
- aliasAddress.s_addr = 0;
- targetAddress.s_addr = 0;
+ aliasAddress.s_addr = INADDR_ANY;
+ targetAddress.s_addr = INADDR_NONE;
icmpLinkCount = 0;
udpLinkCount = 0;
diff --git a/usr.sbin/ppp/ppp/nat_cmd.c b/usr.sbin/ppp/ppp/nat_cmd.c
index f91ad38e633..204e5a0b78b 100644
--- a/usr.sbin/ppp/ppp/nat_cmd.c
+++ b/usr.sbin/ppp/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.
*
- * $OpenBSD: nat_cmd.c,v 1.9 2000/03/31 14:32:51 brian Exp $
+ * $OpenBSD: nat_cmd.c,v 1.10 2000/04/02 01:36:20 brian Exp $
*/
#include <sys/param.h>
@@ -345,7 +345,7 @@ nat_SetTarget(struct cmdargs const *arg)
struct in_addr addr;
if (arg->argc == arg->argn) {
- addr.s_addr = INADDR_ANY;
+ addr.s_addr = INADDR_NONE;
PacketAliasSetTarget(addr);
return 0;
}