[radvd-devel-l] [patch] Segfault under BSD with non-existent interfaces

Reuben Hawkins reubenhwk at gmail.com
Fri Jan 21 20:05:17 EST 2011


On Fri, Jan 21, 2011 at 8:49 AM, Manuel Kasper <mk at neon1.net> wrote:

> Hello,
>
> I'm using radvd under FreeBSD in conjunction with MPD (PPP daemon that
> dynamically creates a virtual interface per client). radvd 1.7 kept
> segfaulting on me after "ioctl(SIOCGIFMTU) failed for ng0: Device not
> configured" when starting with a configuration that references interfaces
> that don't exist yet.
>
> A trivial patch for device-bsd44.c is attached; perhaps it would also make
> sense to have the SIOCGIFMTU error message depend on
> !iface->IgnoreIfMissing?
>
> Regards,
>
> Manuel
>
> --
> radvd-devel-l mailing list  :  radvd-devel-l at litech.org
> http://lists.litech.org/listinfo/radvd-devel-l
>

Hi Manuel,

Your patch looks good.  I've committed it.  I've also added a check to make
sure the device name exist.  You may want to get the latest from CVS to see
if all is working as you expect.  My addition change is this...

Index: device-bsd44.c
===================================================================
RCS file: /work/cvsroot/radvd/device-bsd44.c,v
retrieving revision 1.26
diff -u -w -r1.26 device-bsd44.c
--- device-bsd44.c    22 Jan 2011 00:53:16 -0000    1.26
+++ device-bsd44.c    22 Jan 2011 01:02:23 -0000
@@ -35,6 +35,9 @@
     struct AdvPrefix *prefix;
     char zero[sizeof(iface->if_addr)];

+    if(if_nametoindex(iface->Name) == 0)
+        goto ret;
+
      memset(&ifr, 0, sizeof(ifr));
     strncpy(ifr.ifr_name, iface->Name, IFNAMSIZ-1);
     ifr.ifr_name[IFNAMSIZ-1] = '\0';

Thanks,
Reuben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litech.org/pipermail/radvd-devel-l/attachments/20110121/b94d8128/attachment.html>


More information about the radvd-devel-l mailing list