summaryrefslogtreecommitdiff
Diffstat
-rwxr-xr-xAndroid.mk39
-rw-r--r--README90
-rwxr-xr-xSERVPOET18
-rwxr-xr-xconfigs/firewall-masq71
-rwxr-xr-xconfigs/firewall-standalone34
-rwxr-xr-xconfigs/pap-secrets10
-rwxr-xr-xconfigs/pppoe-server-options6
-rwxr-xr-xconfigs/pppoe.conf140
-rwxr-xr-xdoc/CHANGES339
-rwxr-xr-xdoc/HOW-TO-CONNECT268
-rwxr-xr-xdoc/KERNEL-MODE-PPPOE98
-rwxr-xr-xdoc/LICENSE341
-rwxr-xr-xdoc/PROBLEMS5
-rwxr-xr-xman/pppoe-connect.866
-rwxr-xr-xman/pppoe-relay.8124
-rwxr-xr-xman/pppoe-server.8184
-rwxr-xr-xman/pppoe-setup.823
-rwxr-xr-xman/pppoe-sniff.877
-rwxr-xr-xman/pppoe-start.827
-rwxr-xr-xman/pppoe-status.825
-rwxr-xr-xman/pppoe-stop.821
-rwxr-xr-xman/pppoe.8236
-rwxr-xr-xman/pppoe.conf.5167
-rw-r--r--pstart3
-rw-r--r--pstop21
-rwxr-xr-xscripts/pppoe-connect319
-rwxr-xr-xscripts/pppoe-connect.in319
-rwxr-xr-xscripts/pppoe-init66
-rwxr-xr-xscripts/pppoe-init-suse64
-rwxr-xr-xscripts/pppoe-init-suse.in64
-rwxr-xr-xscripts/pppoe-init-turbolinux64
-rwxr-xr-xscripts/pppoe-init-turbolinux.in64
-rwxr-xr-xscripts/pppoe-init.in66
-rwxr-xr-xscripts/pppoe-setup352
-rwxr-xr-xscripts/pppoe-setup.in352
-rwxr-xr-xscripts/pppoe-start196
-rwxr-xr-xscripts/pppoe-start.in196
-rwxr-xr-xscripts/pppoe-status84
-rwxr-xr-xscripts/pppoe-stop96
-rwxr-xr-xscripts/pppoe-stop.in96
-rwxr-xr-xsrc/common.c651
-rwxr-xr-xsrc/config.h146
-rwxr-xr-xsrc/debug.c152
-rwxr-xr-xsrc/discovery.c736
-rwxr-xr-xsrc/if.c352
-rwxr-xr-xsrc/libevent/Makefile42
-rwxr-xr-xsrc/libevent/Makefile.in42
-rwxr-xr-xsrc/libevent/event.c645
-rwxr-xr-xsrc/libevent/event.h114
-rwxr-xr-xsrc/libevent/event_sig.c265
-rwxr-xr-xsrc/libevent/event_tcp.c577
-rwxr-xr-xsrc/libevent/event_tcp.h87
-rwxr-xr-xsrc/libevent/eventpriv.h46
-rwxr-xr-xsrc/libevent/hash.c266
-rwxr-xr-xsrc/libevent/hash.h54
-rwxr-xr-xsrc/md5.c249
-rwxr-xr-xsrc/md5.h34
-rwxr-xr-xsrc/plugin.c469
-rwxr-xr-xsrc/ppp.c262
-rwxr-xr-xsrc/pppoe-server.c2137
-rwxr-xr-xsrc/pppoe-server.h156
-rwxr-xr-xsrc/pppoe-sniff.c266
-rwxr-xr-xsrc/pppoe.c959
-rwxr-xr-xsrc/pppoe.h347
-rwxr-xr-xsrc/relay.c1559
-rwxr-xr-xsrc/relay.h99
66 files changed, 15542 insertions, 1 deletions
diff --git a/src/pppoe-server.h b/src/pppoe-server.h
new file mode 100755
index 0000000..ba4635f
--- a/dev/null
+++ b/src/pppoe-server.h
@@ -0,0 +1,156 @@
+/**********************************************************************
+*
+* pppoe-server.h
+*
+* Definitions for PPPoE server
+*
+* Copyright (C) 2001-2006 Roaring Penguin Software Inc.
+*
+* This program may be distributed according to the terms of the GNU
+* General Public License, version 2 or (at your option) any later version.
+*
+* LIC: GPL
+*
+* $Id$
+*
+***********************************************************************/
+
+#include "pppoe.h"
+#include "event.h"
+
+#ifdef HAVE_L2TP
+#include "l2tp/l2tp.h"
+#endif
+
+#define MAX_USERNAME_LEN 31
+/* An Ethernet interface */
+typedef struct {
+ char name[IFNAMSIZ+1]; /* Interface name */
+ int sock; /* Socket for discovery frames */
+ unsigned char mac[ETH_ALEN]; /* MAC address */
+ EventHandler *eh; /* Event handler for this interface */
+
+ /* Next fields are used only if we're an L2TP LAC */
+#ifdef HAVE_L2TP
+ int session_sock; /* Session socket */
+ EventHandler *lac_eh; /* LAC's event-handler */
+#endif
+} Interface;
+
+#define FLAG_RECVD_PADT 1
+#define FLAG_USER_SET 2
+#define FLAG_IP_SET 4
+#define FLAG_SENT_PADT 8
+
+/* Only used if we are an L2TP LAC or LNS */
+#define FLAG_ACT_AS_LAC 256
+#define FLAG_ACT_AS_LNS 512
+
+/* Forward declaration */
+struct ClientSessionStruct;
+
+/* Dispatch table for session-related functions. We call different
+ functions for L2TP-terminated sessions than for locally-terminated
+ sessions. */
+typedef struct PppoeSessionFunctionTable_t {
+ /* Stop the session */
+ void (*stop)(struct ClientSessionStruct *ses, char const *reason);
+
+ /* Return 1 if session is active, 0 otherwise */
+ int (*isActive)(struct ClientSessionStruct *ses);
+
+ /* Describe a session in human-readable form */
+ char const * (*describe)(struct ClientSessionStruct *ses);
+} PppoeSessionFunctionTable;
+
+extern PppoeSessionFunctionTable DefaultSessionFunctionTable;
+
+/* A client session */
+typedef struct ClientSessionStruct {
+ struct ClientSessionStruct *next; /* In list of free or active sessions */
+ PppoeSessionFunctionTable *funcs; /* Function table */
+ pid_t pid; /* PID of child handling session */
+ Interface *ethif; /* Ethernet interface */
+ unsigned char myip[IPV4ALEN]; /* Local IP address */
+ unsigned char peerip[IPV4ALEN]; /* Desired IP address of peer */
+ UINT16_t sess; /* Session number */
+ unsigned char eth[ETH_ALEN]; /* Peer's Ethernet address */
+ unsigned int flags; /* Various flags */
+ time_t startTime; /* When session started */
+ char const *serviceName; /* Service name */
+#ifdef HAVE_LICENSE
+ char user[MAX_USERNAME_LEN+1]; /* Authenticated user-name */
+ char realm[MAX_USERNAME_LEN+1]; /* Realm */
+ unsigned char realpeerip[IPV4ALEN]; /* Actual IP address -- may be assigned
+ by RADIUS server */
+ int maxSessionsPerUser; /* Max sessions for this user */
+#endif
+#ifdef HAVE_L2TP
+ l2tp_session *l2tp_ses; /* L2TP session */
+ struct sockaddr_in tunnel_endpoint; /* L2TP endpoint */
+#endif
+} ClientSession;
+
+/* Hack for daemonizing */
+#define CLOSEFD 64
+
+/* Max. number of interfaces to listen on */
+#define MAX_INTERFACES 64
+
+/* Max. 64 sessions by default */
+#define DEFAULT_MAX_SESSIONS 64
+
+/* An array of client sessions */
+extern ClientSession *Sessions;
+
+/* Interfaces we're listening on */
+extern Interface interfaces[MAX_INTERFACES];
+extern int NumInterfaces;
+
+/* The number of session slots */
+extern size_t NumSessionSlots;
+
+/* The number of active sessions */
+extern size_t NumActiveSessions;
+
+/* Offset of first session */
+extern size_t SessOffset;
+
+/* Access concentrator name */
+extern char *ACName;
+
+extern unsigned char LocalIP[IPV4ALEN];
+extern unsigned char RemoteIP[IPV4ALEN];
+
+/* Do not create new sessions if free RAM < 10MB (on Linux only!) */
+#define MIN_FREE_MEMORY 10000
+
+/* Do we increment local IP for each connection? */
+extern int IncrLocalIP;
+
+/* Free sessions */
+extern ClientSession *FreeSessions;
+
+/* When a session is freed, it is added to the end of the free list */
+extern ClientSession *LastFreeSession;
+
+/* Busy sessions */
+extern ClientSession *BusySessions;
+
+extern EventSelector *event_selector;
+extern int GotAlarm;
+
+extern void setAlarm(unsigned int secs);
+extern void killAllSessions(void);
+extern void serverProcessPacket(Interface *i);
+extern void processPADT(Interface *ethif, PPPoEPacket *packet, int len);
+extern void processPADR(Interface *ethif, PPPoEPacket *packet, int len);
+extern void processPADI(Interface *ethif, PPPoEPacket *packet, int len);
+extern void usage(char const *msg);
+extern ClientSession *pppoe_alloc_session(void);
+extern int pppoe_free_session(ClientSession *ses);
+extern void sendHURLorMOTM(PPPoEConnection *conn, char const *url, UINT16_t tag);
+
+#ifdef HAVE_LICENSE
+extern int getFreeMem(void);
+#endif