in the normal away against the appropriate options and secrets files.
+void (*snoop_recv_hook)(unsigned char *p, int len)
+void (*snoop_send_hook)(unsigned char *p, int len)
+
+These hooks are called whenever pppd receives or sends a packet. The
+packet is in p; its length is len. This allows plugins to "snoop in"
+on the pppd conversation. The hooks may prove useful in implmenting
+L2TP.
A plugin registers itself with a notifier by declaring a procedure of
the form:
-## $Id: PLUGINS,v 1.4 2002/01/22 16:02:55 dfs Exp $ ##
+## $Id: PLUGINS,v 1.5 2002/02/12 20:07:09 dfs Exp $ ##
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define RCSID "$Id: main.c,v 1.111 2002/01/22 16:02:58 dfs Exp $"
+#define RCSID "$Id: main.c,v 1.112 2002/02/12 20:07:09 dfs Exp $"
#include <stdio.h>
#include <ctype.h>
int (*holdoff_hook) __P((void)) = NULL;
int (*new_phase_hook) __P((int)) = NULL;
+void (*snoop_recv_hook) __P((unsigned char *p, int len)) = NULL;
+void (*snoop_send_hook) __P((unsigned char *p, int len)) = NULL;
static int conn_running; /* we have a [dis]connector running */
static int devfd; /* fd of underlying device */
}
dump_packet("rcvd", p, len);
+ if (snoop_recv_hook) snoop_recv_hook(p, len);
p += 2; /* Skip address and control */
GETSHORT(protocol, p);
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pppd.h,v 1.64 2002/01/22 16:02:58 dfs Exp $
+ * $Id: pppd.h,v 1.65 2002/02/12 20:07:09 dfs Exp $
*/
/*
extern int (*chap_check_hook) __P((void));
extern int (*chap_passwd_hook) __P((char *user, char *passwd));
+/* Let a plugin snoop sent and received packets. Useful for L2TP */
+extern void (*snoop_recv_hook) __P((unsigned char *p, int len));
+extern void (*snoop_send_hook) __P((unsigned char *p, int len));
+
/*
* Inline versions of get/put char/short/long.
* Pointer is advanced; we assume that both arguments
#ifdef INET6
static int sock6_fd = -1;
#endif /* INET6 */
-static int ppp_dev_fd = -1; /* fd for /dev/ppp (new style driver) */
+int ppp_dev_fd = -1; /* fd for /dev/ppp (new style driver) */
static int chindex; /* channel index (new style driver) */
static fd_set in_fds; /* set of fds that wait_input waits for */
int proto;
dump_packet("sent", p, len);
+ if (snoop_send_hook) snoop_send_hook(p, len);
if (len < PPP_HDRLEN)
return;
SET_SA_FAMILY (rt.rt_dst, AF_INET);
SET_SA_FAMILY (rt.rt_gateway, AF_INET);
+ rt.rt_dev = ifname;
+
if (kernel_version > KVERSION(2,1,0)) {
SET_SA_FAMILY (rt.rt_genmask, AF_INET);
SIN_ADDR(rt.rt_genmask) = 0L;
* OR MODIFICATIONS.
*/
-#define RCSID "$Id: sys-solaris.c,v 1.6 2001/05/23 03:39:13 paulus Exp $"
+#define RCSID "$Id: sys-solaris.c,v 1.7 2002/02/12 20:07:09 dfs Exp $"
#include <limits.h>
#include <stdio.h>
struct pollfd pfd;
dump_packet("sent", p, len);
+ if (snoop_send_hook) snoop_send_hook(p, len);
data.len = len;
data.buf = (caddr_t) p;
* OR MODIFICATIONS.
*/
-#define RCSID "$Id: sys-sunos4.c,v 1.28 2001/05/23 03:39:13 paulus Exp $"
+#define RCSID "$Id: sys-sunos4.c,v 1.29 2002/02/12 20:07:09 dfs Exp $"
#include <stdio.h>
#include <stddef.h>
struct pollfd pfd;
dump_packet("sent", p, len);
+ if (snoop_send_hook) snoop_send_hook(p, len);
data.len = len;
data.buf = (caddr_t) p;
* OR MODIFICATIONS.
*/
-#define RCSID "$Id: sys-svr4.c,v 1.43 2001/05/23 03:39:14 paulus Exp $"
+#define RCSID "$Id: sys-svr4.c,v 1.44 2002/02/12 20:07:10 dfs Exp $"
#include <limits.h>
#include <stdio.h>
struct pollfd pfd;
dump_packet("sent", p, len);
+ if (snoop_send_hook) snoop_send_hook(p, len);
data.len = len;
data.buf = (caddr_t) p;