CONFIG_ELOOP_POLL breaks wpa_supplicant new dbus interface on kernel 4.0.0-rc3

Anders Holm anders.holm
Wed Mar 18 23:49:27 PDT 2015


Hi,

I noticed (using version 2.3, but the code looks the same in git master) 
that if I configure wpa_supplicant using CONFIG_ELOOP_POLL I never get 
any replies through the dbus interface. A quick look through the last 
few months of the mailing list and git log did not turn up a mention of 
this.

The problem is that epoll_ctl is called twice with EPOLL_CTL_ADD for the 
dbus socket.

 From strace
epoll_ctl(3, EPOLL_CTL_ADD, 5, {EPOLLERR|EPOLLHUP, {u32=5, u64=5}}) = 0
epoll_ctl(3, EPOLL_CTL_ADD, 5, {EPOLLIN, {u32=5, u64=5}}) = -1 EEXIST 
(File exists)
write(1, "eloop_sock_table_add_sock: epoll"..., 
71eloop_sock_table_add_sock: epoll_ctl(ADD) for fd=5 failed. File exists
) = 71

The second EPOLL_CTL_ADD fails (which means that incoming dbus calls 
will not be noticed) because the socket has already been added once. 
This is how epoll_ctl is supposed to work:
http://man7.org/linux/man-pages/man2/epoll_ctl.2.html

The cause is eloop_register_sock being called (at least) twice in 
add_watch (dbus_common.c:100) to add polling events

eloop_register_sock(fd, EVENT_TYPE_EXCEPTION,...
eloop_register_sock(fd, EVENT_TYPE_READ...

These probably need to be combined somehow or eloop_register_sock needs 
to use EPOLL_CTL_MOD when the sock is added again.

I haven't tested this on any earlier kernel versions, so I do not know 
if the kernel used to accept adding a file descriptor twice.

	/Anders
	
-- 
Anders Holm



More information about the Hostap mailing list