<div dir="ltr">Hi Nathan,<div><br></div><div>Your patch is integrated in the 1.9.4rc1 branch in git. Please test.</div><div><br></div><div><a href="https://github.com/reubenhwk/radvd/tree/1.9.4rc1">https://github.com/reubenhwk/radvd/tree/1.9.4rc1</a><br>
</div><div><br></div><div>Thanks,</div><div>Reuben</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 2:51 PM, Reuben Hawkins <span dir="ltr"><<a href="mailto:reubenhwk@gmail.com" target="_blank">reubenhwk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Nathan,<div><br></div><div>I'll look at this in the next couple weeks. I have one other commit ready to be tested so I'll put together an alpha for the next release soon with these changes.</div>
<div><br></div><div>Thanks,</div><div>Reuben</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 23, 2013 at 12:57 AM, Nathan Hintz <span dir="ltr"><<a href="mailto:nlhintz@hotmail.com" target="_blank">nlhintz@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Reuben:<br>
<br>
When running 'top', I sometimes see RADVD consuming a lot of CPU (some<br>
times close to 50%). I put some debug statements into RADVD, and have<br>
found that RADVD listens to a netlink socket, and basically reloads the<br>
configuration file for every netlink message it receives, regardless of<br>
content. I have seen more than 60 reloads in a single second, which<br>
are generally triggered for Wireless Extension events for one of the<br>
wireless interfaces. There currently is a patch<br>
(<a href="https://dev.openwrt.org/browser/packages/ipv6/radvd/patches/100-silent-netlink-config-reload.patch" target="_blank">https://dev.openwrt.org/browser/packages/ipv6/radvd/patches/100-silent-netlink-config-reload.patch</a>)<br>
that attempts to silence the logging of the reloads, but this is really<br>
just masking the problem, and poorly at that. It seems like RADVD<br>
should be filtering the netlink messages down to what it cares about,<br>
and only then triggering the reload.<br>
<br>
I've attached a patch that seems to fix the problem; but it needs a good<br>
review. (See <a href="http://patchwork.openwrt.org/patch/3101/" target="_blank">http://patchwork.openwrt.org/patch/3101/</a>)<br>
<br>
Thanks,<br>
<br>
Nathan Hintz<br>
<br>
--- a/netlink.c<br>
+++ b/netlink.c<br>
@@ -41,7 +41,10 @@<br>
struct msghdr msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0, 0 };<br>
struct nlmsghdr *nh;<br>
struct ifinfomsg * ifinfo;<br>
+ struct rtattr *rta;<br>
+ int rta_len;<br>
char ifname[IF_NAMESIZE] = {""};<br>
+ int reloaded = 0;<br>
<br>
len = recvmsg (sock, &msg, 0);<br>
if (len == -1) {<br>
@@ -59,15 +62,26 @@<br>
}<br>
<br>
/* Continue with parsing payload. */<br>
- ifinfo = NLMSG_DATA(nh);<br>
- if_indextoname(ifinfo->ifi_index, ifname);<br>
- if (ifinfo->ifi_flags & IFF_RUNNING) {<br>
- dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is running", ifname, ifinfo->ifi_index);<br>
+ if (nh->nlmsg_type == RTM_NEWLINK || nh->nlmsg_type == RTM_DELLINK || nh->nlmsg_type == RTM_SETLINK) {<br>
+ ifinfo = (struct ifinfomsg *)NLMSG_DATA(nh);<br>
+ if_indextoname(ifinfo->ifi_index, ifname);<br>
+ rta = IFLA_RTA(NLMSG_DATA(nh));<br>
+ rta_len = nh->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg));<br>
+ for (; RTA_OK(rta, rta_len); rta = RTA_NEXT(rta, rta_len)) {<br>
+ if (rta->rta_type == IFLA_OPERSTATE || rta->rta_type == IFLA_LINKMODE) {<br>
+ if (ifinfo->ifi_flags & IFF_RUNNING) {<br>
+ dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is running", ifname, ifinfo->ifi_index);<br>
+ }<br>
+ else {<br>
+ dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is *NOT* running", ifname, ifinfo->ifi_index);<br>
+ }<br>
+ if (!reloaded) {<br>
+ reload_config(LOG_DEBUG);<br>
+ reloaded = 1;<br>
+ }<br>
+ }<br>
+ }<br>
}<br>
- else {<br>
- dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is *NOT* running", ifname, ifinfo->ifi_index);<br>
- }<br>
- reload_config(LOG_DEBUG);<br>
}<br>
}<br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>