At Tue, 19 Aug 2008 15:48:11 +0200,
zhengda wrote:
> 2008-07-29 Zheng Da <[EMAIL PROTECTED]>
> 
>       * boot/boot.c (ds_device_open): Handle the request to open the virtual 
> network device.
> 
> diff -u boot.old/boot.c boot/boot.c
> --- boot.old/boot.c   2008-08-17 18:38:02.000000000 +0200
> +++ boot/boot.c       2008-08-17 18:36:40.520000000 +0200
> @@ -964,6 +964,22 @@
>        *devicetype = MACH_MSG_TYPE_MAKE_SEND;
>        return 0;
>      }
> +  else if (strncmp (name, "veth", 4) == 0)
> +    {
> +      char buf[128];
> +      mach_port_t net_device;
> +
> +      snprintf (buf, sizeof(buf), "/dev/%s", name);
> +      net_device = file_name_lookup (buf, 0, 0);
> +      if (net_device == MACH_PORT_NULL)
> +     {
> +       error (0, errno, "file_name_lookup");
> +       return errno;
> +     }
> +
> +      *devicetype = MACH_MSG_TYPE_MOVE_SEND;
> +      return device_open (net_device, mode, "eth", device);
> +    }
>  
>    *devicetype = MACH_MSG_TYPE_MOVE_SEND;
>    return device_open (master_device_port, mode, name, device);

I don't like this approach.  This allows the subhurd to access any
object in the parent hurd that boot can access.  Boot should take an
option indicating which device to use for the network interface and
only make that node available.  Moreover, you should not assume that
it is in /dev: a normal use could implement a proxy translator that
implements the network interface.

Neal



Reply via email to