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,
===
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to