-? Brendan O'Dea <bod@optusnet.com.au> 2.0.5
+* Tue Nov 9 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.5
- Handle routing properly in lone-master case
- Fix intercepts: don't double-snoop throttled customers, ensure
byte/packet counts are only updated once
+- Add a callback to allow plugins to fetch values from the running config
* Mon Nov 8 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.4
- Added setrxspeed plugin
/* set up intercept based on RADIUS reply */
-char const *cvs_id = "$Id: autosnoop.c,v 1.6 2004/11/09 06:02:37 bodea Exp $";
+char const *cvs_id = "$Id: autosnoop.c,v 1.7 2004/11/09 08:05:02 bodea Exp $";
-int __plugin_api_version = 1;
+int __plugin_api_version = PLUGIN_API_VERSION;
struct pluginfuncs *p;
int plugin_radius_response(struct param_radius_response *data)
/* set up throttling based on RADIUS reply */
-char const *cvs_id = "$Id: autothrottle.c,v 1.7 2004/11/05 04:55:26 bodea Exp $";
+char const *cvs_id = "$Id: autothrottle.c,v 1.8 2004/11/09 08:05:02 bodea Exp $";
-int __plugin_api_version = 1;
+int __plugin_api_version = PLUGIN_API_VERSION;
struct pluginfuncs *p;
#define THROTTLE_KEY "lcp:interface-config"
{
if (strcmp(data->value, "yes") == 0)
{
- 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;
+ unsigned long *rate = p->getconfig("throttle_speed", UNSIGNED_LONG);
+ if (rate)
+ {
+ if (*rate)
+ p->log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Throttling user to %dkb/s\n", *rate);
+ else
+ p->log(3, 0, p->get_id_by_session(data->s), data->s->tunnel, " Not throttling user (throttle_speed=0)\n");
+
+ data->s->throttle_in = data->s->throttle_out = *rate;
+ }
+ else
+ p->log(1, 0, p->get_id_by_session(data->s), data->s->tunnel, "Not throttling user (can't get throttle_speed)\n");
}
else if (strcmp(data->value, "no") == 0)
{
/* walled garden */
-char const *cvs_id = "$Id: garden.c,v 1.11 2004/11/05 04:55:27 bodea Exp $";
+char const *cvs_id = "$Id: garden.c,v 1.12 2004/11/09 08:05:02 bodea Exp $";
-int __plugin_api_version = 1;
+int __plugin_api_version = PLUGIN_API_VERSION;
static struct pluginfuncs *p = 0;
static int iam_master = 0; // We're all slaves! Slaves I tell you!
// 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.46 2004/11/09 05:42:53 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.47 2004/11/09 08:05:02 bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
{
if (strcmp(config->plugins[i], config->old_plugins[i]) == 0)
continue;
+
if (*config->plugins[i])
{
// Plugin added
return dlopen(path, RTLD_NOW);
}
+// plugin callback to get a config value
+static void *getconfig(char *key, enum config_typet type)
+{
+ int i;
+
+ for (i = 0; config_values[i].key; i++)
+ {
+ if (!strcmp(config_values[i].key, key))
+ {
+ if (config_values[i].type == type)
+ return ((void *) config) + config_values[i].offset;
+
+ LOG(1, 0, 0, 0, "plugin requested config item \"%s\" expecting type %d, have type %d\n",
+ key, type, config_values[i].type);
+
+ return 0;
+ }
+ }
+
+ LOG(1, 0, 0, 0, "plugin requested unknown config item \"%s\"\n", key);
+ return 0;
+}
+
void add_plugin(char *plugin_name)
{
static struct pluginfuncs funcs = {
sessionkill,
radiusnew,
radiussend,
+ getconfig,
};
void *p = open_plugin(plugin_name, 1);
// L2TPNS Global Stuff
-// $Id: l2tpns.h,v 1.30 2004/11/05 04:55:27 bodea Exp $
+// $Id: l2tpns.h,v 1.31 2004/11/09 08:05:02 bodea Exp $
#ifndef __L2TPNS_H__
#define __L2TPNS_H__
#endif
};
+enum config_typet { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IP, MAC };
struct config_descriptt
{
char *key;
int offset;
int size;
- enum { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IP, MAC } type;
+ enum config_typet type;
};
// arp.c
Summary: A high-speed clustered L2TP LNS
Name: l2tpns
-Version: 2.0.4
+Version: 2.0.5
Release: 1
Copyright: GPL
Group: System Environment/Daemons
%attr(755,root,root) /usr/lib/l2tpns
%changelog
+* Tue Nov 9 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.5
+- 2.0.5 release, see /usr/share/doc/l2tpns-2.0.5/Changes
+
* Mon Nov 8 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.4
-- 2.0.4 release, see /usr/share/doc/l2tpns-2.0.4/Changes
+- 2.0.4 release
* Wed Nov 3 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.3
- 2.0.3 release
#ifndef __PLUGIN_H__
#define __PLUGIN_H__
-#define PLUGIN_API_VERSION 1
+#define PLUGIN_API_VERSION 2
#define MAX_PLUGIN_TYPES 30
enum
void (*sessionkill)(sessionidt s, char *reason);
u16 (*radiusnew)(sessionidt s);
void (*radiussend)(u16 r, u8 state);
+ void *(*getconfig)(char *key, enum config_typet type);
};
struct param_pre_auth
time_t time_now;
};
-struct param_config
-{
- char *key;
- char *value;
-};
-
struct param_control
{
char *buf;
/* fudge up session rx speed if not set */
-char const *cvs_id = "$Id: setrxspeed.c,v 1.1 2004/11/05 02:38:59 bodea Exp $";
+char const *cvs_id = "$Id: setrxspeed.c,v 1.2 2004/11/09 08:05:03 bodea Exp $";
-int __plugin_api_version = 1;
+int __plugin_api_version = PLUGIN_API_VERSION;
static struct pluginfuncs *p = 0;
int plugin_post_auth(struct param_post_auth *data)
/* strip domain part of username before sending RADIUS requests */
-char const *cvs_id = "$Id: stripdomain.c,v 1.4 2004/11/05 04:55:27 bodea Exp $";
+char const *cvs_id = "$Id: stripdomain.c,v 1.5 2004/11/09 08:05:03 bodea Exp $";
-int __plugin_api_version = 1;
+int __plugin_api_version = PLUGIN_API_VERSION;
static struct pluginfuncs *p = 0;
int plugin_pre_auth(struct param_pre_auth *data)