From: xchaos Date: Mon, 6 Nov 2017 22:26:39 +0000 (+0000) Subject: qos free interface list (probably, not tested) X-Git-Url: http://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=commitdiff_plain;h=20ae739ca407ae6f1b012d3c58e5b0c28514b9d8 qos free interface list (probably, not tested) git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@265 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/ipstruct.h b/ipstruct.h index c7843f6..80810fc 100644 --- a/ipstruct.h +++ b/ipstruct.h @@ -72,6 +72,13 @@ struct Macro list(Macro); }; +struct QosFreeInterface +{ + char *name; + int _eoln; + list(QosFreeInterface); +}; + struct Index { char *addr; diff --git a/prometheus.c b/prometheus.c index 992e6bd..edab1c1 100644 --- a/prometheus.c +++ b/prometheus.c @@ -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;