bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The patch of boot to open a virtual network interface


From: Neal H. Walfield
Subject: Re: The patch of boot to open a virtual network interface
Date: Tue, 19 Aug 2008 15:53:45 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/21.4 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Tue, 19 Aug 2008 15:48:11 +0200,
zhengda wrote:
> 2008-07-29 Zheng Da <zhengda1936@gmail.com>
> 
>       * 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

[Prev in Thread] Current Thread [Next in Thread]