[PATCH] Have netstat test for sctp kernel support

Sean Mahood smahood at uwaterloo.ca
Tue Oct 25 18:41:09 UTC 2011


Hello,

I noticed that when doing a netstat -s (running on a kernel without  
SCTP support compiled in), I get the following message output to stderr:

netstat: sysctl: net.inet.sctp.stats: No such file or directory

Wondering why it would attempt to fetch SCTP stats when it was  
compiled out of the kernel, I noted that netstat could be compiled  
without SCTP support as well, but that there is no good way to link  
the two compilation conditions, or to have a generic binary that can  
run without error regardless of compiled kernel options.

To that end, I added a method to check for environment compatibility  
in netstat. For SCTP specifically, I used the FEATURE macros and added  
SCTP as a FEATURE.

Other protocols could also be configured to be checked at runtime if  
desired, though I haven't implemented any others at this time.

-- Sean



-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c.diff
Type: text/x-patch
Size: 5438 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20111025/97e3db8d/main.c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: netstat.h.diff
Type: text/x-patch
Size: 449 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20111025/97e3db8d/netstat.h.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sctp.c.diff
Type: text/x-patch
Size: 396 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20111025/97e3db8d/sctp.c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sctp_sysctl.c.diff
Type: text/x-patch
Size: 342 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20111025/97e3db8d/sctp_sysctl.c.bin


More information about the freebsd-net mailing list