[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 01391) Re: question about netlink and getifaddrs



Hi folks,

Pardon me for my last mail. It's wrong to fork!! :-P
Anyway, I added fctnl(...O_NONBLOCK) into getifaddrs to overcome the
blocking.

jon.

-----Original Message-----
From: Jonathan Khoo [mailto:jonath-k@xxxxxxxxxxxxxxxxxx] 
Sent: Wednesday, April 17, 2002 6:06 PM
To: usagi-users@xxxxxxxxxxxxxx
Subject: (usagi-users 01383) question about netlink and getifaddrs


Hi guys,

I have in a program an opened NETLINK socket waiting for messages. When
I run getifaddr without closing that NETLINK socket, getifaddr will stop
at recvmsg. After tracing through both getifaddr and af_netlink, I think
the reason is because the recvmsg meant for getifaddr was sent to the
opened socket through netlink_unicast (since netlink send messages
through matching pid). I tried setting the dst_groups before the NETLINK
socket binding, but to no avail. 

I overcome the problem by doing a fork() inside getifaddr so that it is
using another pid, but I don't think it's a good solution. Does anyone
knows how to get getifaddr working without closing the NETLINK socket? 

thanks for any advices...
jon.