if (*data->value) data->s->snoop_ip = inet_addr(data->value);
if (data->s->snoop_ip == INADDR_NONE) data->s->snoop_ip = 0;
if (*x) data->s->snoop_port = atoi(x);
- p->log(3, 0, 0, 0, " Intercepting user to %s:%d\n",
+ p->_log(3, 0, 0, 0, " Intercepting user to %s:%d\n",
p->inet_toa(data->s->snoop_ip), data->s->snoop_port);
}
else
{
- p->log(3, 0, 0, 0, " Not Intercepting user (reply string should be snoop=ip:port)\n");
+ p->_log(3, 0, 0, 0, " Not Intercepting user (reply string should be snoop=ip:port)\n");
}
}
return PLUGIN_RET_OK;
case 2: // output
data->s->throttle_out = rate;
free(pt);
- p->log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Set output throttle rate %dkb/s\n", rate);
+ p->_log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Set output throttle rate %dkb/s\n", rate);
return PLUGIN_RET_OK;
case 3: //input
data->s->throttle_in = rate;
free(pt);
- p->log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Set input throttle rate %dkb/s\n", rate);
+ p->_log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Set input throttle rate %dkb/s\n", rate);
return PLUGIN_RET_OK;
default:
- p->log(1, 0, p->get_id_by_session(data->s), data->s->tunnel, "Syntax error in rate limit AV pair: %s=%s\n", data->key, data->value);
+ p->_log(1, 0, p->get_id_by_session(data->s), data->s->tunnel, "Syntax error in rate limit AV pair: %s=%s\n", data->key, data->value);
free(pt);
return PLUGIN_RET_OK;
}
else
{
free(pt);
- p->log(1, 0, p->get_id_by_session(data->s), data->s->tunnel, "Syntax error in rate limit AV pair: %s=%s\n",
+ p->_log(1, 0, p->get_id_by_session(data->s), data->s->tunnel, "Syntax error in rate limit AV pair: %s=%s\n",
data->key, data->value);
return PLUGIN_RET_OK;
}
{
if (strcmp(data->value, "yes") == 0)
{
- p->log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Throttling user\n");
+ p->_log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Throttling user\n");
data->s->throttle_in = data->s->throttle_out = config->rl_rate;
}
else if (strcmp(data->value, "no") == 0)
{
- p->log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Not throttling user\n");
+ p->_log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Not throttling user\n");
data->s->throttle_in = data->s->throttle_out = 0;
}
}
- p->log(4, 0, p->get_id_by_session(data->s), data->s->tunnel, "autothrottle module ignoring AV pair %s=%s\n",
+ p->_log(4, 0, p->get_id_by_session(data->s), data->s->tunnel, "autothrottle module ignoring AV pair %s=%s\n",
data->key, data->value);
return PLUGIN_RET_OK;
#include "plugin.h"
#include "control.h"
-char const *cvs_id = "$Id: garden.c,v 1.8 2004-10-30 07:35:31 bodea Exp $";
+char const *cvs_id = "$Id: garden.c,v 1.9 2004-11-03 13:23:58 bodea Exp $";
int __plugin_api_version = 1;
static struct pluginfuncs *p = 0;
// Ignore if user authentication was successful
if (data->auth_allowed) return PLUGIN_RET_OK;
- p->log(3, 0, 0, 0, "Walled Garden allowing login\n");
+ p->_log(3, 0, 0, 0, "Walled Garden allowing login\n");
data->auth_allowed = 1;
data->s->walled_garden = 1;
return PLUGIN_RET_OK;
sprintf((data->response + data->response_length), "%s", errormsg);
data->response_length += strlen(errormsg) + 1;
- p->log(3, 0, 0, 0, "Unknown session %d\n", session);
+ p->_log(3, 0, 0, 0, "Unknown session %d\n", session);
return PLUGIN_RET_STOP;
}
*(short *)(data->response + 2) = ntohs(PKT_RESP_OK);
for (i = 0; up_commands[i] && *up_commands[i]; i++)
{
- p->log(3, 0, 0, 0, "Running %s\n", up_commands[i]);
+ p->_log(3, 0, 0, 0, "Running %s\n", up_commands[i]);
system(up_commands[i]);
}
if (flag == 1)
{
- p->log(2, 0, 0, s->tunnel, "Garden user %s (%s)\n", s->user, p->inet_toa(htonl(s->ip)));
+ p->_log(2, 0, 0, s->tunnel, "Garden user %s (%s)\n", s->user, p->inet_toa(htonl(s->ip)));
snprintf(cmd, sizeof(cmd), "iptables -t nat -A garden_users -s %s -j garden", p->inet_toa(htonl(s->ip)));
- p->log(3, 0, 0, s->tunnel, "%s\n", cmd);
+ p->_log(3, 0, 0, s->tunnel, "%s\n", cmd);
system(cmd);
s->walled_garden = 1;
}
int count = 40;
// Normal User
- p->log(2, 0, 0, s->tunnel, "Un-Garden user %s (%s)\n", s->user, p->inet_toa(htonl(s->ip)));
+ p->_log(2, 0, 0, s->tunnel, "Un-Garden user %s (%s)\n", s->user, p->inet_toa(htonl(s->ip)));
// Kick off any duplicate usernames
// but make sure not to kick off ourself
if (s->ip && !s->die && (other = p->get_session_by_username(s->user)) && s != p->get_session_by_id(other)) {
s->pin = s->pout = 0;
snprintf(cmd, sizeof(cmd), "iptables -t nat -D garden_users -s %s -j garden", p->inet_toa(htonl(s->ip)));
- p->log(3, 0, 0, s->tunnel, "%s\n", cmd);
+ p->_log(3, 0, 0, s->tunnel, "%s\n", cmd);
while (--count)
{
int status = system(cmd);
int i;
for (i = 0; down_commands[i] && *down_commands[i]; i++)
{
- p->log(3, 0, 0, 0, "Running %s\n", down_commands[i]);
+ p->_log(3, 0, 0, 0, "Running %s\n", down_commands[i]);
system(down_commands[i]);
}
}
for (i = 0; down_commands[i] && *down_commands[i]; i++)
{
- p->log(3, 0, 0, 0, "Running %s\n", down_commands[i]);
+ p->_log(3, 0, 0, 0, "Running %s\n", down_commands[i]);
system(down_commands[i]);
}
}
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
// vim: sw=8 ts=8
-char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.38 2004-11-02 06:45:03 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.39 2004-11-03 13:23:58 bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
va_end(ap);
}
-void _log_hex(int level, ipt address, sessionidt s, tunnelidt t, const char *title, const char *data, int maxsize)
+void _log_hex(int level, const char *title, const char *data, int maxsize)
{
int i, j;
const u8 *d = (const u8 *)data;
// No support for log_hex to syslog
if (log_stream)
{
- log(level, address, s, t, "%s (%d bytes):\n", title, maxsize);
+ _log(level, 0, 0, 0, "%s (%d bytes):\n", title, maxsize);
setvbuf(log_stream, NULL, _IOFBF, 16384);
for (i = 0; i < maxsize; )
// L2TPNS Global Stuff
-// $Id: l2tpns.h,v 1.27 2004-11-02 23:43:52 bodea Exp $
+// $Id: l2tpns.h,v 1.28 2004-11-03 13:23:59 bodea Exp $
#ifndef __L2TPNS_H__
#define __L2TPNS_H__
int cmd_show_hist_idle(struct cli_def *cli, char *command, char **argv, int argc);
int cmd_show_hist_open(struct cli_def *cli, char *command, char **argv, int argc);
-#define log _log
-#ifndef log_hex
-#define log_hex(a,b,c,d) do{if (a <= config->debug) _log_hex(a,0,0,0,b,c,d);}while (0)
-#endif
+#undef log
+#undef log_hex
+#define log(D, a, s, t, f, ...) ({ if (D <= config->debug) _log(D, a, s, t, f, ## __VA_ARGS__); })
+#define log_hex(D, t, d, s) ({ if (D <= config->debug) _log_hex(D, t, d, s); })
+
void _log(int level, ipt address, sessionidt s, tunnelidt t, const char *format, ...) __attribute__((format (printf, 5, 6)));
-void _log_hex(int level, ipt address, sessionidt s, tunnelidt t, const char *title, const char *data, int maxsize);
+void _log_hex(int level, const char *title, const char *data, int maxsize);
+
void build_chap_response(char *challenge, u8 id, u16 challenge_length, char **challenge_response);
int sessionsetup(tunnelidt t, sessionidt s);
int cluster_send_session(int s);
struct pluginfuncs
{
void (*_log)(int level, ipt address, sessionidt s, tunnelidt t, const char *format, ...);
- void (*_log_hex)(int level, ipt address, sessionidt s, tunnelidt t, const char *title, const char *data, int maxsize);
+ void (*_log_hex)(int level, const char *title, const char *data, int maxsize);
char *(*inet_toa)(unsigned long addr);
sessionidt (*get_session_by_username)(char *username);
sessiont *(*get_session_by_id)(sessionidt s);