aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/libalias/alias_local.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/libalias/alias_local.h')
-rw-r--r--sys/netinet/libalias/alias_local.h178
1 files changed, 74 insertions, 104 deletions
diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h
index ba128638c1fe..e6374a72ef75 100644
--- a/sys/netinet/libalias/alias_local.h
+++ b/sys/netinet/libalias/alias_local.h
@@ -66,8 +66,8 @@
#endif
/* Sizes of input and output link tables */
-#define LINK_TABLE_OUT_SIZE 4001
-#define LINK_TABLE_IN_SIZE 4001
+#define LINK_TABLE_OUT_SIZE 4001
+#define LINK_TABLE_IN_SIZE 4001
#define GET_ALIAS_PORT -1
#define GET_ALIAS_ID GET_ALIAS_PORT
@@ -82,30 +82,21 @@ struct proxy_entry;
struct libalias {
LIST_ENTRY(libalias) instancelist;
-
- int packetAliasMode; /* Mode flags */
- /* - documented in alias.h */
-
- struct in_addr aliasAddress; /* Address written onto source */
- /* field of IP packet. */
-
- struct in_addr targetAddress; /* IP address incoming packets */
- /* are sent to if no aliasing */
- /* link already exists */
-
- struct in_addr nullAddress; /* Used as a dummy parameter for */
- /* some function calls */
-
- LIST_HEAD (, alias_link) linkTableOut[LINK_TABLE_OUT_SIZE];
- /* Lookup table of pointers to */
- /* chains of link records. Each */
-
- LIST_HEAD (, alias_link) linkTableIn[LINK_TABLE_IN_SIZE];
- /* link record is doubly indexed */
- /* into input and output lookup */
- /* tables. */
-
- /* Link statistics */
+ /* Mode flags documented in alias.h */
+ int packetAliasMode;
+ /* Address written onto source field of IP packet. */
+ struct in_addr aliasAddress;
+ /* IP address incoming packets are sent to
+ * if no aliasing link already exists */
+ struct in_addr targetAddress;
+ /* Used as a dummy parameter for some function calls */
+ struct in_addr nullAddress;
+ /* Lookup table of pointers to chains of link records.
+ * Each link record is doubly indexed into input and
+ * output lookup tables. */
+ LIST_HEAD (, alias_link) linkTableOut[LINK_TABLE_OUT_SIZE];
+ LIST_HEAD (, alias_link) linkTableIn[LINK_TABLE_IN_SIZE];
+ /* Link statistics */
int icmpLinkCount;
int udpLinkCount;
int tcpLinkCount;
@@ -114,49 +105,41 @@ struct libalias {
int fragmentIdLinkCount;
int fragmentPtrLinkCount;
int sockCount;
-
- int cleanupIndex; /* Index to chain of link table */
- /* being inspected for old links */
-
- int timeStamp; /* System time in seconds for */
- /* current packet */
-
- int lastCleanupTime; /* Last time
- * IncrementalCleanup() */
- /* was called */
-
- int deleteAllLinks; /* If equal to zero, DeleteLink() */
- /* will not remove permanent links */
-
- /* log descriptor */
-#ifdef _KERNEL
- char *logDesc;
-#else
- FILE *logDesc;
+ /* Index to chain of link table being inspected for old links */
+ int cleanupIndex;
+ /* System time in seconds for current packet */
+ int timeStamp;
+ /* Last time IncrementalCleanup() was called */
+ int lastCleanupTime;
+ /* If equal to zero, DeleteLink()
+ * will not remove permanent links */
+ int deleteAllLinks;
+ /* log descriptor */
+#ifdef _KERNEL
+ char *logDesc;
+#else
+ FILE *logDesc;
#endif
- /* statistics monitoring */
-
- int newDefaultLink; /* Indicates if a new aliasing */
- /* link has been created after a */
- /* call to PacketAliasIn/Out(). */
+ /* Indicates if a new aliasing link has been created
+ * after a call to PacketAliasIn/Out(). */
+ int newDefaultLink;
#ifndef NO_FW_PUNCH
- int fireWallFD; /* File descriptor to be able to */
- /* control firewall. Opened by */
- /* PacketAliasSetMode on first */
- /* setting the PKT_ALIAS_PUNCH_FW */
- /* flag. */
- int fireWallBaseNum; /* The first firewall entry
- * free for our use */
- int fireWallNumNums; /* How many entries can we
- * use? */
- int fireWallActiveNum; /* Which entry did we last
- * use? */
- char *fireWallField; /* bool array for entries */
+ /* File descriptor to be able to control firewall.
+ * Opened by PacketAliasSetMode on first setting
+ * the PKT_ALIAS_PUNCH_FW flag. */
+ int fireWallFD;
+ /* The first firewall entry free for our use */
+ int fireWallBaseNum;
+ /* How many entries can we use? */
+ int fireWallNumNums;
+ /* Which entry did we last use? */
+ int fireWallActiveNum;
+ /* bool array for entries */
+ char *fireWallField;
#endif
-
- unsigned int skinnyPort; /* TCP port used by the Skinny */
- /* protocol. */
+ /* TCP port used by the Skinny protocol. */
+ unsigned int skinnyPort;
struct proxy_entry *proxyList;
@@ -173,25 +156,17 @@ struct libalias {
/* counts associations that have progressed to UP and not yet removed */
int sctpLinkCount;
-#ifdef _KERNEL
+#ifdef _KERNEL
/* timing queue for keeping track of association timeouts */
struct sctp_nat_timer sctpNatTimer;
-
/* size of hash table used in this instance */
u_int sctpNatTableSize;
-
-/*
- * local look up table sorted by l_vtag/l_port
- */
+ /* local look up table sorted by l_vtag/l_port */
LIST_HEAD(sctpNatTableL, sctp_nat_assoc) *sctpTableLocal;
-/*
- * global look up table sorted by g_vtag/g_port
- */
+ /* global look up table sorted by g_vtag/g_port */
LIST_HEAD(sctpNatTableG, sctp_nat_assoc) *sctpTableGlobal;
- /*
- * avoid races in libalias: every public function has to use it.
- */
+ /* avoid races in libalias: every public function has to use it. */
struct mtx mutex;
#endif
};
@@ -200,7 +175,7 @@ struct libalias {
#ifdef _KERNEL
#define LIBALIAS_LOCK_INIT(l) \
- mtx_init(&l->mutex, "per-instance libalias mutex", NULL, MTX_DEF)
+ mtx_init(&l->mutex, "per-instance libalias mutex", NULL, MTX_DEF)
#define LIBALIAS_LOCK_ASSERT(l) mtx_assert(&l->mutex, MA_OWNED)
#define LIBALIAS_LOCK(l) mtx_lock(&l->mutex)
#define LIBALIAS_UNLOCK(l) mtx_unlock(&l->mutex)
@@ -240,7 +215,7 @@ struct libalias {
/*
* SctpFunction prototypes
- *
+ *
*/
void AliasSctpInit(struct libalias *la);
void AliasSctpTerm(struct libalias *la);
@@ -279,9 +254,9 @@ struct alias_link *
FindFragmentIn2(struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr,
u_short _ip_id);
struct alias_link *
- AddFragmentPtrLink(struct libalias *la, struct in_addr _dst_addr, u_short _ip_id);
+AddFragmentPtrLink(struct libalias *la, struct in_addr _dst_addr, u_short _ip_id);
struct alias_link *
- FindFragmentPtr(struct libalias *la, struct in_addr _dst_addr, u_short _ip_id);
+FindFragmentPtr(struct libalias *la, struct in_addr _dst_addr, u_short _ip_id);
struct alias_link *
FindProtoIn(struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr,
u_char _proto);
@@ -313,17 +288,17 @@ struct alias_link *
FindRtspOut(struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr,
u_short _src_port, u_short _alias_port, u_char _proto);
struct in_addr
- FindOriginalAddress(struct libalias *la, struct in_addr _alias_addr);
+FindOriginalAddress(struct libalias *la, struct in_addr _alias_addr);
+struct in_addr
+FindAliasAddress(struct libalias *la, struct in_addr _original_addr);
struct in_addr
- FindAliasAddress(struct libalias *la, struct in_addr _original_addr);
-struct in_addr
FindSctpRedirectAddress(struct libalias *la, struct sctp_nat_msg *sm);
/* External data access/modification */
-int
-FindNewPortGroup(struct libalias *la, 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_char _align);
+int FindNewPortGroup(struct libalias *la, 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_char _align);
void GetFragmentAddr(struct alias_link *_lnk, struct in_addr *_src_addr);
void SetFragmentAddr(struct alias_link *_lnk, struct in_addr _src_addr);
void GetFragmentPtr(struct alias_link *_lnk, void **_fptr);
@@ -332,27 +307,22 @@ void SetStateIn(struct alias_link *_lnk, int _state);
void SetStateOut(struct alias_link *_lnk, int _state);
int GetStateIn (struct alias_link *_lnk);
int GetStateOut(struct alias_link *_lnk);
-struct in_addr
- GetOriginalAddress(struct alias_link *_lnk);
-struct in_addr
- GetDestAddress(struct alias_link *_lnk);
-struct in_addr
- GetAliasAddress(struct alias_link *_lnk);
-struct in_addr
- GetDefaultAliasAddress(struct libalias *la);
+struct in_addr GetOriginalAddress(struct alias_link *_lnk);
+struct in_addr GetDestAddress(struct alias_link *_lnk);
+struct in_addr GetAliasAddress(struct alias_link *_lnk);
+struct in_addr GetDefaultAliasAddress(struct libalias *la);
void SetDefaultAliasAddress(struct libalias *la, struct in_addr _alias_addr);
u_short GetOriginalPort(struct alias_link *_lnk);
u_short GetAliasPort(struct alias_link *_lnk);
-struct in_addr
- GetProxyAddress(struct alias_link *_lnk);
+struct in_addr GetProxyAddress(struct alias_link *_lnk);
void SetProxyAddress(struct alias_link *_lnk, struct in_addr _addr);
u_short GetProxyPort(struct alias_link *_lnk);
void SetProxyPort(struct alias_link *_lnk, u_short _port);
void SetAckModified(struct alias_link *_lnk);
int GetAckModified(struct alias_link *_lnk);
int GetDeltaAckIn(u_long, struct alias_link *_lnk);
-int GetDeltaSeqOut(u_long, struct alias_link *lnk);
-void AddSeq(struct alias_link *lnk, int delta, u_int ip_hl,
+int GetDeltaSeqOut(u_long, struct alias_link *lnk);
+void AddSeq(struct alias_link *lnk, int delta, u_int ip_hl,
u_short ip_len, u_long th_seq, u_int th_off);
void SetExpire (struct alias_link *_lnk, int _expire);
void ClearCheckNewLink(struct libalias *la);
@@ -368,18 +338,18 @@ void PunchFWHole(struct alias_link *_lnk);
/* Housekeeping function */
void HouseKeeping(struct libalias *);
-/* Tcp specific routines */
-/* lint -save -library Suppress flexelint warnings */
-
/* Transparent proxy routines */
int
ProxyCheck(struct libalias *la, struct in_addr *proxy_server_addr,
- u_short * proxy_server_port, struct in_addr src_addr,
+ u_short * proxy_server_port, struct in_addr src_addr,
struct in_addr dst_addr, u_short dst_port, u_char ip_p);
void
ProxyModify(struct libalias *la, struct alias_link *_lnk, struct ip *_pip,
int _maxpacketsize, int _proxy_type);
+/* Tcp specific routines */
+/* lint -save -library Suppress flexelint warnings */
+
enum alias_tcp_state {
ALIAS_TCP_STATE_NOT_CONNECTED,
ALIAS_TCP_STATE_CONNECTED,