FreeBSD kernel IPv4 code
alias_local.h File Reference
#include <sys/tree.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <netinet/libalias/alias_sctp.h>
Include dependency graph for alias_local.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  group_in
 
struct  libalias
 

Macros

#define INADDR_NONE   0xffffffff
 
#define GET_ALIAS_PORT   -1
 
#define GET_ALIAS_ID   GET_ALIAS_PORT
 
#define INET_NTOA_BUF(buf)   (buf)
 
#define LIBALIAS_LOCK_INIT(l)    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)
 
#define LIBALIAS_LOCK_DESTROY(l)   mtx_destroy(&l->mutex)
 
#define ADJUST_CHECKSUM(acc, cksum)
 

Enumerations

enum  alias_tcp_state { ALIAS_TCP_STATE_NOT_CONNECTED , ALIAS_TCP_STATE_CONNECTED , ALIAS_TCP_STATE_DISCONNECTED }
 

Functions

void AliasSctpInit (struct libalias *la)
 Initialises the SCTP NAT Implementation. More...
 
void AliasSctpTerm (struct libalias *la)
 Cleans-up the SCTP NAT Implementation prior to unloading. More...
 
int SctpAlias (struct libalias *la, struct ip *ip, int direction)
 Handles SCTP packets passed from libalias. More...
 
void DifferentialChecksum (u_short *_cksum, void *_new, void *_old, int _n)
 
struct alias_linkAddLink (struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, struct in_addr alias_addr, u_short src_port, u_short dst_port, int alias_param, int link_type)
 
struct alias_linkFindIcmpIn (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_short _id_alias, int _create)
 
struct alias_linkFindIcmpOut (struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr, u_short _id, int _create)
 
struct alias_linkFindFragmentIn1 (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_short _ip_id)
 
struct alias_linkFindFragmentIn2 (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_short _ip_id)
 
struct alias_linkAddFragmentPtrLink (struct libalias *la, struct in_addr _dst_addr, u_short _ip_id)
 
struct alias_linkFindFragmentPtr (struct libalias *la, struct in_addr _dst_addr, u_short _ip_id)
 
struct alias_linkFindProtoIn (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_char _proto)
 
struct alias_linkFindProtoOut (struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr, u_char _proto)
 
struct alias_linkFindUdpTcpIn (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_short _dst_port, u_short _alias_port, u_char _proto, int _create)
 
struct alias_linkFindUdpTcpOut (struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr, u_short _src_port, u_short _dst_port, u_char _proto, int _create)
 
struct alias_linkAddPptp (struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr, struct in_addr _alias_addr, u_int16_t _src_call_id)
 
struct alias_linkFindPptpOutByCallId (struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr, u_int16_t _src_call_id)
 
struct alias_linkFindPptpInByCallId (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_int16_t _dst_call_id)
 
struct alias_linkFindPptpOutByPeerCallId (struct libalias *la, struct in_addr _src_addr, struct in_addr _dst_addr, u_int16_t _dst_call_id)
 
struct alias_linkFindPptpInByPeerCallId (struct libalias *la, struct in_addr _dst_addr, struct in_addr _alias_addr, u_int16_t _alias_call_id)
 
struct alias_linkFindRtspOut (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)
 
struct in_addr FindAliasAddress (struct libalias *la, struct in_addr _original_addr)
 
struct in_addr FindSctpRedirectAddress (struct libalias *la, struct sctp_nat_msg *sm)
 
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)
 
void SetFragmentPtr (struct alias_link *_lnk, void *fptr)
 
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)
 
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)
 
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, u_short ip_len, u_long th_seq, u_int th_off)
 
void SetExpire (struct alias_link *_lnk, int _expire)
 
void SetProtocolFlags (struct alias_link *_lnk, int _pflags)
 
int GetProtocolFlags (struct alias_link *_lnk)
 
void SetDestCallId (struct alias_link *_lnk, u_int16_t _cid)
 
void PunchFWHole (struct alias_link *_lnk)
 
void HouseKeeping (struct libalias *)
 
int ProxyCheck (struct libalias *la, struct in_addr *proxy_server_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)
 

Variables

int LibAliasTime
 

Macro Definition Documentation

