/*
*
* Copyright (c) 2000 Whistle Communications, Inc.
* All rights reserved.
*
* Subject to the following obligations and disclaimer of warranty, use and
* redistribution of this software, in source or object code forms, with or
* without modifications are expressly permitted by Whistle Communications;
* provided, however, that:
* 1. Any and all reproductions of the source or object code must include the
* copyright notice above and the following disclaimer of warranties; and
* 2. No rights are granted, in any manner or form, to use Whistle
* Communications, Inc. trademarks, including the mark "WHISTLE
* COMMUNICATIONS" on advertising, endorsements, or otherwise except as
* such appears in the above copyright notice or in the software.
*
* THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
* REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
* INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
* WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
* REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
* SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
* IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
* RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
* WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* Author: Erik Salander <erik@whistle.com>
*/
__FBSDID("$FreeBSD: src/sys/netinet/libalias/alias_pptp.c,v 1.15.8.1 2009/04/15 03:14:26 kensmith Exp $");
/* Includes */
#ifdef _KERNEL
#else
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#endif
#ifdef _KERNEL
#else
#include "alias.h"
#include "alias_local.h"
#include "alias_mod.h"
#endif
static void
static void
static int
static int
static int
{
return (-1);
return (0);
return (-1);
}
static int
{
return (0);
}
static int
{
return (0);
}
static int
{
return (0);
}
static int
{
return (0);
return (-1);
}
static int
{
return (0);
return (-1);
}
/* Kernel module definition. */
{
.pri = 200,
.fingerprint = &fingerprint,
},
{
.pri = 210,
.fingerprint = &fingerprint,
},
/*
* WATCH OUT!!! these 2 handlers NEED a priority of INT_MAX (highest possible)
* cause they will ALWAYS process packets, so they must be the last one
* in chain: look fingerprintgre() above.
*/
{
},
{
},
{ EOH }
};
static int
{
int error;
switch (type) {
case MOD_LOAD:
error = 0;
break;
case MOD_UNLOAD:
error = 0;
break;
default:
}
return (error);
}
#ifdef _KERNEL
static
#endif
};
#ifdef _KERNEL
#endif
/*
Alias_pptp.c performs special processing for PPTP sessions under TCP.
Specifically, watch PPTP control messages and alias the Call ID or the
Peer's Call ID in the appropriate messages. Note, PPTP requires
"de-aliasing" of incoming packets, this is different than any other
TCP applications that are currently (ie. FTP, IRC and RTSP) aliased.
For Call IDs encountered for the first time, a PPTP alias link is created.
The PPTP alias link uses the Call ID in place of the original port number.
An alias Call ID is created.
For this routine to work, the PPTP control messages must fit entirely
into a single TCP packet. This is typically the case, but is not
required by the spec.
Unlike some of the other TCP applications that are aliased (ie. FTP,
IRC and RTSP), the PPTP control messages that need to be aliased are
guaranteed to remain the same length. The aliased Call ID is a fixed
length field.
Reference: RFC 2637
Initial version: May, 2000 (eds)
*/
/*
* PPTP definitions
*/
* (optional). */
};
/* The PPTP protocol ID used in the GRE 'proto' field. */
enum {
};
/* Message structures */
struct pptpMsgHead {
};
struct pptpCodes {
};
struct pptpCallIds {
};
static void
struct alias_link *lnk)
{ /* The PPTP control link */
/* Verify valid PPTP control message */
return;
/* Modify certain PPTP messages */
switch (ctl_type) {
case PPTP_OutCallRequest:
case PPTP_OutCallReply:
case PPTP_InCallRequest:
case PPTP_InCallReply:
/*
* Establish PPTP link for address and Call ID found in
* control message.
*/
break;
case PPTP_CallClearRequest:
case PPTP_CallDiscNotify:
/*
* Find PPTP link for address and Call ID found in control
* message.
*/
break;
default:
return;
}
/* alias the Call Id */
/* Compute TCP checksum for revised packet */
switch (ctl_type) {
case PPTP_OutCallReply:
case PPTP_InCallReply:
* established, */
* ID. */
else
break;
case PPTP_CallDiscNotify: /* Connection closed. */
break;
}
}
}
static void
struct alias_link *lnk)
{ /* The PPTP control link */
/* Verify valid PPTP control message */
return;
/* Modify certain PPTP messages */
switch (ctl_type) {
case PPTP_InCallConn:
case PPTP_WanErrorNotify:
case PPTP_SetLinkInfo:
break;
case PPTP_OutCallReply:
case PPTP_InCallReply:
break;
case PPTP_CallDiscNotify: /* Connection closed. */
return;
default:
return;
}
/* Find PPTP link for address and Call ID found in PPTP Control Msg */
*pcall_id);
/* De-alias the Peer's Call Id. */
/* Compute TCP checksum for modified packet */
accumulate -= *pcall_id;
* established, */
else
}
}
}
static PptpCallId
/* Calculate some lengths */
/* Verify data length */
return (NULL);
/* Move up to PPTP message header */
/* Return the control message type */
/* Verify PPTP Control Message */
return (NULL);
/* Verify data length. */
sizeof(struct pptpCodes))))
return (NULL);
else
}
static int
{
/* Check GRE header bits. */
return (-1);
/* Change source IP address. */
}
return (0);
}
static int
{
/* Check GRE header bits. */
return (-1);
/* De-alias the Peer's Call Id. */
/* Restore original IP address. */
}
return (0);
}