X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=prometheus.c;h=236e4ab58a74411c0a43ba7d645b43634e67f138;hb=1b14a1b4632d998d6c76f052ef0936dc207e80ea;hp=992e6bd6396fca31f3ac9de4e953cb5f6a07f111;hpb=1a2ab32b216e382f5b24e019baa71493f356fb08;p=svn%2FPrometheus-QoS%2F.git diff --git a/prometheus.c b/prometheus.c index 992e6bd..236e4ab 100644 --- a/prometheus.c +++ b/prometheus.c @@ -7,7 +7,7 @@ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Modified by: xChaos, 20171012 +/* Modified by: xChaos, 20171106 ludva, 20080415 Prometheus QoS is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ #include "cll1-0.6.2.h" #include "ipstruct.h" -const char *version = "0.9.0-a"; +const char *version = "0.9.1"; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Versions: 0.9.0 is development release, 1.0 will be "stable" */ @@ -61,6 +61,7 @@ char *hosts = "/etc/prometheus/hosts"; /* per-IP bandwidth definition char *macrosfile = "/etc/prometheus/prometheus.macros"; /* rewrite rules for most common tariffs */ char *upstreamfile = "/etc/prometheus/upstream.interfaces"; /* list of interfaces to manage */ char *downstreamfile = "/etc/prometheus/downstream.interfaces"; /* list of interfaces to manage */ +char *qosfreefile = "/etc/prometheus/qosfree.interfaces"; /* list of interfaces to manage */ char *iptablesfile = "/var/spool/prometheus.iptables"; /* temporary file for iptables-restore*/ char *ip6tablesfile = "/var/spool/prometheus.ip6tables"; /* temporary file for ip6tables-restore*/ char *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */ @@ -138,6 +139,7 @@ struct Keyword *keyword, *defaultkeyword=NULL, *keywords = NULL; struct Macro *macro, *macros = NULL; struct Index *idxs = NULL, *idx, *metaindex; struct Interface *interfaces = NULL, *interface; +struct QosFreeInterface *qosfreeinterfaces = NULL, *qosfreeinterface; #define FREE_CLASS 3 #define OVERLIMIT_CLASS 4 @@ -290,6 +292,7 @@ void get_config(char *config_filename) option("hosts",hosts); option("downstream-interfaces-list-filename",downstreamfile); option("upstream-interfaces-list-filename",upstreamfile); + option("qos-free-interfaces-list-filename",qosfreefile); option("macros-filename",macrosfile); option("ip6-prefix",ip6prefix); option("medium",medium); @@ -566,7 +569,6 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } } done; /* ugly macro end */ - if(just_logs) { @@ -605,6 +607,12 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); string(str, STRLEN); string(limit_pkts, STRLEN); + /*-----------------------------------------------------------------*/ + printf("Parsing qos free interfaces file %s ...\n", qosfreefile); + /*-----------------------------------------------------------------*/ + load(qosfreeinterface, qosfreeinterfaces, + qosfreefile, QosFreeInterface, name); + /*-----------------------------------------------------------------*/ printf("Parsing macro definition file %s ...\n", macrosfile); /*-----------------------------------------------------------------*/ @@ -756,6 +764,16 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } } + for_each(qosfreeinterface, qosfreeinterfaces) + { + sprintf(str,"-A FORWARD -i %s -j ACCEPT", qosfreeinterface->name); + iptables_save_line(str, IPv4); + iptables_save_line(str, IPv6); + sprintf(str,"-A POSTROUTING -o %s -j ACCEPT", qosfreeinterface->name); + iptables_save_line(str, IPv4); + iptables_save_line(str, IPv6); + } + if(ip_count > idxtable_treshold1 && !just_flush) { int idxcount=0, bitmask=32-idxtable_bitmask1; @@ -1273,7 +1291,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); interface->name, limit_pkts); iptables_save_line(str, ip->v6); - if(limit_pkts) + if(*limit_pkts) /* non-empty string?*/ { /* classify overlimit packets to separate overlimit class */ sprintf(str, "-A %s -%c %s/%d -o %s -j %s%d",