[radvd-devel-l] RADVD Excessive Reloading of Configuration File

Reuben Hawkins reubenhwk at gmail.com
Mon Sep 9 08:47:43 EDT 2013


Hi Nathan,

Your patch is integrated in the 1.9.4rc1 branch in git.  Please test.

https://github.com/reubenhwk/radvd/tree/1.9.4rc1

Thanks,
Reuben


On Mon, Aug 26, 2013 at 2:51 PM, Reuben Hawkins <reubenhwk at gmail.com> wrote:

> Thanks Nathan,
>
> 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.
>
> Thanks,
> Reuben
>
>
> On Fri, Aug 23, 2013 at 12:57 AM, Nathan Hintz <nlhintz at hotmail.com>wrote:
>
>>
>> Hi Reuben:
>>
>> When running 'top', I sometimes see RADVD consuming a lot of CPU (some
>> times close to 50%).  I put some debug statements into RADVD, and have
>> found that RADVD listens to a netlink socket, and basically reloads the
>> configuration file for every netlink message it receives, regardless of
>> content.  I have seen more than 60 reloads in a single second, which
>> are generally triggered for Wireless Extension events for one of the
>> wireless interfaces.  There currently is a patch
>> (
>> https://dev.openwrt.org/browser/packages/ipv6/radvd/patches/100-silent-netlink-config-reload.patch
>> )
>> that attempts to silence the logging of the reloads, but this is really
>> just masking the problem, and poorly at that.  It seems like RADVD
>> should be filtering the netlink messages down to what it cares about,
>> and only then triggering the reload.
>>
>> I've attached a patch that seems to fix the problem; but it needs a good
>> review. (See http://patchwork.openwrt.org/patch/3101/)
>>
>> Thanks,
>>
>> Nathan Hintz
>>
>> --- a/netlink.c
>> +++ b/netlink.c
>> @@ -41,7 +41,10 @@
>>         struct msghdr msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0,
>> 0 };
>>         struct nlmsghdr *nh;
>>         struct ifinfomsg * ifinfo;
>> +       struct rtattr *rta;
>> +       int rta_len;
>>         char ifname[IF_NAMESIZE] = {""};
>> +       int reloaded = 0;
>>
>>         len = recvmsg (sock, &msg, 0);
>>         if (len == -1) {
>> @@ -59,15 +62,26 @@
>>                 }
>>
>>                 /* Continue with parsing payload. */
>> -               ifinfo = NLMSG_DATA(nh);
>> -               if_indextoname(ifinfo->ifi_index, ifname);
>> -               if (ifinfo->ifi_flags & IFF_RUNNING) {
>> -                       dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is
>> running", ifname, ifinfo->ifi_index);
>> +               if (nh->nlmsg_type == RTM_NEWLINK || nh->nlmsg_type ==
>> RTM_DELLINK || nh->nlmsg_type == RTM_SETLINK) {
>> +                       ifinfo = (struct ifinfomsg *)NLMSG_DATA(nh);
>> +                       if_indextoname(ifinfo->ifi_index, ifname);
>> +                       rta = IFLA_RTA(NLMSG_DATA(nh));
>> +                       rta_len = nh->nlmsg_len -
>> NLMSG_LENGTH(sizeof(struct ifinfomsg));
>> +                       for (; RTA_OK(rta, rta_len); rta = RTA_NEXT(rta,
>> rta_len)) {
>> +                               if (rta->rta_type == IFLA_OPERSTATE ||
>> rta->rta_type == IFLA_LINKMODE) {
>> +                                       if (ifinfo->ifi_flags &
>> IFF_RUNNING) {
>> +                                               dlog(LOG_DEBUG, 3, "%s,
>> ifindex %d, flags is running", ifname, ifinfo->ifi_index);
>> +                                       }
>> +                                       else {
>> +                                               dlog(LOG_DEBUG, 3, "%s,
>> ifindex %d, flags is *NOT* running", ifname, ifinfo->ifi_index);
>> +                                       }
>> +                                       if (!reloaded) {
>> +                                               reload_config(LOG_DEBUG);
>> +                                               reloaded = 1;
>> +                                       }
>> +                               }
>> +                       }
>>                 }
>> -               else {
>> -                       dlog(LOG_DEBUG, 3, "%s, ifindex %d, flags is
>> *NOT* running", ifname, ifinfo->ifi_index);
>> -               }
>> -               reload_config(LOG_DEBUG);
>>         }
>>  }
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litech.org/pipermail/radvd-devel-l/attachments/20130909/af3e7315/attachment.html>


More information about the radvd-devel-l mailing list