◆ ADJUST_CHECKSUM

#define ADJUST_CHECKSUM (   acc,
  cksum 
)
Value:
do { \
acc += cksum; \
if (acc < 0) { \
acc = -acc; \
acc = (acc >> 16) + (acc & 0xffff); \
acc += acc >> 16; \
cksum = (u_short) ~acc; \
} else { \
acc = (acc >> 16) + (acc & 0xffff); \
acc += acc >> 16; \
cksum = (u_short) acc; \
} \
} while (0)

Definition at line 194 of file alias_local.h.

◆ GET_ALIAS_ID

#define GET_ALIAS_ID   GET_ALIAS_PORT

Definition at line 71 of file alias_local.h.

◆ GET_ALIAS_PORT

#define GET_ALIAS_PORT   -1

Definition at line 70 of file alias_local.h.

◆ INADDR_NONE

#define INADDR_NONE   0xffffffff

Definition at line 62 of file alias_local.h.

◆ INET_NTOA_BUF

#define INET_NTOA_BUF (   buf)    (buf)

Definition at line 74 of file alias_local.h.

◆ LIBALIAS_LOCK

#define LIBALIAS_LOCK (   l)    mtx_lock(&l->mutex)

Definition at line 175 of file alias_local.h.

◆ LIBALIAS_LOCK_ASSERT

#define LIBALIAS_LOCK_ASSERT (   l)    mtx_assert(&l->mutex, MA_OWNED)

Definition at line 174 of file alias_local.h.

◆ LIBALIAS_LOCK_DESTROY

#define LIBALIAS_LOCK_DESTROY (   l)    mtx_destroy(&l->mutex)

Definition at line 177 of file alias_local.h.

◆ LIBALIAS_LOCK_INIT

#define LIBALIAS_LOCK_INIT (   l)     mtx_init(&l->mutex, "per-instance libalias mutex", NULL, MTX_DEF)

Definition at line 172 of file alias_local.h.

◆ LIBALIAS_UNLOCK

#define LIBALIAS_UNLOCK (   l)    mtx_unlock(&l->mutex)

Definition at line 176 of file alias_local.h.

Enumeration Type Documentation

◆ alias_tcp_state

Enumerator
ALIAS_TCP_STATE_NOT_CONNECTED 
ALIAS_TCP_STATE_CONNECTED 
ALIAS_TCP_STATE_DISCONNECTED 

Definition at line 350 of file alias_local.h.

Function Documentation

◆ AddFragmentPtrLink()

struct alias_link * AddFragmentPtrLink ( struct libalias la,
struct in_addr  _dst_addr,
u_short  _ip_id 
)

Definition at line 1069 of file alias_db.c.

References AddLink(), ANY_ADDR, alias_link::dst_addr, ip_id, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_FRAGMENT_PTR, NO_DEST_PORT, and NO_SRC_PORT.

Referenced by LibAliasSaveFragment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddLink()

struct alias_link * AddLink ( struct libalias la,
struct in_addr  src_addr,
struct in_addr  dst_addr,
struct in_addr  alias_addr,
u_short  src_port,
u_short  dst_port,
int  alias_param,
int  link_type 
)

Definition at line 564 of file alias_db.c.

References tcp_dat::ack, tcp_state::ack_modified, ack_data_record::active, alias_link::alias_addr, group_in::alias_addr, alias_link::alias_port, ALIAS_TCP_STATE_NOT_CONNECTED, alias_link::data, alias_link::dst_addr, alias_link::dst_port, expire, alias_link::expire, alias_link::flags, FRAGMENT_ID_EXPIRE_TIME, FRAGMENT_PTR_EXPIRE_TIME, libalias::fragmentIdLinkCount, libalias::fragmentPtrLinkCount, tcp_dat::fwhole, GetNewPort(), ICMP_EXPIRE_TIME, libalias::icmpLinkCount, tcp_state::in, INADDR_ANY, tcp_state::index, alias_link::la, LIBALIAS_LOCK_ASSERT, LibAliasTime, LINK_ADDR, LINK_FRAGMENT_ID, LINK_FRAGMENT_PTR, LINK_ICMP, LINK_PARTIALLY_SPECIFIED, LINK_PPTP, LINK_TCP, alias_link::link_type, group_in::link_type, LINK_UDP, LINK_UNKNOWN_DEST_ADDR, LINK_UNKNOWN_DEST_PORT, N_LINK_TCP_DATA, tcp_state::out, libalias::packetAliasMode, group_in::partial, alias_link::pflags, PKT_ALIAS_LOG, libalias::pptpLinkCount, PROTO_EXPIRE_TIME, libalias::protoLinkCount, alias_link::proxy_addr, alias_link::proxy_port, in_addr::s_addr, alias_link::server, ShowAliasStats(), alias_link::sockfd, alias_link::src_addr, alias_link::src_port, StartPointIn(), tcp_dat::state, alias_link::tcp, TCP_EXPIRE_INITIAL, libalias::tcpLinkCount, alias_link::time, alias_link::timestamp, UDP_EXPIRE_TIME, and libalias::udpLinkCount.

