"Fossies" - the Fresh Open Source Software Archive

Member "buildroot-2021.05/package/iftop/0002-Rename-pcap_filter-to-iftop_pcap_filter.patch" (6 Jun 2021, 2518 Bytes) of package /linux/privat/buildroot-2021.05.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 From 64a185ce2017e4523f4bc39a36c7aebd6d68549a Mon Sep 17 00:00:00 2001
    2 From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
    3 Date: Wed, 2 Jun 2021 08:21:04 +0200
    4 Subject: [PATCH] Rename pcap_filter to iftop_pcap_filter
    5 
    6 Rename pcap_filter to iftop_pcap_filter to fix the following static
    7 build failure:
    8 
    9 /home/buildroot/autobuild/run/instance-3/output-1/host/bin/riscv64-linux-gcc  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -static   -static -o iftop addr_hash.o edline.o hash.o iftop.o ns_hash.o options.o resolver.o screenfilter.o serv_hash.o sorted_list.o threadprof.o ui_common.o ui.o tui.o util.o addrs_ioctl.o addrs_dlpi.o dlcommon.o stringmap.o cfgfile.o vector.o  -lpcap -lpcap -L/home/buildroot/autobuild/run/instance-3/output-1/host/riscv64-buildroot-linux-musl/sysroot/usr/bin/../../../../bin/../riscv64-buildroot-linux-musl/sysroot/usr/lib -lnl-genl-3 -lnl-3 -lpthread   -lcurses
   10 /home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/riscv64-buildroot-linux-musl/10.2.0/../../../../riscv64-buildroot-linux-musl/bin/ld: /home/buildroot/autobuild/run/instance-3/output-1/host/riscv64-buildroot-linux-musl/sysroot/usr/bin/../../../../bin/../riscv64-buildroot-linux-musl/sysroot/usr/lib/libpcap.a(bpf_filter.o): in function `pcap_filter':
   11 bpf_filter.c:(.text+0x4a8): multiple definition of `pcap_filter'; iftop.o:iftop.c:(.bss+0x1a8): first defined here
   12 
   13 Fixes:
   14  - http://autobuild.buildroot.org/results/eb53ff6b031c654daec57050dec376b5c9134a81
   15 
   16 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
   17 ---
   18  iftop.c      | 6 +++---
   19  1 files changed, 3 insertions(+), 3 deletions(-)
   20 
   21 diff --git a/iftop.c b/iftop.c
   22 index aaec6aa..f89eee3 100644
   23 --- a/iftop.c
   24 +++ b/iftop.c
   25 @@ -74,7 +74,7 @@ int history_len = 1;
   26  pthread_mutex_t tick_mutex;
   27  
   28  pcap_t* pd; /* pcap descriptor */
   29 -struct bpf_program pcap_filter;
   30 +struct bpf_program iftop_pcap_filter;
   31  pcap_handler packet_handler;
   32  
   33  sig_atomic_t foad;
   34 @@ -679,12 +679,12 @@ char *set_filter_code(const char *filter) {
   35          sprintf(x, "(%s) and (ip or ip6)", filter);
   36      } else
   37          x = xstrdup("ip or ip6");
   38 -    if (pcap_compile(pd, &pcap_filter, x, 1, 0) == -1) {
   39 +    if (pcap_compile(pd, &iftop_pcap_filter, x, 1, 0) == -1) {
   40          xfree(x);
   41          return pcap_geterr(pd);
   42      }
   43      xfree(x);
   44 -    if (pcap_setfilter(pd, &pcap_filter) == -1)
   45 +    if (pcap_setfilter(pd, &iftop_pcap_filter) == -1)
   46          return pcap_geterr(pd);
   47      else
   48          return NULL;
   49 -- 
   50 2.30.2
   51