FreeBSD kernel IPv4 code
alias_pptp.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/limits.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <netinet/tcp.h>
#include <netinet/libalias/alias.h>
#include <netinet/libalias/alias_local.h>
#include <netinet/libalias/alias_mod.h>
Include dependency graph for alias_pptp.c:

Go to the source code of this file.

Data Structures

struct  grehdr
 
struct  pptpMsgHead
 
struct  pptpCodes
 
struct  pptpCallIds
 

Macros

#define PPTP_CONTROL_PORT_NUMBER   1723
 
#define PPTP_GRE_PROTO   0x880b
 
#define PPTP_INIT_VALUE   ((0x2001 << 16) | PPTP_GRE_PROTO)
 
#define PPTP_INIT_MASK   0xef7fffff
 
#define PPTP_MAGIC   0x1a2b3c4d
 
#define PPTP_CTRL_MSG_TYPE   1
 

Typedefs

typedef struct grehdr GreHdr
 
typedef struct pptpMsgHeadPptpMsgHead
 
typedef struct pptpCodesPptpCode
 
typedef struct pptpCallIdsPptpCallId
 

Enumerations

enum  {
  PPTP_StartCtrlConnRequest = 1 , PPTP_StartCtrlConnReply = 2 , PPTP_StopCtrlConnRequest = 3 , PPTP_StopCtrlConnReply = 4 ,
  PPTP_EchoRequest = 5 , PPTP_EchoReply = 6 , PPTP_OutCallRequest = 7 , PPTP_OutCallReply = 8 ,
  PPTP_InCallRequest = 9 , PPTP_InCallReply = 10 , PPTP_InCallConn = 11 , PPTP_CallClearRequest = 12 ,
  PPTP_CallDiscNotify = 13 , PPTP_WanErrorNotify = 14 , PPTP_SetLinkInfo = 15
}
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void AliasHandlePptpOut (struct libalias *, struct ip *, struct alias_link *)
 
static void AliasHandlePptpIn (struct libalias *, struct ip *, struct alias_link *)
 
static int AliasHandlePptpGreOut (struct libalias *, struct ip *)
 
static int AliasHandlePptpGreIn (struct libalias *, struct ip *)
 
static int fingerprint (struct libalias *la, struct alias_data *ah)
 
static int fingerprintgre (struct libalias *la, struct alias_data *ah)
 
static int protohandlerin (struct libalias *la, struct ip *pip, struct alias_data *ah)
 
static int protohandlerout (struct libalias *la, struct ip *pip, struct alias_data *ah)
 
static int protohandlergrein (struct libalias *la, struct ip *pip, struct alias_data *ah)
 
static int protohandlergreout (struct libalias *la, struct ip *pip, struct alias_data *ah)
 
static int mod_handler (module_t mod, int type, void *data)
 
 DECLARE_MODULE (alias_pptp, alias_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND)
 
 MODULE_VERSION (alias_pptp, 1)
 
 MODULE_DEPEND (alias_pptp, libalias, 1, 1, 1)
 
static PptpCallId AliasVerifyPptp (struct ip *, u_int16_t *)
 

Variables

struct proto_handler handlers []
 
static moduledata_t alias_mod
 

Macro Definition Documentation

◆ PPTP_CONTROL_PORT_NUMBER

#define PPTP_CONTROL_PORT_NUMBER   1723

Definition at line 67 of file alias_pptp.c.

◆ PPTP_CTRL_MSG_TYPE

#define PPTP_CTRL_MSG_TYPE   1

Definition at line 247 of file alias_pptp.c.

◆ PPTP_GRE_PROTO

#define PPTP_GRE_PROTO   0x880b

Definition at line 240 of file alias_pptp.c.

◆ PPTP_INIT_MASK

#define PPTP_INIT_MASK   0xef7fffff

Definition at line 244 of file alias_pptp.c.

◆ PPTP_INIT_VALUE

#define PPTP_INIT_VALUE   ((0x2001 << 16) | PPTP_GRE_PROTO)

Definition at line 243 of file alias_pptp.c.

◆ PPTP_MAGIC

#define PPTP_MAGIC   0x1a2b3c4d

Definition at line 246 of file alias_pptp.c.

Typedef Documentation

◆ GreHdr

typedef struct grehdr GreHdr

Definition at line 237 of file alias_pptp.c.

◆ PptpCallId

typedef struct pptpCallIds* PptpCallId

Definition at line 287 of file alias_pptp.c.

◆ PptpCode

typedef struct pptpCodes* PptpCode

Definition at line 281 of file alias_pptp.c.

◆ PptpMsgHead

typedef struct pptpMsgHead* PptpMsgHead

