Hello,
The patch enables boot to open the virtual network interface,
so boot can work with the multiplexer and the subhurd can connect to the
main hurd.
But the way to open the virtual network interface will be changed if the
translator that helps open the device is created.
Here is the patch:
Needed for Hurd 0.3
2008-07-29 Zheng Da <[EMAIL PROTECTED]>
*boot.c: Add an option to open the virtual network interface
diff -u boot.old/boot.c boot/boot.c
--- boot.old/boot.c 2006-03-15 00:18:34.920000000 +0100
+++ boot/boot.c 2008-08-08 06:48:48.220000000 +0200
@@ -78,6 +78,7 @@
static struct termios orig_tty_state;
static int isig;
static char *kernel_command_line;
+static char *net_device_file=NULL;
static void
init_termstate ()
@@ -110,6 +111,7 @@
mach_port_t privileged_host_port, master_device_port, defpager;
mach_port_t pseudo_master_device_port;
+mach_port_t net_device_port = MACH_PORT_NULL;
mach_port_t receive_set;
mach_port_t pseudo_console, pseudo_root;
auth_t authserver;
@@ -432,6 +434,8 @@
"Pause for user confirmation at various times during booting" },
{ "isig", 'I', 0, 0,
"Do not disable terminal signals, so you can suspend and interrupt
boot."},
+ { "net_device", 'n', "FILE", 0,
+ "connect to a virtual network interface"},
{ 0 }
};
static char args_doc[] = "BOOT-SCRIPT";
@@ -450,6 +454,8 @@
case 'I': isig = 1; break;
+ case 'n': net_device_file = arg; break;
+
case 's': case 'd':
len = strlen (bootstrap_args);
if (len >= sizeof bootstrap_args - 1)
@@ -497,6 +503,13 @@
get_privileged_ports (&privileged_host_port, &master_device_port);
+ if (net_device_file)
+ {
+ net_device_port = file_name_lookup (net_device_file, 0, 0);
+ if (net_device_port == MACH_PORT_NULL)
+ error (10, errno, "file_name_lookup %s", net_device_file);
+ }
+
defpager = MACH_PORT_NULL;
vm_set_default_memory_manager (privileged_host_port, &defpager);
@@ -964,6 +977,17 @@
*devicetype = MACH_MSG_TYPE_MAKE_SEND;
return 0;
}
+ else if (strncmp (name, "veth", 4) == 0
+ && net_device_port != MACH_PORT_NULL)
+ {
+ kern_return_t err;
+ *devicetype = MACH_MSG_TYPE_MOVE_SEND;
+ err = device_open (net_device_port, mode, name, device);
+ if (err)
+ fprintf (stderr, "open_device returns %x, %s\n",
+ err, strerror (err));
+ return err;
+ }
*devicetype = MACH_MSG_TYPE_MOVE_SEND;
return device_open (master_device_port, mode, name, device);