From: bodea Date: Sat, 30 Oct 2004 07:35:31 +0000 (+0000) Subject: merge X-Git-Tag: release_2_0_3~9 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/91ea0d697dbf1262ec369a5eac4b15b462e34e3c merge --- diff --git a/cli.c b/cli.c index 527fec7..ff2063d 100644 --- a/cli.c +++ b/cli.c @@ -2,7 +2,7 @@ // vim: sw=8 ts=8 char const *cvs_name = "$Name: $"; -char const *cvs_id_cli = "$Id: cli.c,v 1.18 2004/10/28 03:31:11 bodea Exp $"; +char const *cvs_id_cli = "$Id: cli.c,v 1.19 2004/10/30 07:35:31 bodea Exp $"; #include #include @@ -566,6 +566,7 @@ int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int argc) "IP", "State", "Sessions"); + for (i = 1; i < MAXTUNNEL; i++) { int sessions = 0; @@ -579,6 +580,7 @@ int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int argc) states[tunnel[i].state], sessions); } + return CLI_OK; } @@ -618,7 +620,7 @@ int cmd_show_users(struct cli_def *cli, char *command, char **argv, int argc) } if (sargc > 0) - return cmd_show_session(cli, "users", sargv, sargc); + return cmd_show_session(cli, "users", sargv, sargc); return CLI_OK; } @@ -968,12 +970,9 @@ int cmd_show_plugins(struct cli_def *cli, char *command, char **argv, int argc) cli_print(cli, "Plugins currently loaded:"); for (i = 0; i < MAXPLUGINS; i++) - { if (*config->plugins[i]) - { cli_print(cli, " %s", config->plugins[i]); - } - } + return CLI_OK; } @@ -996,6 +995,7 @@ int cmd_show_throttle(struct cli_def *cli, char *command, char **argv, int argc) session[i].tbf_in, session[i].tbf_out); } + return CLI_OK; } @@ -1201,7 +1201,7 @@ int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc) if (argc < 3) { - cli_print(cli, "Specify username ip port"); + cli_print(cli, "Specify username, ip and port"); return CLI_OK; } @@ -1240,7 +1240,7 @@ int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int argc) if (CLI_HELP_REQUESTED) return cli_arg_help(cli, argc > 1, - "USER", "Username of session to un-snoop", NULL); + "USER", "Username of session to unsnoop", NULL); if (!config->cluster_iam_master) { @@ -1250,7 +1250,7 @@ int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int argc) if (!argc) { - cli_print(cli, "Specify a user"); + cli_print(cli, "Specify a user to unsnoop"); return CLI_OK; } @@ -1265,6 +1265,7 @@ int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int argc) cli_print(cli, "Not snooping user %s", argv[i]); cli_session_actions[s].action |= CLI_SESS_NOSNOOP; } + return CLI_OK; } @@ -1300,7 +1301,7 @@ int cmd_throttle(struct cli_def *cli, char *command, char **argv, int argc) if (argc == 0) { - cli_print(cli, "You must specify at least a username"); + cli_print(cli, "Specify a user to throttle"); return CLI_OK; } @@ -1334,7 +1335,7 @@ int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int argc) if (CLI_HELP_REQUESTED) return cli_arg_help(cli, argc > 1, - "USER", "Username of session to un-throttle", NULL); + "USER", "Username of session to unthrottle", NULL); if (!config->cluster_iam_master) { @@ -1344,7 +1345,7 @@ int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int argc) if (!argc) { - cli_print(cli, "Specify a user"); + cli_print(cli, "Specify a user to unthrottle"); return CLI_OK; } diff --git a/garden.c b/garden.c index d33c9ff..9e2dd08 100644 --- a/garden.c +++ b/garden.c @@ -7,7 +7,7 @@ #include "plugin.h" #include "control.h" -char const *cvs_id = "$Id: garden.c,v 1.7 2004/06/28 02:43:13 fred_nerk Exp $"; +char const *cvs_id = "$Id: garden.c,v 1.8 2004/10/30 07:35:31 bodea Exp $"; int __plugin_api_version = 1; static struct pluginfuncs *p = 0; @@ -15,12 +15,12 @@ static struct pluginfuncs *p = 0; static int iam_master = 0; // We're all slaves! Slaves I tell you! char *up_commands[] = { - "iptables -t nat -N garden >/dev/null 2>&1", // Create a chain that all gardened users will go through + "iptables -t nat -N garden >/dev/null 2>&1", // Create a chain that all gardened users will go through "iptables -t nat -F garden", - ". " PLUGINCONF "/build-garden", // Populate with site-specific DNAT rules - "iptables -t nat -N garden_users >/dev/null 2>&1",// Empty chain, users added/removed by garden_session + ". " PLUGINCONF "/build-garden", // Populate with site-specific DNAT rules + "iptables -t nat -N garden_users >/dev/null 2>&1", // Empty chain, users added/removed by garden_session "iptables -t nat -F garden_users", - "iptables -t nat -A PREROUTING -j garden_users", // DNAT any users on the garden_users chain + "iptables -t nat -A PREROUTING -j garden_users", // DNAT any users on the garden_users chain "sysctl -w net.ipv4.ip_conntrack_max=256000 >/dev/null", // lots of entries NULL, }; @@ -149,7 +149,7 @@ int garden_session(sessiont *s, int flag) if (flag == 1) { p->log(2, 0, 0, s->tunnel, "Garden user %s (%s)\n", s->user, p->inet_toa(htonl(s->ip))); - snprintf(cmd, 2048, "iptables -t nat -A garden_users -s %s -j garden", 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); system(cmd); s->walled_garden = 1; @@ -170,7 +170,7 @@ int garden_session(sessiont *s, int flag) s->cin = s->cout = 0; s->pin = s->pout = 0; - snprintf(cmd, 2048, "iptables -t nat -D garden_users -s %s -j garden", p->inet_toa(htonl(s->ip))); + 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); while (--count) {