Referenced by AddFragmentPtrLink(), AddPptp(), AliasHandleFtpIn(), FindFragmentIn1(), FindIcmpIn(), FindIcmpOut(), FindProtoIn(), FindProtoOut(), FindRtspOut(), FindUdpTcpIn(), FindUdpTcpOut(), LibAliasRedirectAddr(), LibAliasRedirectPort(), LibAliasRedirectProto(), NewFtpMessage(), and ReLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddPptp()

struct alias_link * AddPptp ( struct libalias la,
struct in_addr  _src_addr,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_int16_t  _src_call_id 
)

Definition at line 1211 of file alias_db.c.

References AddLink(), alias_link::alias_addr, alias_link::dst_addr, GET_ALIAS_PORT, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_PPTP, and alias_link::src_addr.

Referenced by AliasHandlePptpOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddSeq()

void AddSeq ( struct alias_link lnk,
int  delta,
u_int  ip_hl,
u_short  ip_len,
u_long  th_seq,
u_int  th_off 
)

◆ AliasSctpInit()

void AliasSctpInit ( struct libalias la)

Initialises the SCTP NAT Implementation.

Creates the look-up tables and the timer queue and initialises all state variables

Parameters
laPointer to the relevant libalias instance

Definition at line 653 of file alias_sctp.c.

Referenced by LibAliasInit().

Here is the caller graph for this function:

◆ AliasSctpTerm()

void AliasSctpTerm ( struct libalias la)

Cleans-up the SCTP NAT Implementation prior to unloading.

Removes all entries from the timer queue, freeing associations as it goes. We then free memory allocated to the look-up tables and the time queue

NOTE: We do not need to traverse the look-up tables as each association will always have an entry in the timer queue, freeing this memory once will free all memory allocated to entries in the look-up tables

Parameters
laPointer to the relevant libalias instance

Definition at line 694 of file alias_sctp.c.

Referenced by LibAliasInit(), and LibAliasUninit().

Here is the caller graph for this function:

◆ DifferentialChecksum()

void DifferentialChecksum ( u_short *  _cksum,
void *  _new,
void *  _old,
int  _n 
)

◆ FindAliasAddress()

struct in_addr FindAliasAddress ( struct libalias la,
struct in_addr  _original_addr 
)

Definition at line 1363 of file alias_db.c.

References alias_link::alias_addr, libalias::aliasAddress, ANY_ADDR, FindLinkOut(), INADDR_ANY, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_ADDR, and in_addr::s_addr.

Referenced by alias_rtsp_out(), FindIcmpOut(), FindProtoOut(), FindRtspOut(), FindUdpTcpOut(), and FragmentOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindFragmentIn1()

struct alias_link * FindFragmentIn1 ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_short  _ip_id 
)

Definition at line 1038 of file alias_db.c.

References AddLink(), alias_link::alias_addr, ANY_ADDR, alias_link::dst_addr, FindLinkIn(), ip_id, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_FRAGMENT_ID, NO_DEST_PORT, and NO_SRC_PORT.

Referenced by LibAliasInLocked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindFragmentIn2()

struct alias_link * FindFragmentIn2 ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_short  _ip_id 
)

Definition at line 1059 of file alias_db.c.

