Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
build new package for issue 1623
Browse files Browse the repository at this point in the history
  • Loading branch information
dougburks committed Apr 7, 2020
1 parent dd314d2 commit e9b6065
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
securityonion-sostat (20120722-0ubuntu0securityonion143) xenial; urgency=medium

* sostat: don't show pf_ring output if af_packet in use #1623

-- Doug Burks <[email protected]> Tue, 07 Apr 2020 05:38:30 -0400

securityonion-sostat (20120722-0ubuntu0securityonion142) xenial; urgency=medium

* sostat: don't show pf_ring output if af_packet in use #1623
Expand Down
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ update-copyright
clean-up-zeek-warnings
more-zeek-cleanup
sostat:-don't-show-pf_ring-output-if-af_packet-in-use-#1623
sostat:-don't-show-pf_ring-output-if-af_packet-in-use-#1623-again
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Description: <short summary of the patch>
TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.
.
securityonion-sostat (20120722-0ubuntu0securityonion143) xenial; urgency=medium
.
* sostat: don't show pf_ring output if af_packet in use #1623
Author: Doug Burks <[email protected]>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- securityonion-sostat-20120722.orig/bin/sostat
+++ securityonion-sostat-20120722/bin/sostat
@@ -176,26 +176,30 @@ if [ -d /nsm/sensor_data ] && [ $NUM_INT
for IFACE in $INTERFACES;do
echo "$IFACE:" && echo && echo `ifconfig $IFACE |awk '/dropped:/ {print $1,$2,$4}'` && echo ""
done
- echo "-------------------------------------------------------------------------"
- echo
- if [ -f /proc/net/pf_ring/info ] && ls /proc/net/pf_ring/*-* >/dev/null 2>&1; then
+ # sostat: don't show pf_ring output if af_packet in use #1623
+ # https://github.com/Security-Onion-Solutions/security-onion/issues/1623
+ if [ -f /proc/net/pf_ring/info ] && [ $(grep "Total rings" /proc/net/pf_ring/info | awk '{print $4}') -gt 0 ]; then
+ echo "-------------------------------------------------------------------------"
+ echo
echo "${underline}pf_ring${normal}:"
- for i in /proc/net/pf_ring/*-* ; do
- echo
- APP_NAME=`grep "Appl. Name" $i | awk '{print $4}'`
- PF_TOT_IN=`grep "Tot Packets" $i | awk '{print $4}'`
- PF_TOT_LOST=`grep "Tot Pkt Lost" $i | awk '{print $5}'`
- if [[ -n $PF_TOT_LOST ]] && [[ $PF_TOT_LOST -gt 0 ]] ; then
- PF_PERCENT_LOST=$(echo "scale=2 ; $PF_TOT_LOST * 10/$PF_TOT_IN * 10" | bc)
- else
- PF_PERCENT_LOST=0
- fi
- echo "Appl. Name: $APP_NAME"
- echo "Tot Packets: $PF_TOT_IN"
- echo "Tot Pkt Lost: $PF_TOT_LOST"
- echo "Loss as a percentage: $PF_PERCENT_LOST"
- echo
- done
+ echo
+ if [ $(ls /proc/net/pf_ring/ | wc -l) -gt 0 ]; then
+ for i in /proc/net/pf_ring/*-* ; do
+ APP_NAME=`grep "Appl. Name" $i | awk '{print $4}'`
+ PF_TOT_IN=`grep "Tot Packets" $i | awk '{print $4}'`
+ PF_TOT_LOST=`grep "Tot Pkt Lost" $i | awk '{print $5}'`
+ if [[ -n $PF_TOT_LOST ]] && [[ $PF_TOT_LOST -gt 0 ]] ; then
+ PF_PERCENT_LOST=$(echo "scale=2 ; $PF_TOT_LOST * 10/$PF_TOT_IN * 10" | bc)
+ else
+ PF_PERCENT_LOST=0
+ fi
+ echo "Appl. Name: $APP_NAME"
+ echo "Tot Packets: $PF_TOT_IN"
+ echo "Tot Pkt Lost: $PF_TOT_LOST"
+ echo "Loss as a percentage: $PF_PERCENT_LOST"
+ echo
+ done
+ fi
fi
echo "-------------------------------------------------------------------------"
echo

0 comments on commit e9b6065

Please sign in to comment.