diff options
author | brian <brian@FreeBSD.org> | 2002-07-01 11:19:40 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2002-07-01 11:19:40 +0000 |
commit | 95fdc0d64270a5c2ee2ae40815f48bf0e71216a6 (patch) | |
tree | 7ac18556721e3d172be5151edc94d09c3b206d75 /lib/libalias | |
parent | 603a2708879d64fbc0c4e66269000f4525895f2e (diff) | |
download | FreeBSD-src-95fdc0d64270a5c2ee2ae40815f48bf0e71216a6.zip FreeBSD-src-95fdc0d64270a5c2ee2ae40815f48bf0e71216a6.tar.gz |
Remove trailing whitespace
Diffstat (limited to 'lib/libalias')
-rw-r--r-- | lib/libalias/alias.c | 46 | ||||
-rw-r--r-- | lib/libalias/alias.h | 2 | ||||
-rw-r--r-- | lib/libalias/alias_cuseeme.c | 2 | ||||
-rw-r--r-- | lib/libalias/alias_db.c | 70 | ||||
-rw-r--r-- | lib/libalias/alias_irc.c | 16 | ||||
-rw-r--r-- | lib/libalias/alias_local.h | 2 | ||||
-rw-r--r-- | lib/libalias/alias_nbt.c | 84 | ||||
-rw-r--r-- | lib/libalias/alias_proxy.c | 10 | ||||
-rw-r--r-- | lib/libalias/alias_smedia.c | 46 | ||||
-rw-r--r-- | lib/libalias/alias_util.c | 6 |
10 files changed, 142 insertions, 142 deletions
diff --git a/lib/libalias/alias.c b/lib/libalias/alias.c index 320c5c2..a491f07 100644 --- a/lib/libalias/alias.c +++ b/lib/libalias/alias.c @@ -103,7 +103,7 @@ __FBSDID("$FreeBSD$"); Version 2.3 Dec 1998 (dillon) - Major bounds checking additions, see FreeBSD/CVS - Version 3.1 May, 2000 (salander) + Version 3.1 May, 2000 (salander) - Added hooks to handle PPTP. Version 3.2 July, 2000 (salander and satoh) @@ -186,7 +186,7 @@ TcpMonitorOut(struct ip *pip, struct alias_link *link) struct tcphdr *tc; tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); - + switch (GetStateOut(link)) { case ALIAS_TCP_STATE_NOT_CONNECTED: @@ -206,7 +206,7 @@ TcpMonitorOut(struct ip *pip, struct alias_link *link) -/* Protocol Specific Packet Aliasing Routines +/* Protocol Specific Packet Aliasing Routines IcmpAliasIn(), IcmpAliasIn1(), IcmpAliasIn2() IcmpAliasOut(), IcmpAliasOut1(), IcmpAliasOut2() @@ -358,7 +358,7 @@ IcmpAliasIn2(struct ip *pip) original_address = GetOriginalAddress(link); original_port = GetOriginalPort(link); - + /* Adjust ICMP checksum */ sptr = (u_short *) &(ip->ip_src); accumulate = *sptr++; @@ -380,7 +380,7 @@ IcmpAliasIn2(struct ip *pip) /* Un-alias address and port number of original IP packet fragment contained in ICMP data section */ ip->ip_src = original_address; - ud->uh_sport = original_port; + ud->uh_sport = original_port; } else if (ip->ip_p == IPPROTO_ICMP) { @@ -410,7 +410,7 @@ fragment contained in ICMP data section */ 2); pip->ip_dst = original_address; -/* Un-alias address of original IP packet and sequence number of +/* Un-alias address of original IP packet and sequence number of embedded ICMP datagram */ ip->ip_src = original_address; ic2->icmp_id = original_id; @@ -552,7 +552,7 @@ IcmpAliasOut2(struct ip *pip) alias_address = GetAliasAddress(link); alias_port = GetAliasPort(link); - + /* Adjust ICMP checksum */ sptr = (u_short *) &(ip->ip_dst); accumulate = *sptr++; @@ -579,7 +579,7 @@ IcmpAliasOut2(struct ip *pip) /* Alias address and port number of original IP packet fragment contained in ICMP data section */ ip->ip_dst = alias_address; - ud->uh_dport = alias_port; + ud->uh_dport = alias_port; } else if (ip->ip_p == IPPROTO_ICMP) { @@ -614,7 +614,7 @@ fragment contained in ICMP data section */ pip->ip_src = alias_address; } -/* Alias address of original IP packet and sequence number of +/* Alias address of original IP packet and sequence number of embedded ICMP datagram */ ip->ip_dst = alias_address; ic2->icmp_id = alias_id; @@ -1085,7 +1085,7 @@ TcpAliasOut(struct ip *pip, int maxpacketsize) else if (ntohs(tc->th_dport) == RTSP_CONTROL_PORT_NUMBER_1 || ntohs(tc->th_sport) == RTSP_CONTROL_PORT_NUMBER_1 || ntohs(tc->th_dport) == RTSP_CONTROL_PORT_NUMBER_2 - || ntohs(tc->th_sport) == RTSP_CONTROL_PORT_NUMBER_2) + || ntohs(tc->th_sport) == RTSP_CONTROL_PORT_NUMBER_2) AliasHandleRtspOut(pip, link, maxpacketsize); else if (ntohs(tc->th_dport) == PPTP_CONTROL_PORT_NUMBER || ntohs(tc->th_sport) == PPTP_CONTROL_PORT_NUMBER) @@ -1176,8 +1176,8 @@ FragmentIn(struct ip *pip) (u_short *) &original_address, (u_short *) &pip->ip_dst, 2); - pip->ip_dst = original_address; - + pip->ip_dst = original_address; + return(PKT_ALIAS_OK); } return(PKT_ALIAS_UNRESOLVED_FRAGMENT); @@ -1299,12 +1299,12 @@ PacketAliasIn(char *ptr, int maxpacketsize) ClearCheckNewLink(); pip = (struct ip *) ptr; alias_addr = pip->ip_dst; - + /* Defense against mangled packets */ if (ntohs(pip->ip_len) > maxpacketsize || (pip->ip_hl<<2) > maxpacketsize) return PKT_ALIAS_IGNORED; - + iresult = PKT_ALIAS_IGNORED; if ( (ntohs(pip->ip_off) & IP_OFFMASK) == 0 ) { @@ -1484,7 +1484,7 @@ PacketUnaliasOut(char *ptr, /* valid IP packet */ link = FindUdpTcpIn(pip->ip_dst, pip->ip_src, tc->th_dport, tc->th_sport, IPPROTO_TCP, 0); - else if (pip->ip_p == IPPROTO_ICMP) + else if (pip->ip_p == IPPROTO_ICMP) link = FindIcmpIn(pip->ip_dst, pip->ip_src, ic->icmp_id, 0); else link = NULL; @@ -1501,7 +1501,7 @@ PacketUnaliasOut(char *ptr, /* valid IP packet */ original_address = GetOriginalAddress(link); original_port = GetOriginalPort(link); - + /* Adjust TCP/UDP checksum */ sptr = (u_short *) &(pip->ip_src); accumulate = *sptr++; @@ -1514,7 +1514,7 @@ PacketUnaliasOut(char *ptr, /* valid IP packet */ accumulate += ud->uh_sport; accumulate -= original_port; ADJUST_CHECKSUM(accumulate, ud->uh_sum); - } else { + } else { accumulate += tc->th_sport; accumulate -= original_port; ADJUST_CHECKSUM(accumulate, tc->th_sum); @@ -1526,13 +1526,13 @@ PacketUnaliasOut(char *ptr, /* valid IP packet */ (u_short *) &pip->ip_src, 2); - /* Un-alias source address and port number */ + /* Un-alias source address and port number */ pip->ip_src = original_address; - if (pip->ip_p == IPPROTO_UDP) - ud->uh_sport = original_port; - else - tc->th_sport = original_port; - + if (pip->ip_p == IPPROTO_UDP) + ud->uh_sport = original_port; + else + tc->th_sport = original_port; + iresult = PKT_ALIAS_OK; } else if (pip->ip_p == IPPROTO_ICMP) { diff --git a/lib/libalias/alias.h b/lib/libalias/alias.h index 9df8929..eab4044 100644 --- a/lib/libalias/alias.h +++ b/lib/libalias/alias.h @@ -31,7 +31,7 @@ /*- * Alias.h defines the outside world interfaces for the packet aliasing * software. - * + * * This software is placed into the public domain with no restrictions on its * distribution. */ diff --git a/lib/libalias/alias_cuseeme.c b/lib/libalias/alias_cuseeme.c index 2c0587e..27d1c65d 100644 --- a/lib/libalias/alias_cuseeme.c +++ b/lib/libalias/alias_cuseeme.c @@ -81,7 +81,7 @@ AliasHandleCUSeeMeOut(struct ip *pip, struct alias_link *link) cu_link = FindUdpTcpOut(pip->ip_src, GetDestAddress(link), ud->uh_dport, 0, IPPROTO_UDP, 1); - + #ifndef NO_FW_PUNCH if (cu_link) PunchFWHole(cu_link); diff --git a/lib/libalias/alias_db.c b/lib/libalias/alias_db.c index f5b0405..579507c 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; diff --git a/lib/libalias/alias_irc.c b/lib/libalias/alias_irc.c index 82c39e3..02a2bb2 100644 --- a/lib/libalias/alias_irc.c +++ b/lib/libalias/alias_irc.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); /* Includes */ #include <ctype.h> -#include <stdio.h> +#include <stdio.h> #include <string.h> #include <sys/types.h> #include <netinet/in_systm.h> @@ -69,14 +69,14 @@ AliasHandleIrcOut(struct ip *pip, /* IP packet to examine */ struct alias_link *link, /* Which link are we on? */ int maxsize /* Maximum size of IP packet including headers */ ) -{ +{ int hlen, tlen, dlen; struct in_addr true_addr; u_short true_port; char *sptr; struct tcphdr *tc; int i; /* Iterator through the source */ - + /* Calculate data length of TCP packet */ tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); hlen = (pip->ip_hl + tc->th_off) << 2; @@ -88,7 +88,7 @@ AliasHandleIrcOut(struct ip *pip, /* IP packet to examine */ return; /* Place string pointer at beginning of data */ - sptr = (char *) pip; + sptr = (char *) pip; sptr += hlen; maxsize -= hlen; /* We're interested in maximum size of data, not packet */ @@ -231,7 +231,7 @@ lFOUND_CTCP: { struct alias_link *dcc_link; struct in_addr destaddr; - + true_port = htons(org_port); true_addr.s_addr = htonl(org_addr); @@ -262,7 +262,7 @@ lFOUND_CTCP: alias_address = GetAliasAddress(link); n = snprintf(&newpacket[iCopy], - sizeof(newpacket)-iCopy, + sizeof(newpacket)-iCopy, "%lu ", (u_long)htonl(alias_address.s_addr)); if( n < 0 ) { DBprintf(("DCC packet construct failure.\n")); @@ -274,7 +274,7 @@ lFOUND_CTCP: } alias_port = GetAliasPort(dcc_link); n = snprintf(&newpacket[iCopy], - sizeof(newpacket)-iCopy, + sizeof(newpacket)-iCopy, "%u", htons(alias_port) ); if( n < 0 ) { DBprintf(("DCC packet construct failure.\n")); @@ -321,7 +321,7 @@ lFOUND_CTCP: /* Revise IP header */ { u_short new_len; - + new_len = htons(hlen + iCopy + copyat); DifferentialChecksum(&pip->ip_sum, &new_len, diff --git a/lib/libalias/alias_local.h b/lib/libalias/alias_local.h index c25259a..4428d2a 100644 --- a/lib/libalias/alias_local.h +++ b/lib/libalias/alias_local.h @@ -38,7 +38,7 @@ * This software is placed into the public domain with no restrictions * on its distribution. * - * Initial version: August, 1996 (cjm) + * Initial version: August, 1996 (cjm) * * <updated several times by original author and Eivind Eklund> */ diff --git a/lib/libalias/alias_nbt.c b/lib/libalias/alias_nbt.c index 89e8089..4bc41bc 100644 --- a/lib/libalias/alias_nbt.c +++ b/lib/libalias/alias_nbt.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * TODO: - * oClean up. + * oClean up. * oConsidering for word alignment for other platform. */ @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); /* Includes */ #include <ctype.h> -#include <stdio.h> +#include <stdio.h> #include <string.h> #include <sys/types.h> #include <netinet/in_systm.h> @@ -114,7 +114,7 @@ static void PrintRcode( u_char rcode ) { default: printf("\n?%c?=%0x\n", '?', rcode ); - } + } } #endif @@ -143,7 +143,7 @@ static u_char *AliasHandleName ( u_char *p, char *pmax ) { compress = 1; else compress = 0; - + /* Get next length field */ p = (u_char *)(p + (*p & 0x3f) + 1); if ((char *)p > pmax) { @@ -184,7 +184,7 @@ static u_char *AliasHandleName ( u_char *p, char *pmax ) { return ((u_char *)p); } -/* +/* * NetBios Datagram Handler (IP/UDP) */ #define DGM_DIRECT_UNIQ 0x10 @@ -205,7 +205,7 @@ int AliasHandleUdpNbt( NbtDataHeader *ndh; u_char *p = NULL; char *pmax; - + /* Calculate data length of UDP packet */ uh = (struct udphdr *) ((char *) pip + (pip->ip_hl << 2)); pmax = (char *)uh + ntohs( uh->uh_ulen ); @@ -328,9 +328,9 @@ typedef struct { } NBTNsRNB; static u_char * -AliasHandleResourceNB( +AliasHandleResourceNB( NBTNsResource *q, - char *pmax, + char *pmax, NBTArguments *nbtarg) { NBTNsRNB *nb; @@ -397,7 +397,7 @@ typedef struct { } NBTNsResourceA; static u_char * -AliasHandleResourceA( +AliasHandleResourceA( NBTNsResource *q, char *pmax, NBTArguments *nbtarg) @@ -454,8 +454,8 @@ typedef struct { } NBTNsResourceNULL; static u_char * -AliasHandleResourceNULL( - NBTNsResource *q, +AliasHandleResourceNULL( + NBTNsResource *q, char *pmax, NBTArguments *nbtarg) { @@ -487,7 +487,7 @@ AliasHandleResourceNULL( } static u_char * -AliasHandleResourceNS( +AliasHandleResourceNS( NBTNsResource *q, char *pmax, NBTArguments *nbtarg) @@ -543,10 +543,10 @@ AliasHandleResourceNBSTAT( static u_char * AliasHandleResource( - u_short count, + u_short count, NBTNsResource *q, char *pmax, - NBTArguments + NBTArguments *nbtarg) { while ( count != 0 ) { @@ -562,45 +562,45 @@ AliasHandleResource( /* Type and Class filed */ switch ( ntohs(q->type) ) { case RR_TYPE_NB: - q = (NBTNsResource *)AliasHandleResourceNB( + q = (NBTNsResource *)AliasHandleResourceNB( q, pmax, - nbtarg + nbtarg ); break; - case RR_TYPE_A: - q = (NBTNsResource *)AliasHandleResourceA( - q, - pmax, + case RR_TYPE_A: + q = (NBTNsResource *)AliasHandleResourceA( + q, + pmax, nbtarg ); break; case RR_TYPE_NS: - q = (NBTNsResource *)AliasHandleResourceNS( + q = (NBTNsResource *)AliasHandleResourceNS( q, - pmax, - nbtarg + pmax, + nbtarg ); break; case RR_TYPE_NULL: - q = (NBTNsResource *)AliasHandleResourceNULL( - q, - pmax, - nbtarg + q = (NBTNsResource *)AliasHandleResourceNULL( + q, + pmax, + nbtarg ); break; case RR_TYPE_NBSTAT: q = (NBTNsResource *)AliasHandleResourceNBSTAT( q, - pmax, + pmax, nbtarg ); break; - default: + default: #ifdef DEBUG printf( - "\nUnknown Type of Resource %0x\n", - ntohs(q->type) + "\nUnknown Type of Resource %0x\n", + ntohs(q->type) ); #endif break; @@ -625,7 +625,7 @@ int AliasHandleUdpNbtNS( char *pmax; NBTArguments nbtarg; - /* Set up Common Parameter */ + /* Set up Common Parameter */ nbtarg.oldaddr = *alias_address; nbtarg.oldport = *alias_port; nbtarg.newaddr = *original_address; @@ -643,7 +643,7 @@ int AliasHandleUdpNbtNS( #ifdef DEBUG printf(" [%s] ID=%02x, op=%01x, flag=%02x, rcode=%01x, qd=%04x" - ", an=%04x, ns=%04x, ar=%04x, [%d]-->", + ", an=%04x, ns=%04x, ar=%04x, [%d]-->", nsh->dir ? "Response": "Request", nsh->nametrid, nsh->opcode, @@ -662,8 +662,8 @@ int AliasHandleUdpNbtNS( p = AliasHandleQuestion( ntohs(nsh->qdcount), (NBTNsQuestion *)p, - pmax, - &nbtarg + pmax, + &nbtarg ); } @@ -672,18 +672,18 @@ int AliasHandleUdpNbtNS( p = AliasHandleResource( ntohs(nsh->ancount), (NBTNsResource *)p, - pmax, - &nbtarg + pmax, + &nbtarg ); } /* Authority Resource Recodrs */ if (ntohs(nsh->nscount) !=0 ) { p = AliasHandleResource( - ntohs(nsh->nscount), + ntohs(nsh->nscount), (NBTNsResource *)p, - pmax, - &nbtarg + pmax, + &nbtarg ); } @@ -692,8 +692,8 @@ int AliasHandleUdpNbtNS( p = AliasHandleResource( ntohs(nsh->arcount), (NBTNsResource *)p, - pmax, - &nbtarg + pmax, + &nbtarg ); } diff --git a/lib/libalias/alias_proxy.c b/lib/libalias/alias_proxy.c index 3bd007c..6c95ea9 100644 --- a/lib/libalias/alias_proxy.c +++ b/lib/libalias/alias_proxy.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); presently supported: addition of a [DEST addr port] string at the beginning a of tcp stream, or inclusion of an optional field in the IP header. - + There is one public API function: PacketAliasProxyRule() -- Adds and deletes proxy @@ -301,7 +301,7 @@ ProxyEncodeTcpStream(struct alias_link *link, /* Translate destination address and port to string form */ snprintf(buffer, sizeof(buffer) - 2, "[DEST %s %d]", inet_ntoa(GetProxyAddress (link)), (u_int) ntohs(GetProxyPort (link))); - + /* Pad string out to a multiple of two in length */ slen = strlen(buffer); switch (slen % 2) @@ -663,7 +663,7 @@ PacketAliasProxyRule(const char *cmd) else { *p = ' '; - + n = sscanf(token, "%s %s", s, str_server_port); if (n != 2) return -1; @@ -753,7 +753,7 @@ PacketAliasProxyRule(const char *cmd) src_addr = addr; src_mask = mask; } - else + else { dst_addr = addr; dst_mask = mask; @@ -799,7 +799,7 @@ PacketAliasProxyRule(const char *cmd) } if (strlen(str_server_port) != 0) - { + { int err; err = IpPort(str_server_port, proto, &server_port); diff --git a/lib/libalias/alias_smedia.c b/lib/libalias/alias_smedia.c index 027a724..a3ba7ae 100644 --- a/lib/libalias/alias_smedia.c +++ b/lib/libalias/alias_smedia.c @@ -70,17 +70,17 @@ __FBSDID("$FreeBSD$"); Alias_smedia.c is meant to contain the aliasing code for streaming media protocols. It performs special processing for RSTP sessions under TCP. Specifically, when a SETUP request is sent by a client, or a 200 reply - is sent by a server, it is intercepted and modified. The address is + is sent by a server, it is intercepted and modified. The address is changed to the gateway machine and an aliasing port is used. - More specifically, the "client_port" configuration parameter is - parsed for SETUP requests. The "server_port" configuration parameter is + More specifically, the "client_port" configuration parameter is + parsed for SETUP requests. The "server_port" configuration parameter is parsed for 200 replies eminating from a server. This is intended to handle the unicast case. RTSP also allows a redirection of a stream to another client by using the "destination" configuration parameter. The destination config parm would - indicate a different IP address. This function is NOT supported by the + indicate a different IP address. This function is NOT supported by the RTSP translation code below. The RTSP multicast functions without any address translation intervention. @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); changes of sequence and acknowledgment numbers, since the client machine is totally unaware of the modification to the TCP stream. - Initial version: May, 2000 (eds) + Initial version: May, 2000 (eds) */ #include <stdio.h> @@ -109,8 +109,8 @@ __FBSDID("$FreeBSD$"); #include "alias_local.h" -#define RTSP_CONTROL_PORT_NUMBER_1 554 -#define RTSP_CONTROL_PORT_NUMBER_2 7070 +#define RTSP_CONTROL_PORT_NUMBER_1 554 +#define RTSP_CONTROL_PORT_NUMBER_2 7070 #define RTSP_PORT_GROUP 2 #define ISDIGIT(a) (((a) >= '0') && ((a) <= '9')) @@ -152,7 +152,7 @@ alias_rtsp_out(struct ip *pip, char newdata[2048], *port_data, *port_newdata, stemp[80]; int links_created = 0, pkt_updated = 0; struct alias_link *rtsp_link = NULL; - struct in_addr null_addr; + struct in_addr null_addr; /* Calculate data length of TCP packet */ tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2)); @@ -217,15 +217,15 @@ alias_rtsp_out(struct ip *pip, if (!links_created) { - links_created = 1; + links_created = 1; /* Find an even numbered port number base that satisfies the contiguous number of ports we need */ null_addr.s_addr = 0; if (0 == (salias = FindNewPortGroup(null_addr, FindAliasAddress(pip->ip_src), - sport, 0, - RTSP_PORT_GROUP, - IPPROTO_UDP, 1))) { + sport, 0, + RTSP_PORT_GROUP, + IPPROTO_UDP, 1))) { #ifdef DEBUG fprintf(stderr, "PacketAlias/RTSP: Cannot find contiguous RTSP data ports\n"); @@ -361,7 +361,7 @@ alias_pna_out(struct ip *pip, } work += ntohs(msg_len); } - + return 0; } @@ -385,8 +385,8 @@ AliasHandleRtspOut(struct ip *pip, struct alias_link *link, int maxpacketsize) data += hlen; /* When aliasing a client, check for the SETUP request */ - if ((ntohs(tc->th_dport) == RTSP_CONTROL_PORT_NUMBER_1) || - (ntohs(tc->th_dport) == RTSP_CONTROL_PORT_NUMBER_2)) { + if ((ntohs(tc->th_dport) == RTSP_CONTROL_PORT_NUMBER_1) || + (ntohs(tc->th_dport) == RTSP_CONTROL_PORT_NUMBER_2)) { if (dlen >= strlen(setup)) { if (memcmp(data, setup, strlen(setup)) == 0) { @@ -407,23 +407,23 @@ AliasHandleRtspOut(struct ip *pip, struct alias_link *link, int maxpacketsize) if (dlen >= strlen(str200)) { - for (parseOk = 0, i = 0; - i <= dlen - strlen(str200); + for (parseOk = 0, i = 0; + i <= dlen - strlen(str200); i++) { - if (memcmp(&data[i], str200, strlen(str200)) == 0) { - parseOk = 1; + if (memcmp(&data[i], str200, strlen(str200)) == 0) { + parseOk = 1; break; } } - if (parseOk) { + if (parseOk) { - i += strlen(str200); /* skip string found */ + i += strlen(str200); /* skip string found */ while(data[i] == ' ') /* skip blank(s) */ i++; - + if ((dlen - i) >= strlen(okstr)) { - if (memcmp(&data[i], okstr, strlen(okstr)) == 0) + if (memcmp(&data[i], okstr, strlen(okstr)) == 0) alias_rtsp_out(pip, link, data, server_port_str); } diff --git a/lib/libalias/alias_util.c b/lib/libalias/alias_util.c index 787c859..d6b40a2 100644 --- a/lib/libalias/alias_util.c +++ b/lib/libalias/alias_util.c @@ -49,7 +49,7 @@ been zeroed out. If the checksum word is filled with the proper value, then these routines will give a result of zero (useful for testing purposes); */ - + #include <sys/types.h> #include <netinet/in_systm.h> #include <netinet/in.h> @@ -90,7 +90,7 @@ IpChecksum(struct ip *pip) } -u_short +u_short TcpChecksum(struct ip *pip) { u_short *ptr; @@ -103,7 +103,7 @@ TcpChecksum(struct ip *pip) tc = (struct tcphdr *) ((char *) pip + nhdr); ptr = (u_short *) tc; - + /* Add up TCP header and data */ nbytes = ntcp; sum = 0; |