References alias_link::alias_addr, alias_link::dst_addr, FindLinkIn(), ip_id, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_FRAGMENT_ID, and NO_DEST_PORT.

Referenced by FragmentIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindFragmentPtr()

struct alias_link * FindFragmentPtr ( struct libalias la,
struct in_addr  _dst_addr,
u_short  _ip_id 
)

Definition at line 1079 of file alias_db.c.

References ANY_ADDR, alias_link::dst_addr, FindLinkIn(), ip_id, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_FRAGMENT_PTR, and NO_DEST_PORT.

Referenced by LibAliasGetFragment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindIcmpIn()

struct alias_link * FindIcmpIn ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_short  _id_alias,
int  _create 
)

Definition at line 992 of file alias_db.c.

References AddLink(), alias_link::alias_addr, alias_link::dst_addr, FindLinkIn(), FindOriginalAddress(), alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_ICMP, NO_DEST_PORT, libalias::packetAliasMode, and PKT_ALIAS_DENY_INCOMING.

Referenced by IcmpAliasIn1(), IcmpAliasIn2(), and LibAliasUnaliasOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindIcmpOut()

struct alias_link * FindIcmpOut ( struct libalias la,
struct in_addr  _src_addr,
struct in_addr  _dst_addr,
u_short  _id,
int  _create 
)

Definition at line 1015 of file alias_db.c.

References AddLink(), alias_link::dst_addr, FindAliasAddress(), FindLinkOut(), GET_ALIAS_ID, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_ICMP, NO_DEST_PORT, and alias_link::src_addr.

Referenced by IcmpAliasOut1(), and IcmpAliasOut2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindNewPortGroup()

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 
)

◆ FindOriginalAddress()

struct in_addr FindOriginalAddress ( struct libalias la,
struct in_addr  _alias_addr 
)

◆ FindPptpInByCallId()

struct alias_link * FindPptpInByCallId ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_int16_t  _dst_call_id 
)

Definition at line 1261 of file alias_db.c.

References alias_link::alias_addr, alias_link::dst_addr, alias_link::dst_port, alias_link::la, LIBALIAS_LOCK_ASSERT, alias_link::pptp, in_addr::s_addr, and UseLink().

Referenced by AliasHandlePptpIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindPptpInByPeerCallId()

struct alias_link * FindPptpInByPeerCallId ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_int16_t  _alias_call_id 
)

Definition at line 1279 of file alias_db.c.

References alias_link::alias_addr, alias_link::alias_port, alias_link::dst_addr, alias_link::la, LIBALIAS_LOCK_ASSERT, alias_link::pptp, and in_addr::s_addr.

Referenced by AliasHandlePptpGreIn(), and AliasHandlePptpIn().

Here is the caller graph for this function:

◆ FindPptpOutByCallId()

struct alias_link * FindPptpOutByCallId ( struct libalias la,
struct in_addr  _src_addr,
struct in_addr  _dst_addr,
u_int16_t  _src_call_id 
)

Definition at line 1227 of file alias_db.c.

References alias_link::dst_addr, alias_link::la, LIBALIAS_LOCK_ASSERT, alias_link::pptp, in_addr::s_addr, alias_link::src_addr, alias_link::src_port, and UseLink().

Referenced by AliasHandlePptpOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindPptpOutByPeerCallId()

struct alias_link * FindPptpOutByPeerCallId ( struct libalias la,
struct in_addr  _src_addr,
struct in_addr  _dst_addr,
u_int16_t  _dst_call_id 
)

Definition at line 1244 of file alias_db.c.

References alias_link::dst_addr, alias_link::dst_port, alias_link::la, LIBALIAS_LOCK_ASSERT, alias_link::pptp, in_addr::s_addr, alias_link::src_addr, and UseLink().

Referenced by AliasHandlePptpGreOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindProtoIn()

struct alias_link * FindProtoIn ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_char  _proto 
)

Definition at line 1089 of file alias_db.c.

References AddLink(), alias_link::alias_addr, alias_link::dst_addr, FindLinkIn(), FindOriginalAddress(), alias_link::la, LIBALIAS_LOCK_ASSERT, NO_DEST_PORT, NO_SRC_PORT, libalias::packetAliasMode, and PKT_ALIAS_DENY_INCOMING.

