Ryan Hao
Ryan Hao

Reputation: 21

When constantly change the mode(ap 2 sta) of hostapd, the process heap of netifd are rising

I write a script to change the hostapd mode ap to sta and sta to ap which lasts running for serval hours and the process of netifd hanged up.

cat proc/id/maps


0400000-0041f000 r-xp 00000000 1f:06 1176       /sbin/netifd
0042f000-00430000 rw-p 0001f000 1f:06 1176       /sbin/netifd
**00430000-00476000 rwxp 00000000 00:00 0          [heap]**
772af000-7730a000 r-xp 00000000 1f:06 144        /lib/libuClibc-0.9.33.2.so

00400000-0041f000 r-xp 00000000 1f:06 1176       /sbin/netifd
0042f000-00430000 rw-p 0001f000 1f:06 1176       /sbin/netifd
**00430000-00477000 rwxp 00000000 00:00 0          [heap]**
772af000-7730a000 r-xp 00000000 1f:06 144        /lib/libuClibc-0.9.33.2.so

I find that heap of the process is constantly rising. could not fix it.

Change mode of ap, hostapd will teardown and setup. and the process heap of netifd is rising.

finally it cause

netifd/wireless.c 
wireless_device_run_handler()->netifd_start_process()

netifd/main.c 
netifd_start_process()->
if ((pid = fork()) < 0)
goto error;

fork fail because

log

netifd_start_process>>>>>>>>after fork create
error on triggering 12: Cannot allocate memory

(netifd heap use more and more memories with the script running)


part of the script

uci set wireless.@wifi-iface[$1].mode="$apmode"
uci commit wireless

/sbin/wifi reload

Upvotes: 0

Views: 67

Answers (0)

Related Questions