Fix cluster group update
[l2tpns.git] / setrxspeed.c
1 #include <string.h>
2 #include <sys/socket.h>
3 #include <linux/rtnetlink.h>
4
5 #include "l2tpns.h"
6 #include "plugin.h"
7
8 /* fudge up session rx speed if not set */
9
10 int plugin_api_version = PLUGIN_API_VERSION;
11 static struct pluginfuncs *f = 0;
12
13 int plugin_post_auth(struct param_post_auth *data)
14 {
15 if (!data->auth_allowed)
16 return PLUGIN_RET_OK;
17
18 if (data->s->rx_connect_speed)
19 return PLUGIN_RET_OK;
20
21 switch (data->s->tx_connect_speed)
22 {
23 case 256:
24 data->s->rx_connect_speed = 64;
25 break;
26
27 case 512:
28 data->s->rx_connect_speed = 128;
29 break;
30
31 case 1500:
32 data->s->rx_connect_speed = 256;
33 break;
34 }
35
36 return PLUGIN_RET_OK;
37 }
38
39 int plugin_init(struct pluginfuncs *funcs)
40 {
41 return ((f = funcs)) ? 1 : 0;
42 }