net/darkstat: update to 3.0.722

This commit is contained in:
kirill
2025-11-09 19:38:48 +00:00
parent 9f89c9277a
commit 34ff4d2954
5 changed files with 16 additions and 82 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ COMMENT= network statistics gatherer with graphs
GH_ACCOUNT= emikulic
GH_PROJECT= darkstat
GH_TAGNAME= 3.0.721
GH_TAGNAME= 3.0.722
CATEGORIES= net www
+2 -2
View File
@@ -1,2 +1,2 @@
SHA256 (darkstat-3.0.721.tar.gz) = C0BabAESQPV3VZ2E2yJoSmNJslBnw6gA3xJDl4PCVJQ=
SIZE (darkstat-3.0.721.tar.gz) = 104050
SHA256 (darkstat-3.0.722.tar.gz) = XI5m1MR4ttflj0yEKCOgkSVQm/aFEBf/cOMrMs6VsBs=
SIZE (darkstat-3.0.722.tar.gz) = 107679
-69
View File
@@ -1,69 +0,0 @@
Support multiple -l.
Index: acct.c
--- acct.c.orig
+++ acct.c
@@ -37,8 +37,9 @@
uint64_t acct_total_packets = 0, acct_total_bytes = 0;
-static int using_localnet4 = 0, using_localnet6 = 0;
-static struct addr localnet4, localmask4, localnet6, localmask6;
+static int total_localnets4 = 0, total_localnets6 = 0;
+static struct addr *localnets4 = NULL, *localmasks4 = NULL;
+static struct addr *localnets6 = NULL, *localmasks6 = NULL;
/* Parse the net/mask specification into two IPs or die trying. */
void
@@ -120,13 +121,19 @@ acct_init_localnet(const char *spec)
/* Register the correct netmask and calculate the correct net. */
addr_mask(&localnet, &localmask);
if (localnet.family == IPv6) {
- using_localnet6 = 1;
- localnet6 = localnet;
- localmask6 = localmask;
+ j = total_localnets6 + 1;
+ localnets6 = xrealloc(localnets6, sizeof(*(localnets6)) * j);
+ localmasks6 = xrealloc(localmasks6, sizeof(*(localmasks6)) * j);
+ localnets6[total_localnets6] = localnet;
+ localmasks6[total_localnets6] = localmask;
+ total_localnets6++;
} else {
- using_localnet4 = 1;
- localnet4 = localnet;
- localmask4 = localmask;
+ j = total_localnets4 + 1;
+ localnets4 = xrealloc(localnets4, sizeof(*(localnets4)) * j);
+ localmasks4 = xrealloc(localmasks4, sizeof(*(localmasks4)) * j);
+ localnets4[total_localnets4] = localnet;
+ localmasks4[total_localnets4] = localmask;
+ total_localnets4++;
}
verbosef("local network address: %s", addr_to_str(&localnet));
@@ -135,14 +142,19 @@ acct_init_localnet(const char *spec)
static int addr_is_local(const struct addr * const a,
const struct local_ips *local_ips) {
+ int i;
if (is_localip(a, local_ips))
return 1;
- if (a->family == IPv4 && using_localnet4) {
- if (addr_inside(a, &localnet4, &localmask4))
- return 1;
- } else if (a->family == IPv6 && using_localnet6) {
- if (addr_inside(a, &localnet6, &localmask6))
- return 1;
+ if (a->family == IPv4) {
+ for (i = 0; i < total_localnets4; i++) {
+ if (addr_inside(a, &localnets4[i], &localmasks4[i]))
+ return 1;
+ }
+ } else if (a->family == IPv6) {
+ for (i = 0; i < total_localnets6; i++) {
+ if (addr_inside(a, &localnets6[i], &localmasks6[i]))
+ return 1;
+ }
}
return 0;
}
+1 -10
View File
@@ -1,4 +1,4 @@
Re-instate the chroot by default code and support multiple -l.
Re-instate the chroot by default code.
Index: darkstat.c
--- darkstat.c.orig
@@ -56,15 +56,6 @@ Index: darkstat.c
unsigned int opt_hosts_max = 1000;
static void cb_hosts_max(const char *arg)
@@ -193,7 +221,7 @@ static struct cmdline_arg cmdline_args[] = {
{"-r", "capfile", cb_capfile, 0},
{"-p", "port", cb_port, 0},
{"-b", "bindaddr", cb_bindaddr, -1},
- {"-l", "network/netmask", cb_local, 0},
+ {"-l", "network/netmask", cb_local, -1},
{"--base", "path", cb_base, 0},
{"--local-only", NULL, cb_local_only, 0},
{"--snaplen", "bytes", cb_snaplen, 0},
@@ -306,7 +334,9 @@ static void parse_cmdline(const int argc, char * const
if (opt_want_syslog)
openlog("darkstat", LOG_NDELAY | LOG_PID, LOG_DAEMON);
+12
View File
@@ -0,0 +1,12 @@
Index: linktypes.c
--- linktypes.c.orig
+++ linktypes.c
@@ -16,7 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <pcap/dlt.h>
+#include <pcap.h>
struct linktype_pair {
int linktype; /* Returned by pcap_datalink(). */