diff options
author | brian <brian@FreeBSD.org> | 1999-03-09 23:44:00 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-03-09 23:44:00 +0000 |
commit | d5ccc1beb2979ee9239e2c2d35178d73143a7763 (patch) | |
tree | 09feeeffb32eef6f99052bdb31cd906efd3fa959 /lib/libalias/alias_db.c | |
parent | a9dd71bbfcf9fd163d84f827d57d24fa9edcda6a (diff) | |
download | FreeBSD-src-d5ccc1beb2979ee9239e2c2d35178d73143a7763.zip FreeBSD-src-d5ccc1beb2979ee9239e2c2d35178d73143a7763.tar.gz |
Remove all diagnostics to stdout/stderr with #ifdef DEBUG
Statify functions in alias_nbt.c
Diffstat (limited to 'lib/libalias/alias_db.c')
-rw-r--r-- | lib/libalias/alias_db.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/libalias/alias_db.c b/lib/libalias/alias_db.c index bd730ba..d01188e 100644 --- a/lib/libalias/alias_db.c +++ b/lib/libalias/alias_db.c @@ -579,8 +579,10 @@ GetNewPort(struct alias_link *link, int alias_port_param) } else { +#ifdef DEBUG fprintf(stderr, "PacketAlias/GetNewPort(): "); fprintf(stderr, "input parameter error\n"); +#endif return(-1); } @@ -626,8 +628,10 @@ GetNewPort(struct alias_link *link, int alias_port_param) port_net = htons(port_sys); } +#ifdef DEBUG fprintf(stderr, "PacketAlias/GetnewPort(): "); fprintf(stderr, "could not find free port\n"); +#endif return(-1); } @@ -646,15 +650,19 @@ GetSocket(u_short port_net, int *sockfd, int link_type) sock = socket(AF_INET, SOCK_DGRAM, 0); else { +#ifdef DEBUG fprintf(stderr, "PacketAlias/GetSocket(): "); fprintf(stderr, "incorrect link type\n"); +#endif return(0); } if (sock < 0) { +#ifdef DEBUG fprintf(stderr, "PacketAlias/GetSocket(): "); fprintf(stderr, "socket() error %d\n", *sockfd); +#endif return(0); } @@ -962,8 +970,10 @@ AddLink(struct in_addr src_addr, } else { +#ifdef DEBUG fprintf(stderr, "PacketAlias/AddLink: "); fprintf(stderr, " cannot allocate auxiliary TCP data\n"); +#endif } break; case LINK_FRAGMENT_ID: @@ -976,8 +986,10 @@ AddLink(struct in_addr src_addr, } else { +#ifdef DEBUG fprintf(stderr, "PacketAlias/AddLink(): "); fprintf(stderr, "malloc() call failed.\n"); +#endif } if (packetAliasMode & PKT_ALIAS_LOG) @@ -1781,8 +1793,10 @@ SetExpire(struct alias_link *link, int expire) } else { +#ifdef DEBUG fprintf(stderr, "PacketAlias/SetExpire(): "); fprintf(stderr, "error in expire parameter\n"); +#endif } } @@ -1851,8 +1865,10 @@ HouseKeeping(void) } else if (n < 0) { +#ifdef DEBUG fprintf(stderr, "PacketAlias/HouseKeeping(): "); fprintf(stderr, "something unexpected in time values\n"); +#endif lastCleanupTime = timeStamp; houseKeepingResidual = 0; } @@ -1924,8 +1940,10 @@ PacketAliasRedirectPort(struct in_addr src_addr, u_short src_port, link_type = LINK_TCP; break; default: +#ifdef DEBUG fprintf(stderr, "PacketAliasRedirectPort(): "); fprintf(stderr, "only TCP and UDP protocols allowed\n"); +#endif return NULL; } @@ -1937,11 +1955,13 @@ PacketAliasRedirectPort(struct in_addr src_addr, u_short src_port, { link->flags |= LINK_PERMANENT; } +#ifdef DEBUG else { fprintf(stderr, "PacketAliasRedirectPort(): " "call to AddLink() failed\n"); } +#endif return link; } @@ -1981,11 +2001,13 @@ PacketAliasRedirectAddr(struct in_addr src_addr, { link->flags |= LINK_PERMANENT; } +#ifdef DEBUG else { fprintf(stderr, "PacketAliasRedirectAddr(): " "call to AddLink() failed\n"); } +#endif return link; } @@ -2220,7 +2242,9 @@ PunchFWHole(struct alias_link *link) { if (fwhole == fireWallActiveNum) { /* No rule point empty - we can't punch more holes. */ fireWallActiveNum = fireWallBaseNum; +#ifdef DEBUG fprintf(stderr, "libalias: Unable to create firewall hole!\n"); +#endif return; } } @@ -2247,15 +2271,19 @@ PunchFWHole(struct alias_link *link) { clear optimization) */ if (rule.fw_uar.fw_pts[0] != 0 && rule.fw_uar.fw_pts[1] != 0) { r = setsockopt(fireWallFD, IPPROTO_IP, IP_FW_ADD, &rule, sizeof rule); +#ifdef DEBUG if (r) err(1, "alias punch inbound(1) setsockopt(IP_FW_ADD)"); +#endif rule.fw_src = GetDestAddress(link); rule.fw_dst = GetOriginalAddress(link); rule.fw_uar.fw_pts[0] = ntohs(GetDestPort(link)); rule.fw_uar.fw_pts[1] = ntohs(GetOriginalPort(link)); r = setsockopt(fireWallFD, IPPROTO_IP, IP_FW_ADD, &rule, sizeof rule); +#ifdef DEBUG if (r) err(1, "alias punch inbound(2) setsockopt(IP_FW_ADD)"); +#endif } /* Indicate hole applied */ link->data.tcp->fwhole = fwhole; |