Am 20.06.13 15:32, schrieb Jonathan K. Bullard:
> A minor problem is that for each of the 255 attempts to get a utun
> device (device #0 through device #254), it generates the following
> warning message:
>      Opening utun (ioctl(CTLIOCGINFO)): No such file or directory
> It's ugly, but cosmetic. Perhaps it could be displayed only at verb=4
> and higher? (I don't know how to do that.)

I have changed the patch to only try to open that once in case of early
initialization failure. I also change the log level to M_INFO.

>
> The larger problem is that it still fails to connect, with the error message:
>      Error retrieving utun interface name: Bad file descriptor (errno=9)
>
> I think this is because open_darwin_utun ignores the error (fd == -1)
> returned from utun_open_helper.
fd == -1 was overloaded in
 - utun failed to open at all
 - this specific utun failed (like utun1, utun2, ....)
>
> If so, it can be fixed by changing open_darwin_utun as follows:
>
>      else
>      {
>          fd = utun_open_helper (ctlInfo, utunnum);
>      }
>
> +    if (fd==-1)
> +       tt->is_utun = false;
> +       return;
> +
>      /* Retrieve the assigned interface name. */
>      if (getsockopt (fd, SYSPROTO_CONTROL, UTUN_OPT_IFNAME, utunname,
> &utunname_len))
>          msg (M_ERR | M_ERRNO, "Error retrieving utun interface name");
>
>      tt->actual_name = string_alloc (utunname, NULL);
>
> (I added the " tt->is_utun = false;" just to be sure; I'm not clear on
> the initialization of tt->is_utun, and it is used in the test that
> follows the call to open_darwin_utun to test for success/failure.)
>
Thanks for spotting this.

Arne

Reply via email to