Bug 204593

Summary: Add a sysctl to enable display of IPv4 ICMP handling in the kernel
Product: Base System Reporter: Hellmuth Michaelis <hm>
Component: kernAssignee: freebsd-net (Nobody) <net>
Status: New ---    
Severity: Affects Some People CC: ae, emaste
Priority: --- Keywords: patch
Version: 10.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
10.2-stable unified diff for /usr/src/sys/netinet/ip_icmp.c none

Description Hellmuth Michaelis 2015-11-16 09:14:02 UTC
Created attachment 163185 [details]
10.2-stable unified diff for /usr/src/sys/netinet/ip_icmp.c

Currently it only possible to follow IPv4 ICMP handling in/of the kernel by recompiling the kernel and adding a define for "ICMPPRINTFS" to enable kernel console messages for ICMP handling in /usr/src/sys/netinet/ip_icmp.c.

The attached patch converts this into a sysctl variable "net.inet.icmp.log_icmps" to enable/disable debugging output without recompilation.

As an add-on, the FIB number is displayed for rx'd/tx'd ICMP packets.
Comment 1 Andrey V. Elsukov freebsd_committer 2015-11-16 15:37:02 UTC
(In reply to Hellmuth Michaelis from comment #0)
> Currently it only possible to follow IPv4 ICMP handling in/of the kernel by
> recompiling the kernel and adding a define for "ICMPPRINTFS" to enable
> kernel console messages for ICMP handling in /usr/src/sys/netinet/ip_icmp.c.

You can get the most of these printfs using dtrace fbt probes.
To get more, I prefer add ICMP_PROBE() dtrace probe, similar to that we have for IP, UDP and TCP.