Definition at line 275 of file alias_pptp.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PPTP_StartCtrlConnRequest 
PPTP_StartCtrlConnReply 
PPTP_StopCtrlConnRequest 
PPTP_StopCtrlConnReply 
PPTP_EchoRequest 
PPTP_EchoReply 
PPTP_OutCallRequest 
PPTP_OutCallReply 
PPTP_InCallRequest 
PPTP_InCallReply 
PPTP_InCallConn 
PPTP_CallClearRequest 
PPTP_CallDiscNotify 
PPTP_WanErrorNotify 
PPTP_SetLinkInfo 

Definition at line 249 of file alias_pptp.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ AliasHandlePptpGreIn()

static int AliasHandlePptpGreIn ( struct libalias la,
struct ip pip 
)
static

Definition at line 492 of file alias_pptp.c.

References DifferentialChecksum(), FindPptpInByPeerCallId(), GetOriginalAddress(), GetOriginalPort(), grehdr::gh_call_id, ip::ip_dst, ip::ip_sum, alias_link::la, PPTP_INIT_MASK, and PPTP_INIT_VALUE.

Referenced by protohandlergrein().

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

◆ AliasHandlePptpGreOut()

static int AliasHandlePptpGreOut ( struct libalias la,
struct ip pip 
)
static

Definition at line 468 of file alias_pptp.c.

References DifferentialChecksum(), FindPptpOutByPeerCallId(), GetAliasAddress(), grehdr::gh_call_id, ip::ip_dst, ip::ip_sum, alias_link::la, PPTP_INIT_MASK, and PPTP_INIT_VALUE.

Referenced by protohandlergreout().

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

◆ AliasHandlePptpIn()

static void AliasHandlePptpIn ( struct libalias la,
struct ip pip,
struct alias_link lnk 
)
static

◆ AliasHandlePptpOut()

static void AliasHandlePptpOut ( struct libalias la,
struct ip pip,
struct alias_link lnk 
)
static

◆ AliasVerifyPptp()

static PptpCallId AliasVerifyPptp ( struct ip pip,
u_int16_t *  ptype 
)
static

Definition at line 431 of file alias_pptp.c.

References ip::ip_hl, ip::ip_len, pptpMsgHead::magic, pptpMsgHead::msgType, PPTP_CTRL_MSG_TYPE, PPTP_InCallReply, PPTP_MAGIC, PPTP_OutCallReply, and pptpMsgHead::type.

Referenced by AliasHandlePptpIn(), and AliasHandlePptpOut().

Here is the caller graph for this function:

◆ DECLARE_MODULE()

DECLARE_MODULE ( alias_pptp  ,
alias_mod  ,
SI_SUB_DRIVERS  ,
SI_ORDER_SECOND   
)

◆ fingerprint()

static int fingerprint ( struct libalias la,
struct alias_data ah 
)
static

◆ fingerprintgre()

static int fingerprintgre ( struct libalias la,
struct alias_data ah 
)
static

Definition at line 93 of file alias_pptp.c.

◆ mod_handler()

static int mod_handler ( module_t  mod,
int  type,
void *  data 
)
static

Definition at line 167 of file alias_pptp.c.

References handlers, LibAliasAttachHandlers(), and LibAliasDetachHandlers().

Here is the call graph for this function:

◆ MODULE_DEPEND()

MODULE_DEPEND ( alias_pptp  ,
libalias  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( alias_pptp  ,
 
)

◆ protohandlergrein()

static int protohandlergrein ( struct libalias la,
struct ip pip,
struct alias_data ah 
)
static

Definition at line 113 of file alias_pptp.c.

References AliasHandlePptpGreIn(), libalias::packetAliasMode, and PKT_ALIAS_PROXY_ONLY.

Here is the call graph for this function:

◆ protohandlergreout()

static int protohandlergreout ( struct libalias la,
struct ip pip,
struct alias_data ah 
)
static

Definition at line 122 of file alias_pptp.c.

References AliasHandlePptpGreOut().

Here is the call graph for this function:

◆ protohandlerin()

static int protohandlerin ( struct libalias la,
struct ip pip,
struct alias_data ah 
)
static

Definition at line 99 of file alias_pptp.c.

References AliasHandlePptpIn(), and alias_data::lnk.

Here is the call graph for this function:

◆ protohandlerout()

static int protohandlerout ( struct libalias la,
struct ip pip,
struct alias_data ah 
)
static

Definition at line 106 of file alias_pptp.c.

References AliasHandlePptpOut(), and alias_data::lnk.

Here is the call graph for this function:

Variable Documentation

◆ alias_mod

moduledata_t alias_mod
static
Initial value:
= {
"alias_pptp", mod_handler, NULL
}
static int mod_handler(module_t mod, int type, void *data)
Definition: alias_pptp.c:167

Definition at line 189 of file alias_pptp.c.

◆ handlers

struct proto_handler handlers[]

Definition at line 130 of file alias_pptp.c.

Referenced by mod_handler().