From: bodea Date: Sat, 27 Nov 2004 21:10:50 +0000 (+0000) Subject: filters X-Git-Tag: release_2_0_9~19 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/4b25f13aeff7deba39500a94b0ec60e6f83deeca filters --- diff --git a/cli.c b/cli.c index 03d60d3..2c0fd1e 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.30 2004/11/27 20:41:41 bodea Exp $"; +char const *cvs_id_cli = "$Id: cli.c,v 1.31 2004/11/27 21:10:50 bodea Exp $"; #include #include @@ -406,9 +406,9 @@ static int cmd_show_session(struct cli_def *cli, char *command, char **argv, int cli_print(cli, "\tRx Speed:\t%lu", session[s].rx_connect_speed); cli_print(cli, "\tTx Speed:\t%lu", session[s].tx_connect_speed); if (session[s].filter_in && session[s].filter_in <= MAXFILTER) - cli_print(cli, "\tFilter in:\t%u (%s)", session[s].filter_in, filters[session[s].filter_in-1].name); + cli_print(cli, "\tFilter in:\t%u (%s)", session[s].filter_in, ip_filters[session[s].filter_in-1].name); if (session[s].filter_out && session[s].filter_out <= MAXFILTER) - cli_print(cli, "\tFilter out:\t%u (%s)", session[s].filter_out, filters[session[s].filter_out-1].name); + cli_print(cli, "\tFilter out:\t%u (%s)", session[s].filter_out, ip_filters[session[s].filter_out-1].name); if (session[s].snoop_ip && session[s].snoop_port) cli_print(cli, "\tIntercepted:\t%s:%d", inet_toa(session[s].snoop_ip), session[s] .snoop_port); else @@ -2557,7 +2557,7 @@ ip_filter_rulet *access_list_rule_ext(struct cli_def *cli, char *command, char * } else { - if (++a >= argc) + if (a >= argc - 1) { cli_print(cli, "Specify %s ip address and wildcard", i ? "destination" : "source"); return NULL; @@ -2578,6 +2578,7 @@ ip_filter_rulet *access_list_rule_ext(struct cli_def *cli, char *command, char * } *wild = addr.s_addr; + a++; } if (rule.proto == IPPROTO_IP || a >= argc) diff --git a/radius.c b/radius.c index 90917f6..fb295fb 100644 --- a/radius.c +++ b/radius.c @@ -1,6 +1,6 @@ // L2TPNS Radius Stuff -char const *cvs_id_radius = "$Id: radius.c,v 1.15 2004/11/27 20:42:02 bodea Exp $"; +char const *cvs_id_radius = "$Id: radius.c,v 1.16 2004/11/27 21:10:51 bodea Exp $"; #include #include @@ -24,6 +24,7 @@ extern tunnelt *tunnel; extern u32 sessionid; extern configt *config; extern int *radfds; +extern ip_filtert *ip_filters; static const char *radius_state(int state) { @@ -545,17 +546,17 @@ void processrad(u8 *buf, int len, char socket_index) // Filter-Id char *filter = p + 2; int l = p[1] - 2; - char *s; + char *suffix; u8 *f = 0; int i; LOG(3, 0, s, session[s].tunnel, " Radius reply contains Filter-Id \"%.*s\"\n", l, filter); - if ((s = memchr(filter, '.', l))) + if ((suffix = memchr(filter, '.', l))) { - int b = s - filter; - if (l - b == 3 && !memcmp("in", s+1, 2)) + int b = suffix - filter; + if (l - b == 3 && !memcmp("in", suffix+1, 2)) f = &session[s].filter_in; - else if (l - b == 4 && !memcmp("out", s+1, 3)) + else if (l - b == 4 && !memcmp("out", suffix+1, 3)) f = &session[s].filter_out; l = b;