// 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.45 2004-11-05 07:50:05 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>
return;
}
- // Snooping this session, send it to intercept box
- if (sp->snoop_ip && sp->snoop_port)
- snoop_send_packet(buf, len, sp->snoop_ip, sp->snoop_port);
-
LOG(5, session[s].ip, s, t, "Ethernet -> Tunnel (%d bytes)\n", len);
// Add on L2TP header
tunnelsend(b, len + (p-b), t); // send it...
}
+ // Snooping this session, send it to intercept box
+ if (sp->snoop_ip && sp->snoop_port)
+ snoop_send_packet(buf, len, sp->snoop_ip, sp->snoop_port);
+
sp->cout += len; // byte count
sp->total_cout += len; // byte count
sp->pout++;
if (!session[s].ip)
return;
+
t = session[s].tunnel;
sp = &session[s];
LOG(5, session[s].ip, s, t, "Ethernet -> Tunnel (%d bytes)\n", len);
- // Snooping this session.
- if (sp->snoop_ip && sp->snoop_port)
- snoop_send_packet(buf, len, sp->snoop_ip, sp->snoop_port);
-
// Add on L2TP header
{
u8 *p = makeppp(b, sizeof(b), buf, len, t, s, PPPIP);
}
tunnelsend(b, len + (p-b), t); // send it...
}
+
+ // Snooping this session.
+ if (sp->snoop_ip && sp->snoop_port)
+ snoop_send_packet(buf, len, sp->snoop_ip, sp->snoop_port);
+
sp->cout += len; // byte count
sp->total_cout += len; // byte count
sp->pout++;
{
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);