Commit Graph
52 Commits
Author SHA1 Message Date
Alfonso Acosta 2be26e2be4 Limit connections to established and half-closed 2017-01-10 15:35:32 +00:00
Alfonso Acosta 89a0ab6799 Fix test data and improve /proc/net/tcp header parsing
The header checking code was unsafe because:

1. It was accessing the byteslice at [2] without ensuring a length >= 3
2. It was assuming that the indentation of the 'sl' header is always 2 (which seems to be the case in recent kernels https://github.com/torvalds/linux/blob/8f18e4d03ed8fa5e4a300c94550533bd8ce4ff9a/net/ipv4/tcp_ipv4.c#L2304 and https://github.com/torvalds/linux/blob/8f18e4d03ed8fa5e4a300c94550533bd8ce4ff9a/net/ipv6/tcp_ipv6.c#L1831 ) but it's more robust to simply trim the byteslice.
2017-01-04 00:27:16 +00:00
Alfonso Acosta 99a7dc3b9a Fix tests 2017-01-03 23:34:32 +00:00
Alfonso Acosta a8b4e65b5c Make linter happy 2017-01-03 22:55:28 +00:00
Alfonso Acosta 7716d96810 Report persistent connections in states other than ESTABLISHED
This aligns the `/proc` connection tracking (persistent connections) with
conntrack (short-lived connections).
2017-01-03 18:38:02 +00:00
Alfonso Acosta 5c3ea83846 Fix minor typo 2017-01-02 14:28:22 +00:00
Alfonso Acosta dfb52f0d93 Clarify even further that proc/PID/net/tcp varies by namespace 2017-01-02 14:27:37 +00:00
Alfonso Acosta 07aee0ed97 Merge pull request #2020 from kinvolk/alban/fix-getWalkedProcPid
procspy: use a Reader to copy the background reader buffer
2016-12-07 12:53:53 +01:00
Jonathan Lange 1020fc5f85 Use test.Diff from common 2016-12-07 11:22:40 +00:00
Jonathan Lange b5c750ddea Move test & fs 2016-12-07 11:22:39 +00:00
Jonathan Lange e8085b01b6 Use 'common' library 2016-12-07 11:22:38 +00:00
Alban Crequy 543f3d5bdc procspy: use a Reader to copy the background reader buffer
getWalkedProcPid() reads latestBuf every 3 seconds (for each report).
But performWalk() writes latestBuf every 10 seconds or so. So we need to
be able to read the same buffer several times.
2016-12-05 18:12:11 +01:00
Alfonso Acosta 3892273096 Append namespace to endpoint scope for loopback connections 2016-08-10 10:43:04 +00:00
Paul Bellamy b970b0561b Set the memory and open files maximums
process memory limit is not cgroup-aware
2016-04-06 13:07:55 +01:00
Tom Wilkie 7e2e4c9c45 Fix spelling mistakes in the codebase. 2016-03-23 10:51:27 +00:00
Paul Bellamy 0a910b422d only check the first two segments of the kernel version 2016-03-15 13:20:15 +00:00
Alfonso Acosta d4b114daea Review comments 2016-02-09 10:39:51 +00:00
Alfonso Acosta dfc136904c Review feedback 2016-02-09 10:00:04 +00:00
Alfonso Acosta eb52adbbec Raise maximum rate limit 2016-02-08 22:29:54 +00:00
Alfonso Acosta 0545d9a5c2 Fix variable scope bug 2016-02-08 21:04:26 +00:00
Alfonso Acosta 53bc710c4e Review feedback 2016-02-08 19:28:54 +00:00
Alfonso Acosta 3dd2d45fe5 Review feedback 2016-02-08 13:42:55 +00:00
Alfonso Acosta b08c427618 Make linter happy 2016-02-08 13:42:55 +00:00
Alfonso Acosta 08969ec154 Clarify rate-limiting further 2016-02-08 13:42:55 +00:00
Alfonso Acosta ccabaf5e6a Use uint64 for fd counter 2016-02-08 13:42:55 +00:00
Alfonso Acosta c09ad9e4f6 Adjust file descript rate-limit block 2016-02-08 13:42:54 +00:00
Alfonso Acosta 8c3c8994b1 Use levelled logging 2016-02-08 13:42:54 +00:00
Alfonso Acosta 6240187333 Fix tests 2016-02-08 13:42:54 +00:00
Alfonso Acosta b93c3232cd Make linter happy 2016-02-08 13:42:53 +00:00
Alfonso Acosta d4c68f48fa Get rid of the package-level Connections func 2016-02-08 13:42:53 +00:00
Alfonso Acosta 6deeca0380 Cleanup 2016-02-08 13:42:53 +00:00
Alfonso Acosta 87dd43f782 Batch rate-limit to stats of /proc/*/fd/* 2016-02-08 13:42:53 +00:00
Alfonso Acosta f922ea19c8 Rate-limit reading proc files
Use a reader in the background, dynamically rate-limited, reading the required
files in a loop
2016-02-08 13:42:52 +00:00
Alfonso Acosta 3d94082b07 Add debug logging 2016-02-05 16:58:40 +00:00
Alfonso Acosta 3605407519 Fix tests 2016-02-03 16:02:16 +00:00
Alfonso Acosta 0ec71e3af7 Minimize race between proc's net/tcp{,6} and fd/* 2016-02-03 12:20:41 +00:00
Alfonso Acosta e78a64fa15 Fix compilation in darwin 2016-02-02 21:40:27 +00:00
Alfonso Acosta f1ac5f102f Fix net namespace reading in pre-3.8 kernels 2016-02-02 17:53:24 +00:00
Alfonso Acosta 8aa22436c3 Fix reading of network namespace inodes 2016-02-01 16:32:52 -08:00
Tom Wilkie e9e152b9a3 Use argv[0] for process name to be more like ps. 2016-01-06 11:55:34 +00:00
Tom Wilkie caff695f96 Gather per-process CPU and memory metrics. 2015-12-16 14:38:21 +00:00
Tom Wilkie bc8f86a75f Merge pull request #751 from weaveworks/testing
Add some more testing to procspy
2015-12-15 17:56:41 +00:00
Tom Wilkie 550f21511a We need to read /proc/PID/net/tcp6 to see the pids for the server end of local connections. 2015-12-15 13:38:30 +00:00
Tom Wilkie 8024827f76 Add some more testing to procspy 2015-12-11 13:01:59 +00:00
Tom Wilkie a2862baf33 Don't list fds if there are not connections in the net namespace. 2015-12-11 10:27:27 +00:00
Tom Wilkie cc90c6c95d Don't read tcp6 file (we don't deal with ipv6 anywhere else). 2015-12-11 10:27:26 +00:00
Tom Wilkie 1fcd079563 Use Readdirnames to reduce number of stats we're doing. 2015-12-10 14:43:40 +00:00
Tom Wilkie cc5935a89d Review feedback 2015-12-10 14:10:36 +00:00
Tom Wilkie ed6c4088fa Fix up tests. 2015-12-10 14:00:43 +00:00
Tom Wilkie e15fe2b747 Use caching proc walker in procspy. 2015-12-10 14:00:42 +00:00