Referenced by ProtoAliasIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindProtoOut()

struct alias_link * FindProtoOut ( struct libalias la,
struct in_addr  _src_addr,
struct in_addr  _dst_addr,
u_char  _proto 
)

Definition at line 1112 of file alias_db.c.

References AddLink(), alias_link::dst_addr, FindAliasAddress(), FindLinkOut(), alias_link::la, LIBALIAS_LOCK_ASSERT, NO_DEST_PORT, NO_SRC_PORT, and alias_link::src_addr.

Referenced by ProtoAliasOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindRtspOut()

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 
)

Definition at line 1296 of file alias_db.c.

References AddLink(), alias_link::dst_addr, FindAliasAddress(), FindLinkOut(), IPPROTO_TCP, IPPROTO_UDP, alias_link::la, LIBALIAS_LOCK_ASSERT, LINK_TCP, alias_link::link_type, LINK_UDP, alias_link::src_addr, and alias_link::src_port.

Referenced by alias_rtsp_out(), and protohandler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindSctpRedirectAddress()

struct in_addr FindSctpRedirectAddress ( struct libalias la,
struct sctp_nat_msg sm 
)

Definition at line 2459 of file alias_db.c.

References FindLinkIn(), FindOriginalAddress(), LIBALIAS_LOCK_ASSERT, LINK_SCTP, NO_DEST_PORT, in_addr::s_addr, and alias_link::src_addr.

Here is the call graph for this function:

◆ FindUdpTcpIn()

struct alias_link * FindUdpTcpIn ( struct libalias la,
struct in_addr  _dst_addr,
struct in_addr  _alias_addr,
u_short  _dst_port,
u_short  _alias_port,
u_char  _proto,
int  _create 
)

◆ FindUdpTcpOut()

struct alias_link * FindUdpTcpOut ( struct libalias la,
struct in_addr  _src_addr,
struct in_addr  _dst_addr,
u_short  _src_port,
u_short  _dst_port,
u_char  _proto,
int  _create 
)

◆ GetAckModified()

int GetAckModified ( struct alias_link _lnk)

Definition at line 1576 of file alias_db.c.

References tcp_state::ack_modified, alias_link::data, tcp_dat::state, and alias_link::tcp.

Referenced by ProxyEncodeTcpStream(), TcpAliasIn(), and TcpAliasOut().

Here is the caller graph for this function:

◆ GetAliasAddress()

◆ GetAliasPort()

u_short GetAliasPort ( struct alias_link _lnk)

◆ GetDefaultAliasAddress()

struct in_addr GetDefaultAliasAddress ( struct libalias la)

Definition at line 1509 of file alias_db.c.

References LIBALIAS_LOCK_ASSERT.

Referenced by LibAliasOutLocked().

Here is the caller graph for this function:

◆ GetDeltaAckIn()

int GetDeltaAckIn ( u_long  ack,
struct alias_link _lnk 
)

Definition at line 1588 of file alias_db.c.

References tcp_dat::ack, ack_data_record::ack_new, ack_data_record::active, alias_link::data, ack_data_record::delta, tcp_state::index, N_LINK_TCP_DATA, SeqDiff(), tcp_dat::state, and alias_link::tcp.

Referenced by TcpAliasIn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDeltaSeqOut()

int GetDeltaSeqOut ( u_long  seq,
struct alias_link lnk 
)

Definition at line 1630 of file alias_db.c.

References tcp_dat::ack, ack_data_record::ack_old, ack_data_record::active, alias_link::data, ack_data_record::delta, tcp_state::index, N_LINK_TCP_DATA, SeqDiff(), tcp_dat::state, and alias_link::tcp.

Referenced by alias_rtsp_out(), AliasHandleIrcOut(), NewFtpMessage(), ProxyEncodeTcpStream(), and TcpAliasOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDestAddress()

struct in_addr GetDestAddress ( struct alias_link _lnk)

Definition at line 1494 of file alias_db.c.

Referenced by alias_pna_out(), AliasHandlePptpIn(), AliasHandlePptpOut(), NewFtpMessage(), and PunchFWHole().

Here is the caller graph for this function:

◆ GetFragmentAddr()

