Add dynamic lookup for tcpdump binary

Currently the check will use /usr/bin/tcpdump only for Ubuntu 22.04
(jammy) but it will try to use the old /usr/sbin/tcpdump path for newer
versions of Ubuntu such as 24.04 (noble) which causes the br-ex-tcpdump
service to fail to start in jobs that enable it (like multinode):

  systemd[1]: devstack@br-ex-tcpdump.service: Main process exited,
      code=exited, status=203/EXEC

This uses 'which' to find the path and if it is not found, use the
current check in case there is anything relying on it.

Change-Id: I034e8ca87909521c7e4f3e49996144f9c80d416d
This commit is contained in:
melanie witt 2024-06-28 21:30:15 +00:00
parent 2ce9ca6cdf
commit 6be68a4158

View File

@ -117,11 +117,14 @@ if [[ "$1" == "stack" ]]; then
if is_service_enabled br-ex-tcpdump ; then
# tcpdump monitor on br-ex for ARP, reverse ARP and ICMP v4 / v6 packets
sudo ip link set dev $PUBLIC_BRIDGE up
TCPDUMP=$(which tcpdump)
if [[ ! $TCPDUMP ]]; then
if [[ "$os_CODENAME" == "jammy" ]]; then
TCPDUMP=/usr/bin/tcpdump
else
TCPDUMP=/usr/sbin/tcpdump
fi
fi
run_process br-ex-tcpdump "$TCPDUMP -i $PUBLIC_BRIDGE arp or rarp or icmp or icmp6 -enlX" "$STACK_GROUP" root
fi