/*
* Copyright (C) 2002-2003 by Darren Reed
*
* Simple PPTP transparent proxy for in-kernel use. For use with the NAT
* code.
*
* $Id: ip_pptp_pxy.c,v 2.10.2.10 2005/07/15 21:56:52 darrenr Exp $
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#define IPF_PPTP_PROXY
typedef struct ifs_pptppxy {
int pptp_proxy_init;
typedef struct pptp_hdr {
} pptp_hdr_t;
/*
* PPTP application proxy initialization.
*/
/*ARGSUSED*/
void **private;
{
return -1;
return 0;
}
/*ARGSUSED*/
void **private;
{
ifspptp->pptp_proxy_init = 0;
}
}
/*
* Setup for a new PPTP proxy.
*/
/*ARGSUSED*/
void *private;
{
if (ippr_pptp_debug > 0)
printf("ippr_pptp_new: GRE session already exists\n");
return -1;
}
if (ippr_pptp_debug > 0)
printf("ippr_pptp_new: malloc for aps_data failed\n");
return -1;
}
/*
* created. This is required because the current NAT rule does not
* describe GRE but TCP instead.
*/
}
sizeof(ipn->in_ifnames[0]));
return 0;
}
{
u_char p;
} else {
}
}
}
/*
*/
else {
}
}
} else {
else
0);
}
return;
}
/*
* Try and build up the next PPTP message in the TCP stream and if we can
* build it up completely (fits in our buffer) then pass it off to the message
* parsing function.
*/
int rev;
{
char *msg;
if (dlen <= 0)
return 0;
/*
* If the complete data packet is before what we expect to see
* "next", just ignore it as the chances are we've already seen it.
* The next if statement following this one really just causes packets
* ahead of what we've seen to be dropped, implying that something in
* the middle went missing and we want to see that first.
*/
return 0;
if (ippr_pptp_debug > 5)
return -1;
}
while (dlen > 0) {
if (pptps->pptps_gothdr == 0) {
/*
* PPTP has an 8 byte header that inclues the cookie.
* The start of every message should include one and
* it should match 1a2b3c4d. Byte order is ignored,
* deliberately, when printing out the error.
*/
if (ippr_pptp_debug > 1)
printf("%s: bad cookie (%x)\n",
hdr->pptph_cookie);
return -1;
}
}
/*
* If a message is too big for the buffer, just set
* the fields for the next message to come along.
* The messages defined in RFC 2637 will not exceed
* 512 bytes (in total length) so this is likely a
* bad data packet, anyway.
*/
if (ippr_pptp_debug > 3)
printf("%s: message too big (%d)\n",
pptps->pptps_gothdr = 0;
pptps->pptps_bytes = 0;
break;
}
}
break;
pptps->pptps_gothdr = 0;
pptps->pptps_bytes = 0;
}
return 0;
}
/*
* handle a complete PPTP message
*/
{
{
case PPTP_MSGTYPE_CTL :
break;
default :
break;
}
return 0;
}
/*
* handle a complete PPTP control message
*/
{
else
/*
* Breakout to handle all the various messages. Most are just state
* transition.
*/
{
case PPTP_MTCTL_STARTREQ :
break;
case PPTP_MTCTL_STARTREP :
break;
case PPTP_MTCTL_STOPREQ :
break;
case PPTP_MTCTL_STOPREP :
break;
case PPTP_MTCTL_ECHOREQ :
break;
case PPTP_MTCTL_ECHOREP :
break;
case PPTP_MTCTL_OUTREQ :
break;
case PPTP_MTCTL_OUTREP :
}
break;
case PPTP_MTCTL_INREQ :
break;
case PPTP_MTCTL_INREP :
}
break;
case PPTP_MTCTL_INCONNECT :
break;
case PPTP_MTCTL_CLEAR :
break;
case PPTP_MTCTL_DISCONNECT :
break;
case PPTP_MTCTL_WANERROR :
break;
case PPTP_MTCTL_LINKINFO :
break;
}
return 0;
}
/*
* For outgoing PPTP packets. refresh timeouts for NAT & state entries, if
* we can. If they have disappeared, recreate them.
*/
void *private;
{
int rev;
rev = 1;
rev = 1;
else
rev = 0;
}
}
/*
* clean up after ourselves.
*/
/*ARGSUSED*/
void *private;
{
/*
* Don't bother changing any of the NAT structure details,
* *_del() is on a callback from aps_free(), from nat_delete()
*/
}
}
}