void GetFragmentAddr ( struct alias_link _lnk,
struct in_addr _src_addr 
)

Definition at line 1403 of file alias_db.c.

References alias_link::data, alias_link::frag_addr, and alias_link::src_addr.

Referenced by FragmentIn().

Here is the caller graph for this function:

◆ GetFragmentPtr()

void GetFragmentPtr ( struct alias_link _lnk,
void **  _fptr 
)

Definition at line 1415 of file alias_db.c.

References alias_link::data, and alias_link::frag_ptr.

Referenced by LibAliasGetFragment().

Here is the caller graph for this function:

◆ GetOriginalAddress()

struct in_addr GetOriginalAddress ( struct alias_link _lnk)

◆ GetOriginalPort()

u_short GetOriginalPort ( struct alias_link _lnk)

Definition at line 1523 of file alias_db.c.

References alias_link::src_port.

Referenced by AliasHandlePptpGreIn(), AliasHandlePptpIn(), IcmpAliasIn1(), IcmpAliasIn2(), LibAliasUnaliasOut(), PunchFWHole(), TcpAliasIn(), and UdpAliasIn().

Here is the caller graph for this function:

◆ GetProtocolFlags()

int GetProtocolFlags ( struct alias_link _lnk)

Definition at line 1723 of file alias_db.c.

References alias_link::pflags.

Referenced by AliasHandleFtpIn(), and AliasHandleFtpOut().

Here is the caller graph for this function:

◆ GetProxyAddress()

struct in_addr GetProxyAddress ( struct alias_link _lnk)

Definition at line 1551 of file alias_db.c.

Referenced by ProxyEncodeTcpStream(), TcpAliasIn(), and UdpAliasIn().

Here is the caller graph for this function:

◆ GetProxyPort()

u_short GetProxyPort ( struct alias_link _lnk)

Definition at line 1563 of file alias_db.c.

References alias_link::proxy_port.

Referenced by ProxyEncodeTcpStream(), TcpAliasIn(), and UdpAliasIn().

Here is the caller graph for this function:

◆ GetStateIn()

int GetStateIn ( struct alias_link _lnk)

Definition at line 1471 of file alias_db.c.

References alias_link::data, tcp_state::in, tcp_dat::state, and alias_link::tcp.

Referenced by TcpMonitorIn().

Here is the caller graph for this function:

◆ GetStateOut()

int GetStateOut ( struct alias_link _lnk)

Definition at line 1478 of file alias_db.c.

References alias_link::data, tcp_state::out, tcp_dat::state, and alias_link::tcp.

Referenced by TcpMonitorOut().

Here is the caller graph for this function:

◆ HouseKeeping()

void HouseKeeping ( struct libalias la)

Definition at line 1753 of file alias_db.c.

References CleanupLink(), alias_link::la, LIBALIAS_LOCK_ASSERT, LibAliasTime, libalias::tcpLinkCount, and libalias::udpLinkCount.

Referenced by LibAliasInLocked(), and LibAliasOutLocked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProxyCheck()

int ProxyCheck ( struct libalias la,
struct in_addr proxy_server_addr,
u_short *  proxy_server_port,
struct in_addr  src_addr,
struct in_addr  dst_addr,
u_short  dst_port,
u_char  ip_p 
)

◆ ProxyModify()

void ProxyModify ( struct libalias la,
struct alias_link _lnk,
struct ip _pip,
int  _maxpacketsize,
int  _proxy_type 
)

Definition at line 494 of file alias_proxy.c.

References LIBALIAS_LOCK_ASSERT, PROXY_TYPE_ENCODE_IPHDR, PROXY_TYPE_ENCODE_TCPSTREAM, ProxyEncodeIpHeader(), and ProxyEncodeTcpStream().

Referenced by TcpAliasOut(), and UdpAliasOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PunchFWHole()

◆ SctpAlias()

int SctpAlias ( struct libalias la,
struct ip pip,
int  direction 
)

Handles SCTP packets passed from libalias.

