version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.3.2.1, 2023/09/27 11:08:01
|
Line 59
|
Line 59
|
#include <netgraph/ng_ppp.h> |
#include <netgraph/ng_ppp.h> |
|
|
#include "defs.h" |
#include "defs.h" |
|
#include "msg.h" |
|
|
/* |
/* |
* DEFINITIONS |
* DEFINITIONS |
Line 67
|
Line 68
|
/* Do our own version of assert() so it shows up in the logs */ |
/* Do our own version of assert() so it shows up in the logs */ |
#define assert(e) ((e) ? (void)0 : DoAssert(__FILE__, __LINE__, #e)) |
#define assert(e) ((e) ? (void)0 : DoAssert(__FILE__, __LINE__, #e)) |
|
|
|
#ifdef __clang__ |
|
#ifndef NO_THREAD_SAFETY_ANALYSIS |
|
#ifndef THREAD_ANNOTATION_ATTRIBUTE__ |
|
#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) |
|
#endif |
|
#define NO_THREAD_SAFETY_ANALYSIS \ |
|
THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) |
|
#endif |
|
#else |
|
#define NO_THREAD_SAFETY_ANALYSIS |
|
#endif /* __clang__ */ |
|
|
/* Giant Mutex handling */ |
/* Giant Mutex handling */ |
#define GIANT_MUTEX_LOCK() assert(pthread_mutex_lock(&gGiantMutex) == 0) |
#define GIANT_MUTEX_LOCK() assert(pthread_mutex_lock(&gGiantMutex) == 0) |
#define GIANT_MUTEX_UNLOCK() assert(pthread_mutex_unlock(&gGiantMutex) == 0) |
#define GIANT_MUTEX_UNLOCK() assert(pthread_mutex_unlock(&gGiantMutex) == 0) |
Line 77
|
Line 90
|
#define RWLOCK_RDLOCK(m) assert(pthread_rwlock_rdlock(&m) == 0) |
#define RWLOCK_RDLOCK(m) assert(pthread_rwlock_rdlock(&m) == 0) |
#define RWLOCK_WRLOCK(m) assert(pthread_rwlock_wrlock(&m) == 0) |
#define RWLOCK_WRLOCK(m) assert(pthread_rwlock_wrlock(&m) == 0) |
#define RWLOCK_UNLOCK(m) assert(pthread_rwlock_unlock(&m) == 0) |
#define RWLOCK_UNLOCK(m) assert(pthread_rwlock_unlock(&m) == 0) |
|
|
#define SETOVERLOAD(q) do { \ |
|
int t = (q); \ |
|
if (t > 60) { \ |
|
gOverload = 100; \ |
|
} else if (t > 10) { \ |
|
gOverload = (t - 10) * 2; \ |
|
} else { \ |
|
gOverload = 0; \ |
|
} \ |
|
} while (0) |
|
|
|
|
#define SETOVERLOAD(q) \ |
|
do { \ |
|
int t = (q); \ |
|
if (t > gQThresMax) { \ |
|
gOverload = 100; \ |
|
} else if (t > gQThresMin) { \ |
|
gOverload = (t - gQThresMin) * 100/gQThresDiff; \ |
|
} else { \ |
|
gOverload = 0; \ |
|
} \ |
|
} while (0) |
|
|
#define OVERLOAD() (gOverload > (random() % 100)) |
#define OVERLOAD() (gOverload > (random() % 100)) |
|
|
#define REF(p) do { \ |
#define REF(p) do { \ |
Line 189
|
Line 203
|
extern int gNumBundles; /* Total number of bundles */ |
extern int gNumBundles; /* Total number of bundles */ |
extern struct console gConsole; |
extern struct console gConsole; |
extern struct web gWeb; |
extern struct web gWeb; |
|
#ifdef USE_RADIUS |
extern struct radsrv gRadsrv; |
extern struct radsrv gRadsrv; |
|
#endif |
extern int gBackground; |
extern int gBackground; |
extern int gShutdownInProgress; |
extern int gShutdownInProgress; |
extern int gOverload; |
extern int gOverload; |
Line 198
|
Line 214
|
|
|
#ifdef PHYSTYPE_PPTP |
#ifdef PHYSTYPE_PPTP |
extern int gPPTPto; |
extern int gPPTPto; |
extern int gPPTPtunlimit; | extern unsigned gPPTPtunlimit; |
#endif |
#endif |
#ifdef PHYSTYPE_L2TP |
#ifdef PHYSTYPE_L2TP |
extern int gL2TPto; |
extern int gL2TPto; |
extern int gL2TPtunlimit; | extern unsigned gL2TPtunlimit; |
#endif |
#endif |
extern int gChildren; |
extern int gChildren; |
extern int gMaxChildren; |
extern int gMaxChildren; |
|
|
extern struct globalconf gGlobalConf; /* Global config settings */ |
extern struct globalconf gGlobalConf; /* Global config settings */ |
|
|
#ifdef USE_NG_BPF | #if defined(USE_NG_BPF) && !defined(RADSRV) |
extern struct acl *acl_filters[ACL_FILTERS]; /* mpd's internal bpf filters */ |
extern struct acl *acl_filters[ACL_FILTERS]; /* mpd's internal bpf filters */ |
|
#endif |
|
|
|
#ifdef USE_PAM |
|
extern char gPamService[32]; |
#endif |
#endif |
|
|
extern struct pevent_ctx *gPeventCtx; |
extern struct pevent_ctx *gPeventCtx; |