X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=prometheus.c;h=87c5f18a92487053b1d56a04ca658ce7174a7799;hb=75e8c6ab4e96499b902961d41fb90fe58df88c8b;hp=267070fae0c1498b2fb20143c620e3731c47f8e8;hpb=207cfcdbe2fe0da554f48ee4b248003e995bdae0;p=svn%2FPrometheus-QoS%2F.git diff --git a/prometheus.c b/prometheus.c index 267070f..87c5f18 100644 --- a/prometheus.c +++ b/prometheus.c @@ -2,12 +2,12 @@ /* Prometheus QoS - you can "steal fire" from your ISP */ /* "fair-per-IP" quality of service (QoS) utility */ /* requires Linux 2.4.x or 2.6.x with HTB support */ -/* Copyright(C) 2005-2017 Michael Polak, Arachne Aerospace */ +/* Copyright(C) 2005-2019 Michael Polak, Arachne Aerospace */ /* iptables-restore support Copyright(C) 2007-2008 ludva */ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Modified by: xChaos, 20171106 +/* Modified by: xChaos, 20190912 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-b"; +const char *version = "0.9.0-c"; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Versions: 0.9.0 is development release, 1.0 will be "stable" */ @@ -40,7 +40,7 @@ const char *version = "0.9.0-b"; /* Warning: unofficial Github mirror is not supported by author! */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2017 Michael Polak, Arachne Labs
\n"; +const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2019 Michael Polak, Arachne Labs
\n"; #define STRLEN 512 #undef DEBUG @@ -101,6 +101,8 @@ char *medium = "1000Mbit"; /* 10Mbit/100Mbit ethernet */ char *ip6prefix = NULL; /* Prefix for global /48 IPv6 subnet */ char *qos_leaf = "sfq perturb 5"; /* leaf discipline */ char *qos_free_zone = NULL; /* QoS free zone */ +char *qos_free_dst_ipset = NULL; /* QoS free zone - dst match ipset name, must be prepared outside prometheus */ +char *qos_free_src_ipset = NULL; /* QoS free zone - src match ipset name, must be prepared outside prometheus */ /* int qos_proxy = TRUE; include proxy port to QoS */ int found_lmsid = FALSE; /* show links to users in LMS information system */ int include_upload = TRUE; /* upload+download=total traffic */ @@ -314,6 +316,8 @@ void get_config(char *config_filename) option("lms-url",lms_url); ioption("use-jquery-popups",use_jquery_popups); option("qos-free-zone",qos_free_zone); + option("qos-free-dst-ipset",qos_free_dst_ipset); + option("qos-free-src-ipset",qos_free_src_ipset); ioption("qos-free-delay",qos_free_delay); /* ioption("qos-proxy-enable",qos_proxy); */ /* option("qos-proxy-ip",proxy_ip);*/ @@ -755,7 +759,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); iptables_save_line(ip6preamble, IPv6); } - if(qos_free_zone && *qos_free_zone!='0') /* this is currently supported only for IPv4 */ + if(qos_free_zone && *qos_free_zone != '0') /* this is currently supported only for IPv4 */ { for_each(interface, interfaces) { @@ -763,6 +767,24 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); iptables_save_line(str, IPv4); } } + + if(qos_free_dst_ipset && *qos_free_dst_ipset != '0') /* this is currently supported only for IPv4 */ + { + for_each(interface, interfaces) + { + sprintf(str,"-A %s -m set --match-set %s %s -o %s -j ACCEPT", interface->chain, qos_free_dst_ipset, (interface->is_upstream?"src":"dst"), interface->name); + iptables_save_line(str, IPv4); + } + } + + if(qos_free_src_ipset && *qos_free_src_ipset != '0') /* this is currently supported only for IPv4 */ + { + for_each(interface, interfaces) + { + sprintf(str,"-A %s -m set --match-set %s %s -o %s -j ACCEPT", interface->chain, qos_free_src_ipset, (interface->is_upstream?"dst":"src"), interface->name); + iptables_save_line(str, IPv4); + } + } for_each(qosfreeinterface, qosfreeinterfaces) { @@ -1291,7 +1313,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",