version 1.1.1.1, 2013/07/22 08:44:29
|
version 1.1.1.2, 2021/03/17 00:39:23
|
Line 28 struct ippool {
|
Line 28 struct ippool {
|
|
|
typedef struct ippool *IPPool; |
typedef struct ippool *IPPool; |
|
|
SLIST_HEAD(, ippool) gIPPools; | static SLIST_HEAD(, ippool) gIPPools; |
pthread_mutex_t gIPPoolMutex; | static pthread_mutex_t gIPPoolMutex; |
|
|
static void IPPoolAdd(char *pool, struct in_addr begin, struct in_addr end); | static void IPPoolAdd(const char *pool, struct in_addr begin, struct in_addr end); |
static int IPPoolSetCommand(Context ctx, int ac, char *av[], void *arg); | static int IPPoolSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
|
|
const struct cmdtab IPPoolSetCmds[] = { |
const struct cmdtab IPPoolSetCmds[] = { |
{ "add {pool} {start} {end}", "Add IP range to the pool", |
{ "add {pool} {start} {end}", "Add IP range to the pool", |
IPPoolSetCommand, NULL, 2, (void *) SET_ADD }, |
IPPoolSetCommand, NULL, 2, (void *) SET_ADD }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
void |
void |
Line 105 void IPPoolFree(char *pool, struct u_addr *ip) {
|
Line 105 void IPPoolFree(char *pool, struct u_addr *ip) {
|
} |
} |
|
|
static void |
static void |
IPPoolAdd(char *pool, struct in_addr begin, struct in_addr end) | IPPoolAdd(const char *pool, struct in_addr begin, struct in_addr end) |
{ |
{ |
|
|
IPPool p; |
IPPool p; |
struct ippool_rec *r; |
struct ippool_rec *r; |
int i, j, k; |
int i, j, k; |
int total; |
int total; |
u_int c = ntohl(end.s_addr) - ntohl(begin.s_addr) + 1; | int c = ntohl(end.s_addr) - ntohl(begin.s_addr) + 1; |
|
|
if (c > 65536) { |
if (c > 65536) { |
Log(LG_ERR, ("Too big IP range: %d", c)); |
Log(LG_ERR, ("Too big IP range: %d", c)); |
Line 162 IPPoolAdd(char *pool, struct in_addr begin, struct in_
|
Line 162 IPPoolAdd(char *pool, struct in_addr begin, struct in_
|
*/ |
*/ |
|
|
int |
int |
IPPoolStat(Context ctx, int ac, char *av[], void *arg) | IPPoolStat(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
IPPool p; |
IPPool p; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("Available IP pools:\r\n"); |
Printf("Available IP pools:\r\n"); |
MUTEX_LOCK(gIPPoolMutex); |
MUTEX_LOCK(gIPPoolMutex); |
SLIST_FOREACH(p, &gIPPools, next) { |
SLIST_FOREACH(p, &gIPPools, next) { |
Line 190 IPPoolStat(Context ctx, int ac, char *av[], void *arg)
|
Line 194 IPPoolStat(Context ctx, int ac, char *av[], void *arg)
|
*/ |
*/ |
|
|
static int |
static int |
IPPoolSetCommand(Context ctx, int ac, char *av[], void *arg) | IPPoolSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
|
(void)ctx; |
switch ((intptr_t)arg) { |
switch ((intptr_t)arg) { |
case SET_ADD: |
case SET_ADD: |
{ |
{ |