pre-release cleanup
[svn/Prometheus-QoS/.git] / prometheus.c
index c7887a0e5b099f1326f2229f802a48222b879fb1..fcba898971e8a84d57445551ffea62ae1d236344 100644 (file)
@@ -7,7 +7,7 @@
 /* == Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf == */\r
 /* =============================================================== */\r
 \r
-/* Modified: xChaos, 20080201\r
+/* Modified: xChaos, 20080202\r
              ludva, 20071227\r
 \r
    Prometheus QoS is free software; you can redistribute it and/or\r
 \r
 const char *version="0.7.8"; /*0.7.9 will be last development, 0.8.0 first stable */\r
 \r
+/* ======= All path names are defined hear (for RPM patch) =======  */\r
+\r
+char *tc              = "/sbin/tc"; /* requires tc with HTB support */\r
+char *iptables        = "/sbin/iptables"; /* requires iptables utility */\r
+char *iptablessave    = "/sbin/iptables-save"; /* not yet required */\r
+char *iptablesrestore = "/sbin/iptables-restore";  /* requires iptables-restore */\r
+\r
+char *config          = "/etc/prometheus/prometheus.conf"; /* main configuration file */\r
+char *hosts           = "/etc/prometheus/hosts"; /* per-IP bandwidth definition file */\r
+\r
+char *iptablesfile    = "/var/spool/prometheus.iptables"; /* temporary file for iptables-restore*/\r
+char *credit          = "/var/lib/misc/prometheus.credit"; /* credit log file */\r
+char *html            = "/var/www/traffic.html"; /* hall of fame filename */\r
+char *preview         = "/var/www/preview.html"; /* hall of fame preview */\r
+char *cmdlog          = "/var/log/prometheuslog"; /* command log filename */\r
+char *log_dir         = "/var/www/logs/"; /* log directory pathname, ended with slash */\r
+char *log_url         = "logs/"; /* log directory relative URI prefix (partial URL) */\r
+\r
 /* ======= Help screen is hopefuly self-documenting part of code :-) ======= */\r
 \r
 void help(void)\r
@@ -59,23 +77,10 @@ int filter_type=1;                      /*1 mark, 2 classify*/
 char *mark="MARK";\r
 char *mark_iptables="MARK --set-mark ";\r
 int dry_run=0;                         /* preview - use puts() instead of system() */\r
-char *config="/etc/prometheus/prometheus.conf";   /* main configuration file */\r
-char *hosts="/etc/prometheus/hosts";              /* line bandwidth definition file */\r
-char *tc="/sbin/tc";                   /* requires tc with HTB support */\r
-char *iptables="/sbin/iptables";       /* requires iptables utility */\r
-char *iptablessave="/sbin/iptables-save"; /* new */\r
-char *iptablesrestore="/sbin/iptables-restore";  /* new */\r
-char *iptablesfile="/var/spool/prometheus.iptables";  /* new; file for iptables-restore*/\r
 char *iptablespreamble="*mangle\n:PREROUTING ACCEPT [0:0]\n:POSTROUTING ACCEPT [0:0]\n:INPUT ACCEPT [0:0]\n:OUTPUT ACCEPT [0:0]\n:FORWARD ACCEPT [0:0]";\r
 FILE *iptables_file=NULL;\r
-char *html="/var/www/traffic.html";    /* hall of fame filename */\r
-char *preview="/var/www/preview.html"; /* hall of fame preview */\r
-char *cmdlog="/var/log/prometheus";    /* command log filename */\r
-char *credit="/var/run/prometheus.credit";  /* credit log file */\r
 int enable_credit=1;                   /* enable credit file */\r
 int use_credit=0;                      /* use credit file (if enabled)*/\r
-char *log_dir="/var/www/logs/";        /* log directory pathname */\r
-char *log_url="logs/";                 /* log directory URL prefix */\r
 char *title="Hall of Fame - Greatest Suckers"; /* hall of fame title */\r
 int hall_of_fame=1;                           /* enable hall of fame */\r
 char *lan="eth0";                /* LAN interface */\r
@@ -570,17 +575,17 @@ void run_restore(void)
  \r
  save_line("COMMIT");\r
  fclose(iptables_file);\r
- if(dry_run) {\r
+ if(dry_run) \r
+ {\r
     parse(iptablesfile)\r
     {\r
         str=_;\r
         printf("%s\n", str);\r
     }done;\r
- }else{\r
-    //sprintf(restor,"cat %s",iptablesfile); else \r
-    sprintf(restor,"%s <%s",iptablesrestore, iptablesfile);\r
-    system(restor);\r
- };\r
+ }\r
+\r
+ sprintf(restor,"%s <%s",iptablesrestore, iptablesfile);\r
+ safe_run(restor);\r
  \r
  free(restor);\r
 }\r
This page took 0.133287 seconds and 4 git commands to generate.