X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/97b796f5a5ec6a4d14757c87885cd0f6bfdf6d5c..9c77145f71b0e669421d00ae0b34680f875121ae:/setrxspeed.c diff --git a/setrxspeed.c b/setrxspeed.c index 2035ca4..a808c85 100644 --- a/setrxspeed.c +++ b/setrxspeed.c @@ -1,37 +1,41 @@ #include +#include +#include "dhcp6.h" #include "l2tpns.h" #include "plugin.h" /* 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 $"; - -int __plugin_api_version = 1; -static struct pluginfuncs *p = 0; +int plugin_api_version = PLUGIN_API_VERSION; +static struct pluginfuncs *f = 0; int plugin_post_auth(struct param_post_auth *data) { - if (!data->auth_allowed) return PLUGIN_RET_OK; - - if (!data->s->rx_connect_speed) - { - switch (data->s->tx_connect_speed) - { - case 256 : - data->s->rx_connect_speed = 64; - break; - case 512 : - data->s->rx_connect_speed = 128; - break; - case 1500 : - data->s->rx_connect_speed = 256; - break; - } - } - return PLUGIN_RET_OK; + if (!data->auth_allowed) + return PLUGIN_RET_OK; + + if (data->s->rx_connect_speed) + return PLUGIN_RET_OK; + + switch (data->s->tx_connect_speed) + { + case 256: + data->s->rx_connect_speed = 64; + break; + + case 512: + data->s->rx_connect_speed = 128; + break; + + case 1500: + data->s->rx_connect_speed = 256; + break; + } + + return PLUGIN_RET_OK; } int plugin_init(struct pluginfuncs *funcs) { - return ((p = funcs)) ? 1 : 0; + return ((f = funcs)) ? 1 : 0; }