This function needs to actually NAT/drop packets and possibly create and send AbortM or ErrorM packets in response. The process involves:

  • Validating the direction parameter passed by the caller
  • Checking and handling any expired timers for the NAT
  • Calling sctp_PktParser() to parse the packet
  • Call ProcessSctpMsg() to decide the appropriate outcome and to update the NAT tables
  • Based on the return code either:
    • NAT the packet
    • Construct and send an ErrorM|AbortM packet
    • Mark the association for removal from the tables
  • Potentially remove the association from all lookup tables
  • Return the appropriate result to libalias
Parameters
laPointer to the relevant libalias instance
pipPointer to IP packet to process
directionSN_TO_LOCAL | SN_TO_GLOBAL
Returns
PKT_ALIAS_OK | PKT_ALIAS_IGNORE | PKT_ALIAS_ERROR

Definition at line 741 of file alias_sctp.c.

Referenced by LibAliasInLocked(), and LibAliasOutLocked().

Here is the caller graph for this function:

◆ SetAckModified()

void SetAckModified ( struct alias_link _lnk)

Definition at line 1545 of file alias_db.c.

References tcp_state::ack_modified, alias_link::data, tcp_dat::state, and alias_link::tcp.

Referenced by alias_rtsp_out(), AliasHandleIrcOut(), NewFtpMessage(), and ProxyEncodeTcpStream().

Here is the caller graph for this function:

◆ SetDefaultAliasAddress()

void SetDefaultAliasAddress ( struct libalias la,
struct in_addr  _alias_addr 
)

Definition at line 1516 of file alias_db.c.

References libalias::aliasAddress, and LIBALIAS_LOCK_ASSERT.

Referenced by LibAliasOutLocked().

Here is the caller graph for this function:

◆ SetDestCallId()

void SetDestCallId ( struct alias_link _lnk,
u_int16_t  _cid 
)

Definition at line 1729 of file alias_db.c.

References alias_link::alias_addr, alias_link::alias_port, alias_link::dst_addr, alias_link::la, LIBALIAS_LOCK_ASSERT, alias_link::link_type, ReLink(), alias_link::src_addr, and alias_link::src_port.

Referenced by AliasHandlePptpIn(), and AliasHandlePptpOut().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetExpire()

void SetExpire ( struct alias_link _lnk,
int  _expire 
)

Definition at line 1699 of file alias_db.c.

References DeleteLink(), expire, alias_link::expire, alias_link::flags, LINK_PERMANENT, and alias_link::time.

Referenced by AliasHandlePptpIn(), AliasHandlePptpOut(), and LibAliasGetFragment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFragmentAddr()

void SetFragmentAddr ( struct alias_link _lnk,
struct in_addr  _src_addr 
)

Definition at line 1397 of file alias_db.c.

References alias_link::data, alias_link::frag_addr, and alias_link::src_addr.

Referenced by LibAliasInLocked().

Here is the caller graph for this function:

◆ SetFragmentPtr()

void SetFragmentPtr ( struct alias_link _lnk,
void *  fptr 
)

Definition at line 1409 of file alias_db.c.

References alias_link::data, and alias_link::frag_ptr.

Referenced by LibAliasGetFragment(), and LibAliasSaveFragment().

Here is the caller graph for this function:

◆ SetProtocolFlags()

void SetProtocolFlags ( struct alias_link _lnk,
int  _pflags 
)

Definition at line 1717 of file alias_db.c.

References alias_link::pflags.

Referenced by AliasHandleFtpIn(), and AliasHandleFtpOut().

Here is the caller graph for this function:

◆ SetProxyAddress()

void SetProxyAddress ( struct alias_link _lnk,
struct in_addr  _addr 
)

Definition at line 1557 of file alias_db.c.

References alias_link::proxy_addr.

Referenced by TcpAliasOut(), and UdpAliasOut().

Here is the caller graph for this function:

◆ SetProxyPort()

void SetProxyPort ( struct alias_link _lnk,
u_short  _port 
)

Definition at line 1569 of file alias_db.c.

References alias_link::proxy_port.

Referenced by TcpAliasOut(), and UdpAliasOut().

Here is the caller graph for this function:

◆ SetStateIn()

void SetStateIn ( struct alias_link _lnk,
int  _state 
)

◆ SetStateOut()

void SetStateOut ( struct alias_link _lnk,
int  _state 
)

Variable Documentation

◆ LibAliasTime

int LibAliasTime
extern