]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixes interface names on BSD systems.
authorOndrej Zajicek <santiago@crfreenet.org>
Sat, 8 Jan 2011 10:22:38 +0000 (11:22 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Sat, 8 Jan 2011 10:22:38 +0000 (11:22 +0100)
sysdep/bsd/krt-sock.c

index 53b30ca453a3f1d6ae3cf3e84e4ac15aa048cfb6..0e96f410a46352fe10ab93f3b285ab393cffadb0 100644 (file)
@@ -412,7 +412,6 @@ krt_read_ifinfo(struct ks_msg *msg)
   struct sockaddr_dl *dl = NULL;
   unsigned int i;
   struct iface *iface = NULL, f;
-  char *ifname = "(none)";
   int fl = ifm->ifm_flags;
 
   for(i = 1; i!=0; i <<= 1)
@@ -434,18 +433,17 @@ krt_read_ifinfo(struct ks_msg *msg)
     return;
   }
 
-  if(dl) ifname = dl->sdl_data;
-
   iface = if_find_by_index(ifm->ifm_index);
 
   if(!iface)
   {
     /* New interface */
     if(!dl) return;    /* No interface name, ignoring */
-    DBG("New interface \"%s\" found", ifname);
+
     bzero(&f, sizeof(f));
     f.index = ifm->ifm_index;
-    strncpy(f.name, ifname, sizeof(f.name) -1);
+    memcpy(f.name, dl->sdl_data, MIN(sizeof(f.name)-1, dl->sdl_nlen));
+    DBG("New interface '%s' found", f.name);
   }
   else
   {