Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpftune: fix library search issues on Ubuntu
add ld.so.conf.d file for /usr/lib64 for bpftune.
also fix issues with tests for ubuntu such as assuming
messages are in /var/log/messages (it's syslog for ubuntu)

Reported-by: https://github.com/twirrim
Signed-off-by: Alan Maguire <[email protected]>
  • Loading branch information
alan-maguire committed Jul 6, 2023
commit 275b6b8efc32174cddec5f023d9cfb22859cb7d9
11 changes: 10 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ INCLUDES := -I../include -I$(BPF_INCLUDE) -I$(NL_INCLUDE) -I../include/uapi

INSTALL ?= install

DESTDIR ?=
DESTDIR ?= /
prefix ?= /usr
installprefix = $(DESTDIR)/$(prefix)

INSTALLPATH = $(installprefix)

# Prefix path can be /usr, /usr/local or for packaging case
# /path2rpmbuilddir/usr[/local]. We use the /usr path as a guide
# to where to bisect the full path such that everything prior to
# it is considered to be prefix to config path /etc.
confprefix ?= $(shell echo $(prefix) | awk -F /usr '{ printf $1 "/etc" }')
CONFPATH = $(DESTDIR)/$(confprefix)/ld.so.conf.d

KERNEL_REL := $(shell uname -r)

ifeq ($(BPFTUNE_VERSION),)
Expand Down Expand Up @@ -117,6 +124,8 @@ install: $(OPATH)libbpftune.so $(OPATH)bpftune bpftune.service
$(INSTALL) -m 644 bpftune.service $(installprefix)/lib/systemd/system
$(INSTALL) -m 0755 -d $(INSTALLPATH)/lib64/bpftune
$(INSTALL) $(TUNER_LIBS) $(INSTALLPATH)/lib64/bpftune
echo $(prefix)/lib64 > $(CONFPATH)/libbpftune.conf
if [ $(DESTDIR) = / ]; then ldconfig; fi

$(OPATH)bpftune: bpftune.c $(OPATH)bpftune.o $(OPATH)libbpftune.so
$(QUIET_LINK)$(CC) $(CFLAGS) $(OPATH)bpftune.o -o $@ \
Expand Down
8 changes: 6 additions & 2 deletions test/cap_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ for BPFTUNECMD in "$BPFTUNE &" "service bpftune start" ; do

sleep $SETUPTIME

caps=$(getpcaps $(pgrep bpftune) 2>&1 | \
awk '/cap_net_admin,cap_sys_chroot,cap_sys_admin,cap_syslog[+=]p/ { print $0 }')
caps=$(getpcaps $(pgrep bpftune) 2>&1)
# awk '/[+=]p/ { print $0 }')

echo "caps: $caps"

for cap in cap_net_admin cap_sys_module cap_sys_chroot cap_sys_admin cap_syslog ; do
echo $caps | grep -E $cap >/dev/null
done

if [[ -n "$caps" ]]; then
test_pass
else
Expand Down
4 changes: 2 additions & 2 deletions test/log_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ for MODE in debug info syslog service; do
syslog)
OPTIONS="-d"
BPFTUNECMD="$BPFTUNE $OPTIONS &"
LOGFILE=/var/log/messages
LOGFILE=$SYSLOGFILE
;;
service)
BPFTUNECMD="service bpftue start"
LOGFILE=/var/log/messages
LOGFILE=$SYSLOGFILE
;;
*)
OPTIONS="-s"
Expand Down
2 changes: 1 addition & 1 deletion test/service_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
SLEEPTIME=1


LOGFILE=/var/log/messages
LOGFILE=$SYSLOGFILE

test_start "$0|service test: does enabling the service work?"

Expand Down
6 changes: 5 additions & 1 deletion test/test_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ check_prog "$IPERF3" iperf3 iperf3
export QPERF=$(which qperf 2>/dev/null)
export FIREWALL_CMD=$(which firewall-cmd 2>/dev/null)
export AUDIT_CMD=$(which auditctl 2>/dev/null)
export LOGFILE=${LOGFILE:-"/var/log/messages"}
export SYSLOGFILE=${SYSLOGFILE:-"/var/log/messages"}
if [[ ! -f $SYSLOGFILE ]]; then
export SYSLOGFILE="/var/log/syslog"
fi
export LOGFILE=$SYSLOGFILE
export BPFTUNE_LEGACY=${BPFTUNE_LEGACY:-0}
export BPFTUNE_NETNS=${BPFTUNE_NETNS:-1}

Expand Down