diff options
Diffstat (limited to 'lib/libalias/alias_db.c')
-rw-r--r-- | lib/libalias/alias_db.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/lib/libalias/alias_db.c b/lib/libalias/alias_db.c index f5b04056eaba..579507c6c63d 100644 --- a/lib/libalias/alias_db.c +++ b/lib/libalias/alias_db.c @@ -132,12 +132,12 @@ __FBSDID("$FreeBSD$"); implements static network address translation. Version 3.2: July, 2000 (salander and satoh) - Added FindNewPortGroup to get contiguous range of port values. + Added FindNewPortGroup to get contiguous range of port values. Added QueryUdpTcpIn and QueryUdpTcpOut to look for an aliasing link but not actually add one. - Added FindRtspOut, which is closely derived from FindUdpTcpOut, + Added FindRtspOut, which is closely derived from FindUdpTcpOut, except that the alias port (from FindNewPortGroup) is provided as input. @@ -334,14 +334,14 @@ struct alias_link /* Main data structure */ -/* Global Variables +/* Global Variables The global variables listed here are only accessed from - within alias_db.c and so are prefixed with the static + within alias_db.c and so are prefixed with the static designation. */ -int packetAliasMode; /* Mode flags */ +int packetAliasMode; /* Mode flags */ /* - documented in alias.h */ static struct in_addr aliasAddress; /* Address written onto source */ @@ -389,7 +389,7 @@ static FILE *monitorFile; /* File descriptor for link */ static int newDefaultLink; /* Indicates if a new aliasing */ /* link has been created after a */ /* call to PacketAliasIn/Out(). */ - + #ifndef NO_FW_PUNCH static int fireWallFD = -1; /* File descriptor to be able to */ /* control firewall. Opened by */ @@ -411,7 +411,7 @@ Lookup table starting points: incoming packets StartPointOut() -- link table initial search point for outgoing packets - + Miscellaneous: SeqDiff() -- difference between two TCP sequences ShowAliasStats() -- send alias statistics to a monitor file @@ -463,7 +463,7 @@ StartPointOut(struct in_addr src_addr, struct in_addr dst_addr, n = src_addr.s_addr; n += dst_addr.s_addr; if (link_type != LINK_PPTP) { - n += src_port; + n += src_port; n += dst_port; } n += link_type; @@ -529,15 +529,15 @@ Link creation and deletion: CleanupAliasData() - remove all link chains from lookup table IncrementalCleanup() - look for stale links in a single chain DeleteLink() - remove link - AddLink() - add link - ReLink() - change link + AddLink() - add link + ReLink() - change link Link search: FindLinkOut() - find link for outgoing packets FindLinkIn() - find link for incoming packets Port search: - FindNewPortGroup() - find an available group of ports + FindNewPortGroup() - find an available group of ports */ /* Local prototypes */ @@ -599,7 +599,7 @@ GetNewPort(struct alias_link *link, int alias_port_param) When this parameter is GET_ALIAS_PORT, it indicates to get a randomly selected port number. */ - + if (alias_port_param == GET_ALIAS_PORT) { /* @@ -665,7 +665,7 @@ GetNewPort(struct alias_link *link, int alias_port_param) { if ((packetAliasMode & PKT_ALIAS_USE_SOCKETS) && (link->flags & LINK_PARTIALLY_SPECIFIED) - && ((link->link_type == LINK_TCP) || + && ((link->link_type == LINK_TCP) || (link->link_type == LINK_UDP))) { if (GetSocket(port_net, &link->sockfd, link->link_type)) @@ -695,7 +695,7 @@ GetNewPort(struct alias_link *link, int alias_port_param) } -static u_short +static u_short GetSocket(u_short port_net, int *sockfd, int link_type) { int err; @@ -745,7 +745,7 @@ GetSocket(u_short port_net, int *sockfd, int link_type) } -/* FindNewPortGroup() returns a base port number for an available +/* FindNewPortGroup() returns a base port number for an available range of contiguous port numbers. Note that if a port number is already in use, that does not mean that it cannot be used by another link concurrently. This is because FindNewPortGroup() @@ -756,8 +756,8 @@ FindNewPortGroup(struct in_addr dst_addr, struct in_addr alias_addr, u_short src_port, u_short dst_port, - u_short port_count, - u_char proto, + u_short port_count, + u_char proto, u_char align) { int i, j; @@ -814,7 +814,7 @@ FindNewPortGroup(struct in_addr dst_addr, struct alias_link *search_result; - for (j = 0; j < port_count; j++) + for (j = 0; j < port_count; j++) if (0 != (search_result = FindLinkIn(dst_addr, alias_addr, dst_port, htons(port_sys + j), link_type, 0))) @@ -887,7 +887,7 @@ IncrementalCleanup(void) { struct tcp_dat *tcp_aux; - tcp_aux = link->data.tcp; + tcp_aux = link->data.tcp; if (tcp_aux->state.in != ALIAS_TCP_STATE_CONNECTED || tcp_aux->state.out != ALIAS_TCP_STATE_CONNECTED) { @@ -1115,12 +1115,12 @@ AddLink(struct in_addr src_addr, } /* Set up pointers for output lookup table */ - start_point = StartPointOut(src_addr, dst_addr, + start_point = StartPointOut(src_addr, dst_addr, src_port, dst_port, link_type); LIST_INSERT_HEAD(&linkTableOut[start_point], link, list_out); /* Set up pointers for input lookup table */ - start_point = StartPointIn(alias_addr, link->alias_port, link_type); + start_point = StartPointIn(alias_addr, link->alias_port, link_type); LIST_INSERT_HEAD(&linkTableIn[start_point], link, list_in); } else @@ -1292,7 +1292,7 @@ _FindLinkIn(struct in_addr dst_addr, if (!(flags & LINK_PARTIALLY_SPECIFIED)) { if (link->alias_addr.s_addr == alias_addr.s_addr - && link->alias_port == alias_port + && link->alias_port == alias_port && link->dst_addr.s_addr == dst_addr.s_addr && link->dst_port == dst_port && link->link_type == link_type) @@ -1621,7 +1621,7 @@ FindUdpTcpIn(struct in_addr dst_addr, } -struct alias_link * +struct alias_link * FindUdpTcpOut(struct in_addr src_addr, struct in_addr dst_addr, u_short src_port, @@ -1753,7 +1753,7 @@ FindPptpInByPeerCallId(struct in_addr dst_addr, } -struct alias_link * +struct alias_link * FindRtspOut(struct in_addr src_addr, struct in_addr dst_addr, u_short src_port, @@ -1796,7 +1796,7 @@ struct in_addr FindOriginalAddress(struct in_addr alias_addr) { struct alias_link *link; - + link = FindLinkIn(nullAddress, alias_addr, 0, 0, LINK_ADDR, 0); if (link == NULL) @@ -1829,7 +1829,7 @@ struct in_addr FindAliasAddress(struct in_addr original_addr) { struct alias_link *link; - + link = FindLinkOut(original_addr, nullAddress, 0, 0, LINK_ADDR, 0); if (link == NULL) @@ -2061,7 +2061,7 @@ GetDeltaAckIn(struct ip *pip, struct alias_link *link) /* Find out how much the ACK number has been altered for an incoming TCP packet. To do this, a circular list of ACK numbers where the TCP -packet size was altered is searched. +packet size was altered is searched. */ int i; @@ -2112,7 +2112,7 @@ GetDeltaSeqOut(struct ip *pip, struct alias_link *link) /* Find out how much the sequence number has been altered for an outgoing TCP packet. To do this, a circular list of ACK numbers where the TCP -packet size was altered is searched. +packet size was altered is searched. */ int i; @@ -2401,7 +2401,7 @@ PacketAliasRedirectPort(struct in_addr src_addr, u_short src_port, #ifdef DEBUG else { - fprintf(stderr, "PacketAliasRedirectPort(): " + fprintf(stderr, "PacketAliasRedirectPort(): " "call to AddLink() failed\n"); } #endif @@ -2460,7 +2460,7 @@ PacketAliasRedirectProto(struct in_addr src_addr, #ifdef DEBUG else { - fprintf(stderr, "PacketAliasRedirectProto(): " + fprintf(stderr, "PacketAliasRedirectProto(): " "call to AddLink() failed\n"); } #endif @@ -2486,7 +2486,7 @@ PacketAliasRedirectAddr(struct in_addr src_addr, #ifdef DEBUG else { - fprintf(stderr, "PacketAliasRedirectAddr(): " + fprintf(stderr, "PacketAliasRedirectAddr(): " "call to AddLink() failed\n"); } #endif @@ -2653,7 +2653,7 @@ fill_cmd(ipfw_insn *cmd, enum ipfw_opcodes opcode, int flags, u_int16_t arg) cmd->opcode = opcode; cmd->len = ((cmd->len | flags) & (F_NOT | F_OR)) | 1; cmd->arg1 = arg; -} +} /* * helper function, updates the pointer to cmd with the length @@ -2700,13 +2700,13 @@ fill_rule(void *buf, int bufsize, int rulenum, fill_ip((ipfw_insn_ip *)cmd, O_IP_SRC, sa.s_addr); cmd = next_cmd(cmd); - + fill_one_port((ipfw_insn_u16 *)cmd, O_IP_SRCPORT, sp); cmd = next_cmd(cmd); fill_ip((ipfw_insn_ip *)cmd, O_IP_DST, da.s_addr); cmd = next_cmd(cmd); - + fill_one_port((ipfw_insn_u16 *)cmd, O_IP_DSTPORT, dp); cmd = next_cmd(cmd); @@ -2901,7 +2901,7 @@ static void ClearAllFWHoles(void) { struct ip_fw rule; /* On-the-fly built rule */ int i; - + if (fireWallFD < 0) return; |