Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package dropwatch for openSUSE:Factory checked in at 2025-09-10 17:30:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dropwatch (Old) and /work/SRC/openSUSE:Factory/.dropwatch.new.1977 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dropwatch" Wed Sep 10 17:30:36 2025 rev:6 rq:1303594 version:1.5.5 Changes: -------- --- /work/SRC/openSUSE:Factory/dropwatch/dropwatch.changes 2024-03-26 19:32:39.316821769 +0100 +++ /work/SRC/openSUSE:Factory/.dropwatch.new.1977/dropwatch.changes 2025-09-10 17:30:47.470918476 +0200 @@ -1,0 +2,11 @@ +Tue Sep 2 08:50:25 UTC 2025 - [email protected] + +- version update to 1.5.5 + * Added abilty to build and run in a docker container + * kas is the default symbol lookup method now + * Fix building without libtool installed + * Misc fixes for kas lookup logic +- deleted patches + - 83.patch (upstreamed) + +------------------------------------------------------------------- Old: ---- 83.patch dropwatch-1.5.4.tar.gz New: ---- dropwatch-1.5.5.tar.gz ----------(Old B)---------- Old:- deleted patches - 83.patch (upstreamed) ----------(Old E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dropwatch.spec ++++++ --- /var/tmp/diff_new_pack.9JWPdD/_old 2025-09-10 17:30:48.062943284 +0200 +++ /var/tmp/diff_new_pack.9JWPdD/_new 2025-09-10 17:30:48.062943284 +0200 @@ -1,7 +1,7 @@ # # spec file for package dropwatch # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: dropwatch -Version: 1.5.4 +Version: 1.5.5 Release: 0 Summary: Kernel dropped packet monitor License: GPL-2.0-only @@ -25,7 +25,6 @@ URL: https://github.com/nhorman/dropwatch Source: https://github.com/nhorman/dropwatch/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Patch1: old-readline.diff -Patch2: https://github.com/nhorman/dropwatch/pull/83.patch Patch3: bfd-link-statically.patch BuildRequires: autoconf BuildRequires: automake @@ -46,7 +45,6 @@ %if 0%{?suse_version} <= 1590 %patch -P 1 -p1 %endif -%patch -P 2 -p1 %patch -P 3 -p1 ./autogen.sh %configure ++++++ dropwatch-1.5.4.tar.gz -> dropwatch-1.5.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/.dockerignore new/dropwatch-1.5.5/.dockerignore --- old/dropwatch-1.5.4/.dockerignore 1970-01-01 01:00:00.000000000 +0100 +++ new/dropwatch-1.5.5/.dockerignore 2025-04-29 15:02:55.000000000 +0200 @@ -0,0 +1,4 @@ +.dockerignore +Dockerfile +.git* +*.md \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/.github/workflows/ci.yml new/dropwatch-1.5.5/.github/workflows/ci.yml --- old/dropwatch-1.5.4/.github/workflows/ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/dropwatch-1.5.5/.github/workflows/ci.yml 2025-04-29 15:02:55.000000000 +0200 @@ -0,0 +1,37 @@ +name: CI Build + +on: + pull_request: + push: + branches: [master] + + # Allow manual trigger from Actions tab + workflow_dispatch: + +jobs: + build_and_test: + name: Configure, build, and test + + strategy: + matrix: + platform: + - ubuntu-20.04 + - ubuntu-22.04 + compiler: + - gcc + - clang + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v3 + - name: Install dependencies + run: sudo apt-get install -y binutils-dev libreadline-dev libnl-3-dev libnl-genl-3-dev libpcap-dev + - name: Configure and build + run: ./autogen.sh && ./configure && make + env: + CC: ${{ matrix.compiler }} + - name: Run tests + run: make check + env: + CC: ${{ matrix.compiler }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/Dockerfile new/dropwatch-1.5.5/Dockerfile --- old/dropwatch-1.5.4/Dockerfile 1970-01-01 01:00:00.000000000 +0100 +++ new/dropwatch-1.5.5/Dockerfile 2025-04-29 15:02:55.000000000 +0200 @@ -0,0 +1,39 @@ +################################################################## +FROM ubuntu:22.04 AS build_stage +WORKDIR /dropwatch + +RUN apt update \ + && apt install -y \ + build-essential \ + autoconf \ + libnl-3-dev \ + libnl-genl-3-dev \ + libpcap-dev \ + libreadline-dev \ + binutils-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY . . + +RUN ./autogen.sh +RUN ./configure +RUN make + +################################################################## +FROM ubuntu:22.04 AS run_stage +WORKDIR /dropwatch + +RUN apt update \ + && apt install -y \ + libnl-3-200 \ + libnl-genl-3-200 \ + libpcap0.8 \ + libreadline8 \ + binutils \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=build_stage /dropwatch/src/dropwatch /dropwatch/dropwatch + +CMD /dropwatch/dropwatch -l kas \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/README.md new/dropwatch-1.5.5/README.md --- old/dropwatch-1.5.4/README.md 2022-04-18 14:11:10.000000000 +0200 +++ new/dropwatch-1.5.5/README.md 2025-04-29 15:02:55.000000000 +0200 @@ -47,6 +47,13 @@ make install ``` +Building and using Dropwatch in Docker +------------------ +``` +docker build -t dropwatch . +docker run -it --rm -v /usr/src:/usr/src:ro -v /lib/modules/:/lib/modules:ro -v /sys/:/sys/:rw --net=host --pid=host --privileged dropwatch +``` + Questions --------- Feel free to email me directly at [email protected] with question, or if you diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/configure.ac new/dropwatch-1.5.5/configure.ac --- old/dropwatch-1.5.4/configure.ac 2022-04-18 14:11:10.000000000 +0200 +++ new/dropwatch-1.5.5/configure.ac 2025-04-29 15:02:55.000000000 +0200 @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-or-later -AC_INIT(dropwatch,1.5.4) +AC_INIT(dropwatch,1.5.5) AC_PREREQ(2.12)dnl AC_CONFIG_HEADERS(config.h) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/spec/dropwatch.spec new/dropwatch-1.5.5/spec/dropwatch.spec --- old/dropwatch-1.5.4/spec/dropwatch.spec 2022-04-18 14:11:10.000000000 +0200 +++ new/dropwatch-1.5.5/spec/dropwatch.spec 2025-04-29 15:02:55.000000000 +0200 @@ -8,8 +8,9 @@ License: GPLv2+ Group: Applications/System BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildRequires: autoconf, automake, libtool BuildRequires: kernel-devel, libnl-devel, readline-devel -BuildRequires: binutils-devel, binutils-static pkgconfig +BuildRequires: binutils-devel, binutils-static, pkgconfig Requires: libnl, readline %description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/src/Makefile.am new/dropwatch-1.5.5/src/Makefile.am --- old/dropwatch-1.5.4/src/Makefile.am 2022-04-18 14:11:10.000000000 +0200 +++ new/dropwatch-1.5.5/src/Makefile.am 2025-04-29 15:02:55.000000000 +0200 @@ -3,7 +3,10 @@ bin_PROGRAMS = dropwatch dwdump AM_CFLAGS = -g -Wall -Werror $(LIBNL3_CFLAGS) $(LIBNLG3_CFLAGS) $(READLINE_CFLAGS) -AM_LDFLAGS = $(LIBNL3_LIBS) $(LIBNLG3_LIBS) $(READLINE_LIBS) -lpcap +AM_LDFLAGS = +ALL_LIBS = $(LIBNL3_LIBS) $(LIBNLG3_LIBS) $(READLINE_LIBS) $(LIBPCAP_LIBS) +dropwatch_LDADD = $(ALL_LIBS) +dwdump_LDADD = $(ALL_LIBS) AM_CPPFLAGS = -D_GNU_SOURCE dropwatch_SOURCES = main.c lookup.c lookup_kas.c @@ -11,5 +14,5 @@ if USE_BFD dropwatch_SOURCES += lookup_bfd.c -AM_LDFLAGS += -lbfd +dropwatch_LDADD += -lbfd endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dropwatch-1.5.4/src/lookup_kas.c new/dropwatch-1.5.5/src/lookup_kas.c --- old/dropwatch-1.5.4/src/lookup_kas.c 2022-04-18 14:11:10.000000000 +0200 +++ new/dropwatch-1.5.5/src/lookup_kas.c 2025-04-29 15:02:55.000000000 +0200 @@ -15,6 +15,7 @@ #include <stdint.h> #include <sys/utsname.h> #include <string.h> +#include <limits.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> @@ -24,8 +25,8 @@ struct symbol_entry { char *sym_name; - __u64 start; - __u64 end; + uint64_t start; + uint64_t end; LIST_ENTRY(symbol_entry) list; }; @@ -37,7 +38,7 @@ static struct sym_list sym_list_head = {NULL}; -static int lookup_kas_cache( __u64 pc, struct loc_result *location) +static int lookup_kas_cache(uint64_t pc, struct loc_result *location) { struct symbol_entry *sym; @@ -69,28 +70,54 @@ return; } -static int lookup_kas_proc(__u64 pc, struct loc_result *location) +static void kas_update_cache(__u64 start, __u64 end, char *name) +{ + struct symbol_entry *sym; + /* look for any symbol that matches our start + * if the new end is longer than the current end, extend it + */ + LIST_FOREACH(sym, &sym_list_head, list) { + if (start == sym->start) { + if (end > sym->end) { + sym->end = end; + } + return; + } + } + + /* if we get here, we didn't find a symbol, and should add it */ + kas_add_cache(start, end, name); +} + +static int lookup_kas_proc(uint64_t pc, struct loc_result *location) { FILE *pf; - __u64 ppc; - __u64 uppc, ulpc, uipc; - char *name, *last_name; + uint64_t sppc; + uint64_t min_delta, sdelta; + uint64_t sym_base_addr; + char *tgt_sym = NULL; + char *name; pf = fopen("/proc/kallsyms", "r"); if (!pf) return 1; - last_name = NULL; - uipc = pc; - ulpc = 0; + + /* + * We need to conduct a reverse price is right search here, we need to find the symbol that is less than + * pc, but by the least amount. i.e. address 0xffffffff00010 is 10 more than symbol A, at 0xffffffff00000000, + * but is only 8 more than symbol B at 0xffffffff00000002, therefore this drop occurs at symbol B+8 + */ + min_delta = LLONG_MAX; + sym_base_addr = 0; while (!feof(pf)) { /* * Each line of /proc/kallsyms is formatteded as: * - "%pK %c %s\n" (for kernel internal symbols), or * - "%pK %c %s\t[%s]\n" (for module-provided symbols) */ - if (fscanf(pf, "%llx %*s %ms [ %*[^]] ]", (unsigned long long *)&ppc, &name) < 0) { + if (fscanf(pf, "%llx %*s %ms [ %*[^]] ]", (unsigned long long *)&sppc, &name) < 0) { if (ferror(pf)) { perror("Error Scanning File: "); break; @@ -100,30 +127,30 @@ } } - uppc = (__u64)ppc; - if ((uipc >= ulpc) && - (uipc < uppc)) { - /* - * The last symbol we looked at - * was a hit, record and return it - * Note that we don't free last_name - * here, because the cache is using it - */ - kas_add_cache(ulpc, uppc-1, last_name); - fclose(pf); - free(name); - return lookup_kas_cache(pc, location); + /* don't bother with symbols that are above our target */ + if (sppc > pc) { + continue; } - /* - * Advance all our state holders - */ - free(last_name); - last_name = name; - ulpc = uppc; + sdelta = pc - sppc; + if (sdelta < min_delta) { + min_delta = sdelta; + if (tgt_sym) + free(tgt_sym); + tgt_sym = strdup(name); + sym_base_addr = sppc; + } + free(name); } fclose(pf); + + if (sym_base_addr) { + kas_update_cache(sym_base_addr, sym_base_addr + min_delta, tgt_sym); + location->symbol = tgt_sym; + location->offset = min_delta; + return 0; + } return 1; } @@ -140,8 +167,9 @@ pcv = (uintptr_t)pc; - if (!lookup_kas_cache(pcv, location)) + if (!lookup_kas_cache(pcv, location)) { return 0; + } return lookup_kas_proc(pcv, location); }
