filters
authorBrendan O'Dea <bod@optus.net>
Sat, 27 Nov 2004 21:10:50 +0000 (21:10 +0000)
committerBrendan O'Dea <bod@optus.net>
Sat, 27 Nov 2004 21:10:50 +0000 (21:10 +0000)
cli.c
radius.c

diff --git a/cli.c b/cli.c
index 986361a..7e19a71 100644 (file)
--- 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 <stdio.h>
 #include <stdarg.h>
@@ -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)
index df3d40b..9eb00f5 100644 (file)
--- 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 <time.h>
 #include <stdio.h>
@@ -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;