From 84009d7df271fbabe9e67b502843b40ebabc21ed Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Sat, 21 Jun 2014 13:26:32 +0100
Subject: [PATCH] [networking] avoid Cisco cdp paths in /proc and /sys

Cisco Discovery Protocol for Linux includes a proprietary kernel
module that creates giant files under /proc/net/cdp and
/sys/net/cdp. Add these locations to the forbidden paths list.
---
 sos/plugins/networking.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index fec94ae..98a7ab5 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -63,9 +63,16 @@ class networking(sos.plugintools.PluginBase):
             self.writeTextToCommand(cmd,"IPTables module "+tablename+" not loaded\n")
 
     def setup(self):
+        # Work around the fact that /proc/net is now a symbolic link. We need
+        # to pass the trailing '/' here to force addCopySpec() to treat the path
+        # as a directory but this then causes the path comparison used by the
+        # addForbiddenPath() logic to fail due to the repeated '/'. Avoid this by
+        # duplicating the '/' in the addForbiddenPath calls.
         self.addCopySpec("/proc/net/")
         self.addForbiddenPath("/proc/net//rpc/*/channel")
         self.addForbiddenPath("/proc/net//rpc/*/flush")
+        self.addForbiddenPath("/proc/net//cdp")
+        self.addForbiddenPath("/sys/net/cdp")
         self.addCopySpec("/etc/nsswitch.conf")
         self.addCopySpec("/etc/yp.conf")
         self.addCopySpec("/var/yp/bindings")
-- 
1.9.3

