Date: Thu, 24 May 2012 14:24:08 +0200 From: Maryse LEVAVASSEUR <maryse.levavasseur@netasq.com> To: freebsd-current@freebsd.org, freebsd-net@freebsd.org Subject: [PATCH] IPv6 rtadvd: little optimization Message-ID: <4FBE2868.8010602@netasq.com>
next in thread | raw e-mail | index | archive | help
Hi, Since upgrading to FreeBSD 8.3, I noticed that after rtadvd starts, it does not respond to router solicitations during a quite long time. I have made a patch which speeds up rtadvd's start by making fewer calls to if_indextoname. Moreover, it will react properly in case if_indextoname fails. Would anyone object to this patch ? === Index: if.c =================================================================== --- if.c (revision 235474) +++ if.c (working copy) @@ -472,11 +472,18 @@ update_ifinfo(struct ifilist_head_t *ifi_head, int ifindex != ifm->ifm_index) continue; + /* ifname */ + if (if_indextoname(ifm->ifm_index, ifname) == NULL) { + syslog(LOG_WARNING, + "<%s> ifname not found (idx=%d)", + __func__, ifm->ifm_index); + continue; + } + /* lookup an entry with the same ifindex */ TAILQ_FOREACH(ifi, ifi_head, ifi_next) { if (ifm->ifm_index == ifi->ifi_ifindex) break; - if_indextoname(ifm->ifm_index, ifname); if (strncmp(ifname, ifi->ifi_ifname, sizeof(ifname)) == 0) break; @@ -495,15 +502,7 @@ update_ifinfo(struct ifilist_head_t *ifi_head, int ifi->ifi_ifindex = ifm->ifm_index; /* ifname */ - if_indextoname(ifm->ifm_index, ifi->ifi_ifname); - if (ifi->ifi_ifname == NULL) { - syslog(LOG_WARNING, - "<%s> ifname not found (idx=%d)", - __func__, ifm->ifm_index); - if (ifi_new) - free(ifi); - continue; - } + strncpy(ifi->ifi_ifname, ifname, IFNAMSIZ); if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, ===
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FBE2868.8010602>