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: zhengda
Subject: Re: The patch of boot to open a virtual network interface
Date: Tue, 19 Aug 2008 17:37:14 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

Neal H. Walfield wrote:
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.

Since boot only uses one interface, boot probably accepts only one interface name from subhurd.
Should the interface name always be "eth0"?

Zheng Da




reply via email to

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