diff --git a/pcp.spec b/pcp.spec index 01b7f24..92bbd11 100644 --- a/pcp.spec +++ b/pcp.spec @@ -1,6 +1,6 @@ Name: pcp Version: 6.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: System-level performance monitoring and performance management License: GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0 URL: https://pcp.io @@ -8,6 +8,7 @@ URL: https://pcp.io Source0: https://github.com/performancecopilot/pcp/releases/pcp-%{version}.src.tar.gz Patch1: redhat-issues-RHEL-17335-ss-listen.patch +Patch2: redhat-issues-RHEL-17649-ss-udp.patch %if 0%{?fedora} >= 40 || 0%{?rhel} >= 10 ExcludeArch: %{ix86} @@ -3451,6 +3452,9 @@ fi %files zeroconf -f pcp-zeroconf-files.rpm %changelog +* Wed Dec 13 2023 Nathan Scott - 6.1.1-3 +- Fix pcp-ss(1) handling of UDP packet states (RHEL-17649) + * Wed Nov 29 2023 Nathan Scott - 6.1.1-2 - Fix pcp-ss(1) default handling of listen state (RHEL-17335) - Added pcp package dependency on diffutils for diffstat(1) diff --git a/redhat-issues-RHEL-17649-ss-udp.patch b/redhat-issues-RHEL-17649-ss-udp.patch new file mode 100644 index 0000000..0b34650 --- /dev/null +++ b/redhat-issues-RHEL-17649-ss-udp.patch @@ -0,0 +1,267 @@ +commit 885ce6abd66040cb78e985013242b43e7dd5ca14 +Author: Nathan Scott +Date: Fri Dec 8 11:29:25 2023 +1100 + + pcp-ss: fix the UDP UNCONN vs LISTEN state handling + + Resolves Red Hat issue RHEL-17649 + +diff --git a/qa/1921 b/qa/1921 +index e65dc369d..94c7a7383 100755 +--- a/qa/1921 ++++ b/qa/1921 +@@ -76,6 +76,18 @@ else + cat $tmp.out >> $here/$seq.full + fi + ++pcp ss -u > $tmp.out 2>&1 ++if grep -q UNCONN $tmp.out # do not show UNCONN state by default in UDP mode ++then ++ echo Failed UDP UNCONN check ++ cat $tmp.out ++ status=1 ++ exit ++else ++ echo Passed UDP UNCONN check ++ cat $tmp.out >> $here/$seq.full ++fi ++ + pmdasockets_remove + + # success, all done +diff --git a/qa/1921.out b/qa/1921.out +index 2331de828..0f4f815fc 100644 +--- a/qa/1921.out ++++ b/qa/1921.out +@@ -8,6 +8,7 @@ Updating the PMCD control file, and notifying PMCD ... + Check network.persocket metrics have appeared ... X metrics and Y values + + Passed LISTEN check ++Passed UDP UNCONN check + + === remove sockets agent === + Culling the Performance Metrics Name Space ... +diff --git a/src/pcp/ss/pcp-ss.py b/src/pcp/ss/pcp-ss.py +index 91bb81a97..72e0607c1 100755 +--- a/src/pcp/ss/pcp-ss.py ++++ b/src/pcp/ss/pcp-ss.py +@@ -254,7 +254,8 @@ class SS(object): + if self.args.tcp and netid == "tcp": + ret = True + elif self.args.udp and netid == "udp": +- ret = True ++ state = self.valuesD["state"][inst] ++ ret = bool(state != "UNCONN" or self.args.listening) + elif self.args.unix and netid == "unix": + ret = True + elif self.args.raw and netid == "raw": +@@ -282,6 +283,9 @@ class SS(object): + return True + state = self.valuesD["state"][inst] + if self.args.listening: ++ netid = self.valuesD["netid"][inst] ++ if state == "UNCONN" and netid == 'udp': ++ return True + if state != "LISTEN": + return False + else: + +commit 2b184367378a1a69a48da09e284256ed874ffac2 +Author: Nathan Scott +Date: Fri Dec 8 11:43:24 2023 +1100 + + docs: do not document (nor accept) unimplemented pcp-ss options + + Related to Red Hat issue RHEL-17334 + +diff --git a/src/pcp/ss/pcp-ss.1 b/src/pcp/ss/pcp-ss.1 +index 9598fa8d8..69caf35ea 100644 +--- a/src/pcp/ss/pcp-ss.1 ++++ b/src/pcp/ss/pcp-ss.1 +@@ -1,6 +1,6 @@ + '\"macro stdmacro + .\" +-.\" Copyright (c) 2021 Red Hat. ++.\" Copyright (c) 2021,2023 Red Hat. + .\" + .\" This program is free software; you can redistribute it and/or modify it + .\" under the terms of the GNU General Public License as published by the +@@ -169,9 +169,9 @@ output version information + .TP 5 + \fB\-n\fP, \fB\-\-numeric\fP + don't resolve service names (currently always set) +-.TP 5 +-\fB\-r\fP, \fB\-\-resolve\fP +-resolve host names (not yet implemented) ++'\" .TP 5 ++'\" \fB\-r\fP, \fB\-\-resolve\fP ++'\" resolve host names (not yet implemented) + .TP 5 + \fB\-a\fP, \fB\-\-all\fP + display all sockets +@@ -187,60 +187,60 @@ show detailed socket information + .TP 5 + \fB\-m\fP, \fB\-\-memory\fP + show socket memory usage +-.TP 5 +-\fB\-p\fP, \fB\-\-processes\fP +-show process using socket ++'\" .TP 5 ++'\" \fB\-p\fP, \fB\-\-processes\fP ++'\" show process using socket + .TP 5 + \fB\-i\fP, \fB\-\-info\fP + show internal TCP information +-.TP 5 +-\fB\-s\fP, \fB\-\-summary\fP +-show socket usage summary +-.TP 5 +-\fB\-b\fP, \fB\-\-bpf\fP +-show bpf filter socket information +-.TP 5 +-\fB\-E\fP, \fB\-\-events\fP +-continually display sockets as they are destroyed +-.TP 5 +-\fB\-Z\fP, \fB\-\-context\fP +-display process SELinux security contexts +-.TP 5 +-\fB\-z\fP, \fB\-\-contexts\fP +-display process and socket SELinux security contexts +-.TP 5 +-\fB\-N\fP, \fB\-\-net\fP +-switch to the specified network namespace name ++'\" .TP 5 ++'\" \fB\-s\fP, \fB\-\-summary\fP ++'\" show socket usage summary ++'\" .TP 5 ++'\" \fB\-b\fP, \fB\-\-bpf\fP ++'\" show bpf filter socket information ++'\" .TP 5 ++'\" \fB\-E\fP, \fB\-\-events\fP ++'\" continually display sockets as they are destroyed ++'\" .TP 5 ++'\" \fB\-Z\fP, \fB\-\-context\fP ++'\" display process SELinux security contexts ++'\" .TP 5 ++'\" \fB\-z\fP, \fB\-\-contexts\fP ++'\" display process and socket SELinux security contexts ++'\" .TP 5 ++'\" \fB\-N\fP, \fB\-\-net\fP ++'\" switch to the specified network namespace name + .TP 5 + \fB\-4\fP, \fB\-\-ipv4\fP + display only IP version 4 sockets + .TP 5 + \fB\-6\fP, \fB\-\-ipv6\fP + display only IP version 6 sockets +-.TP 5 +-\fB\-0\fP, \fB\-\-packet\fP +-display PACKET sockets ++'\" .TP 5 ++'\" \fB\-0\fP, \fB\-\-packet\fP ++'\" display PACKET sockets + .TP 5 + \fB\-t\fP, \fB\-\-tcp\fP + display only TCP sockets +-.TP 5 +-\fB\-M\fP, \fB\-\-mptcp\fP +-display only MPTCP sockets +-.TP 5 +-\fB\-S\fP, \fB\-\-sctp\fP +-display only SCTP sockets ++'\" .TP 5 ++'\" \fB\-M\fP, \fB\-\-mptcp\fP ++'\" display only MPTCP sockets ++'\" .TP 5 ++'\" \fB\-S\fP, \fB\-\-sctp\fP ++'\" display only SCTP sockets + .TP 5 + \fB\-u\fP, \fB\-\-udp\fP + display only UDP sockets +-.TP 5 +-\fB\-d\fP, \fB\-\-dccp\fP +-display only DCCP sockets +-.TP 5 +-\fB\-w\fP, \fB\-\-raw\fP +-display only RAW sockets +-.TP 5 +-\fB\-x\fP, \fB\-\-unix\fP +-display only Unix domain sockets ++'\" .TP 5 ++'\" \fB\-d\fP, \fB\-\-dccp\fP ++'\" display only DCCP sockets ++'\" .TP 5 ++'\" \fB\-w\fP, \fB\-\-raw\fP ++'\" display only RAW sockets ++'\" .TP 5 ++'\" \fB\-x\fP, \fB\-\-unix\fP ++'\" display only Unix domain sockets + .TP 5 + \fB\-H\fP, \fB\-\-noheader\fP + Suppress header line +diff --git a/src/pcp/ss/pcp-ss.py b/src/pcp/ss/pcp-ss.py +index 72e0607c1..74952911a 100755 +--- a/src/pcp/ss/pcp-ss.py ++++ b/src/pcp/ss/pcp-ss.py +@@ -53,45 +53,42 @@ class SS(object): + p = argparse.ArgumentParser() + p.add_argument('-V', '--version', action='store_true', help='output version information') + p.add_argument('-n', '--numeric', action='store_true', help='don\'t resolve service names or port names (currently always set)') +- p.add_argument('-r', '--resolve', action='store_true', help='resolve host names (currently never set)') ++ #p.add_argument('-r', '--resolve', action='store_true', help='resolve host names (currently never set)') + p.add_argument('-a', '--all', action='store_true', help='display both listening and non-listening states') + p.add_argument('-l', '--listening', action='store_true', default=False, help='display only listening sockets') + p.add_argument('-o', '--options', action='store_true', help='show timer information') + p.add_argument('-e', '--extended', action='store_true', help='show detailed socket information') + p.add_argument('-m', '--memory', action='store_true', help='show socket memory usage') +- p.add_argument('-p', '--processes', action='store_true', help='show process using socket (not yet implemented)') ++ #p.add_argument('-p', '--processes', action='store_true', help='show process using socket (not yet implemented)') + p.add_argument('-i', '--info', action='store_true', help='show internal TCP information') +- p.add_argument('-s', '--summary', action='store_true', help='show socket usage summary (not yet implemented)') +- p.add_argument('-b', '--bpf', action='store_true', help='show bpf filter socket information (not yet implemented)') +- p.add_argument('-E', '--events', action='store_true', help='continually display sockets as they are destroyed (not implemented)') +- p.add_argument('-Z', '--context', action='store_true', help='display process SELinux security contexts (not implemented)') +- p.add_argument('-z', '--contexts', action='store_true', help='display process and socket SELinux security contexts (not implemented)') +- p.add_argument('-N', '--net', action='store_true', help='switch to the specified network namespace name (not implemented)') ++ #p.add_argument('-s', '--summary', action='store_true', help='show socket usage summary (not yet implemented)') ++ #p.add_argument('-b', '--bpf', action='store_true', help='show bpf filter socket information (not yet implemented)') ++ #p.add_argument('-E', '--events', action='store_true', help='continually display sockets as they are destroyed (not implemented)') ++ #p.add_argument('-Z', '--context', action='store_true', help='display process SELinux security contexts (not implemented)') ++ #p.add_argument('-z', '--contexts', action='store_true', help='display process and socket SELinux security contexts (not implemented)') ++ #p.add_argument('-N', '--net', action='store_true', help='switch to the specified network namespace name (not implemented)') + p.add_argument('-4', '--ipv4', action='store_true', help='display only IP version 4 sockets') + p.add_argument('-6', '--ipv6', action='store_true', help='display only IP version 6 sockets') +- p.add_argument('-0', '--packet', action='store_true', help='display PACKET sockets (not implemented)') ++ #p.add_argument('-0', '--packet', action='store_true', help='display PACKET sockets (not implemented)') + p.add_argument('-t', '--tcp', action='store_true', help='display only TCP sockets') +- p.add_argument('-M', '--mptcp', action='store_true', help='display only MPTCP sockets (not implemented)') +- p.add_argument('-S', '--sctp', action='store_true', help='display only SCTP sockets (not implemented)') ++ #p.add_argument('-M', '--mptcp', action='store_true', help='display only MPTCP sockets (not implemented)') ++ #p.add_argument('-S', '--sctp', action='store_true', help='display only SCTP sockets (not implemented)') + p.add_argument('-u', '--udp', action='store_true', help='display only UDP sockets') +- p.add_argument('-d', '--dccp', action='store_true', help='display only DCCP sockets (not implemented)') +- p.add_argument('-w', '--raw', action='store_true', help='display only RAW sockets (not implemented)') +- p.add_argument('-x', '--unix', action='store_true', help='display only Unix domain sockets (not implemented)') ++ #p.add_argument('-d', '--dccp', action='store_true', help='display only DCCP sockets (not implemented)') ++ #p.add_argument('-w', '--raw', action='store_true', help='display only RAW sockets (not implemented)') ++ #p.add_argument('-x', '--unix', action='store_true', help='display only Unix domain sockets (not implemented)') + p.add_argument('-H', '--noheader', action='store_true', help='Suppress header line') + p.add_argument('-O', '--oneline', action='store_true', help='print each socket\'s data on a single line') + args = p.parse_args() + + # special cases +- if not (args.tcp or args.udp or args.mptcp or args.sctp or args.packet or args.dccp or args.raw or args.unix): +- args.tcp = args.udp = args.mptcp = args.sctp = args.packet = args.dccp = args.raw = args.unix = True ++ if not (args.tcp or args.udp): # or args.mptcp or args.sctp or args.packet or args.dccp or args.raw or args.unix): ++ args.tcp = args.udp = True # args.mptcp = args.sctp = args.packet = args.dccp = args.raw = args.unix = True + + if not (args.ipv4 or args.ipv6): + # default to both ipv4 and ipv6, subject to the prevailing filter + args.ipv4 = args.ipv6 = True + +- if args.events or args.context or args.contexts or args.net or args.summary or args.processes: +- print("Warning: --events, --context --net, --summary and --processes options are not implemented") +- + return args + + def connect(self):