I am trying to compile my own Linux for embededd devices, using the OpenWRT distribution. I am trying to get some Multicast information using the /proc/net/netstat interface but it is not found (normally this is available on my desktop).

If I am right this should be enabled in the kernel_menuconfig but I am not able to find any option related to this.

UPDATE: i was trying with kernel 3.10.49and 4.4.14. In both cases proc.c is compiled (proc.o is available in my build_dir, /proc is mounted, but /proc/net/netstat does not exists.

  • Which what kernel version(s) are you working? Feb 10, 2017 at 16:55
  • I am using kernel version 3.10.49
    – molnarg
    Feb 10, 2017 at 19:06
  • Do you see anything in /proc? Is it mounted? In 4.9.6 /proc/net/netstat is implemented in net/ipv4/proc.c. Would there be some reason that's not getting compiled in your case? Feb 10, 2017 at 19:31
  • @AndyDalton the /proc is mounted, and many files also exists (i.e. /proc/net/udp) I have checked my build_dir and net/ipv4/proc.o is compiled. And you are right, there are entries in the proc.cfor creating the /proc/net/netstatentry, but havent find any macro which can exclude this during compiling the kernel.
    – molnarg
    Feb 11, 2017 at 13:27

2 Answers 2


After a while I have just returned to this issue, and finally solved it. The problem is, that OpenWRT is pathcing the kernel source, and an extra option should be disabled, namely the CONFIG_PROC_STRIPPED. This is located in

(make) kernel_menuconfig -> File systems -> Pseudo filesystems -> [ ] Strip non-essential /proc functionality to reduce code size

The way it was figured out is looking at the patched version of kernel source, not the official one. Thank you for all the effort you made!


/proc/net/netstat is generated by net/ipv4/proc.c.
net/ipv4/proc.c in the ip_proc_init_net() function, it is generated as proc_create() like the following source.
enter image description here

You said that net/ipv4/proc.o was compiled.
As shown in the source, net/ipv4/proc.c creates /proc/net/sockstat,netstat and snmp.
The /proc/net/udp have created is generated by net/ipv4/udp.c.

First look for sockstat and snmp in /proc/net/ .
Also, make sure that the ip_proc_init_net () function in net/ipv4/proc.c has generated an error with the proc_create() function.
If an error occurs in that part, you must find the cause of the error.

  • @KwonTaeYoung Thank you for your answer. I have deleted proc.o and recompiled my kernel with high debuglevel. There was no error, it just compiled fine CC net/ipv4/proc.o I was going through my /proc/net directory again, and found that /proc/net/sockstat6 exists, but/proc/net/sockstat is also missing (same with snmp6 and snmp`).
    – molnarg
    Feb 14, 2017 at 9:47
  • @GABIKA6 Check whether the proc_create () of net/proc/ipv4.c is executed normally. ex) printk(). Even if the compile is done, it may not work if an error occurred in proc_create().
    – DonBit
    Feb 14, 2017 at 9:56
  • no error noticed neither during compile time, nor during booting the device
    – molnarg
    Feb 16, 2017 at 2:33
  • @GABIKA6 Did you check pritnk() further? remove_proc_entry(" netstat ", net-> proc_net); Please check OK. net/ipv4/proc.c total 2 is now.
    – DonBit
    Feb 16, 2017 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.