Update changelog
[l2tpns.git] / garden.c
index 0b7d763..da4a7d6 100644 (file)
--- a/garden.c
+++ b/garden.c
@@ -3,9 +3,10 @@
 #include <stdlib.h>
 #include <sys/wait.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <linux/rtnetlink.h>
+#include <netinet/ip6.h>
 
+#include "dhcp6.h"
 #include "l2tpns.h"
 #include "plugin.h"
 #include "control.h"
@@ -160,7 +161,7 @@ int plugin_become_master(void)
     for (i = 0; up_commands[i] && *up_commands[i]; i++)
     {
        f->log(3, 0, 0, "Running %s\n", up_commands[i]);
-       system(up_commands[i]);
+       if (-1 == system(up_commands[i])) f->log(0, 0, 0, "error command %s\n", up_commands[i]);
     }
 
     return PLUGIN_RET_OK;
@@ -179,6 +180,7 @@ int garden_session(sessiont *s, int flag, char *newuser)
 {
     char cmd[2048];
     sessionidt sess;
+       int status;
 
     if (!s) return 0;
     if (!s->opened) return 0;
@@ -194,7 +196,7 @@ int garden_session(sessiont *s, int flag, char *newuser)
            f->fmtaddr(htonl(s->ip), 0));
 
        f->log(3, sess, s->tunnel, "%s\n", cmd);
-       system(cmd);
+       status = system(cmd);
        s->walled_garden = 1;
     }
     else
@@ -222,7 +224,7 @@ int garden_session(sessiont *s, int flag, char *newuser)
        /* Clean up counters */
        s->pin = s->pout = 0;
        s->cin = s->cout = 0;
-       s->cin_delta = s->cout_delta = s->coutgrp_delta = 0;
+       s->cin_delta = s->cout_delta = 0;
        s->cin_wrap = s->cout_wrap = 0;
 
        snprintf(cmd, sizeof(cmd),
@@ -232,7 +234,7 @@ int garden_session(sessiont *s, int flag, char *newuser)
        f->log(3, sess, s->tunnel, "%s\n", cmd);
        while (--count)
        {
-           int status = system(cmd);
+           status = system(cmd);
            if (WEXITSTATUS(status) != 0) break;
        }
 
@@ -275,7 +277,7 @@ int plugin_init(struct pluginfuncs *funcs)
        for (i = 0; down_commands[i] && *down_commands[i]; i++)
        {
            f->log(3, 0, 0, "Running %s\n", down_commands[i]);
-           system(down_commands[i]);
+           if (-1 == system(down_commands[i])) f->log(0, 0, 0, "error command %s\n", down_commands[i]);
        }
     }
 
@@ -292,7 +294,7 @@ void plugin_done()
     for (i = 0; down_commands[i] && *down_commands[i]; i++)
     {
        f->log(3, 0, 0, "Running %s\n", down_commands[i]);
-       system(down_commands[i]);
+       if (-1 == system(down_commands[i])) f->log(0, 0, 0, "error command %s\n", down_commands[i]);
     }
 }