SysConfig.adoc: Improve formatting/readability and fix content issues; parse_sysctl.pl: fix logic bugs.
doc/SysConfig.adoc:
- Reformatted all kernel/sysctl parameter entries into consistent
`=== param.name` sections, each followed by a monospaced
Recommended/Default/Min-Max value block, clearly separated from
the surrounding prose.
- Wrapped all terminal commands and command output (sysctl,
parse_sysctl.pl invocations, netstat, cat /proc/sys/...) in
[source,shell] code blocks instead of plain/indented text.
- Converted the "Related Links" section from a jumbled list of
titles/URLs into a proper bulleted hyperlink list.
- Converted a couple of indented pseudo-lists (TCP keepalive probe
sequence, ICMP redirect conditions) into real AsciiDoc lists.
- Removed an internal-only (Perforce Swarm) link now that this doc
is headed for the open-source SDP.
- Spell-checked and corrected numerous typos and grammar issues,
including: wrong tool name (`systemctl` -> `sysctl`), duplicated
words, subject/verb agreement, stray punctuation, and a
copy/paste error where the wmem_max description incorrectly said
"read buffer" instead of "write buffer".
- Replaced placeholder EDITME values with resolved info where
possible (e.g. linked the Red Hat whitepaper reference), left
two items marked for John Halbig's review: one open EDITME note
in tcp_timestamps, and a new EDITME requesting a Portal/KB
reference for the "SYN Cookies and WSAECONNRESET Errors" mention
(confirmed this refers to a P4 error, not a Windows Sockets
error, despite how it reads).
- Verified all remaining external links return HTTP 200 (or are
otherwise confirmed reachable; ServerFault link returns 403 to
automated/bot traffic but was manually confirmed working).
- Added the script's install path
(/p4/sdp/Server/Unix/setup/parse_sysctl.pl) to the two example
invocations, which previously only showed `./parse_sysctl.pl`
with no indication of where the script lives.
Server/Unix/setup/parse_sysctl.pl:
- Added `use strict; use warnings;` and declared `@l` with `my`
(was an undeclared global).
- Fixed CLI argument parsing: `-a` and `-h`/`-?` were matched with
unanchored substring regexes, so a sysctl-output filename that
merely contained "-a" or "-h" (e.g. "prod-a.sysctl.out",
produced by the doc's own `$(hostname -s).sysctl.out` example)
would be misinterpreted as a flag, get shifted away, and leave
the script trying (and failing) to open the wrong file. Now uses
exact/anchored matches.
- Fixed value comparisons that used `=~` (regex match) instead of
`eq` (string equality) to compare a host's current sysctl value
against the recommended value. This caused false negatives
whenever the current value happened to contain the recommended
value as a substring (e.g. current "116777216" vs recommended
"16777216"), silently skipping settings that actually needed
changing.
- Fixed a truthiness bug in the "commands to run" loop
(`unless ($k_vals{$val}{old_val})`) that caused any setting whose
*current* value was the string "0" (e.g. tcp_no_metrics_save,
rp_filter) to be dropped from the generated `sysctl -w` commands,
even though it still appeared in the printed comparison table and
clearly needed changing.
- Removed a dead/ineffective cleanup regex
(`s/\x20+\r+\n//`) that could never match because `chomp` had
already stripped the trailing newline earlier in the loop;
replaced it with an explicit `s/\r$//` immediately after `chomp`
to properly handle sysctl output files with Windows-style line
endings.
- Quoted the sysctl parameter name with `\Q...\E` when building the
match regex against sysctl output lines, so literal `.`
characters in parameter names (e.g. net.ipv4.tcp_syncookies) are
no longer treated as regex wildcards.
- Removed a duplicate `filesys.bufsize` entry in %p4d_vals (a hash,
so the duplicate silently clobbered itself and never caused
incorrect output, but was dead/confusing code).
- Verified with synthetic sysctl.out test files that: the
comparison table, generated sysctl -w commands, and -a/-h flags
all now behave correctly, and that the script runs cleanly under
`use strict; use warnings` with no errors.