|
version 1.1.1.1, 2012/02/21 23:32:47
|
version 1.1.1.3, 2021/03/17 00:39:23
|
|
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 THREAD_ANNOTATION_ATTRIBUTE__ |
| |
#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) |
| |
#else |
| |
#define THREAD_ANNOTATION_ATTRIBUTE__(x) |
| |
#endif |
| |
|
| |
#ifndef NO_THREAD_SAFETY_ANALYSIS |
| |
#define NO_THREAD_SAFETY_ANALYSIS \ |
| |
THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) |
| |
#else |
| |
#define NO_THREAD_SAFETY_ANALYSIS |
| |
#endif |
| |
|
| |
#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 95
|
| #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 198
|
Line 217
|
| |
|
| #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; |