debuggers.hg

view tools/ioemu/patches/xen-network @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 Index: ioemu/vl.c
2 ===================================================================
3 --- ioemu.orig/vl.c 2007-05-03 19:09:18.000000000 +0100
4 +++ ioemu/vl.c 2007-05-03 19:11:56.000000000 +0100
5 @@ -91,6 +91,7 @@
7 #include <xen/hvm/params.h>
8 #define DEFAULT_NETWORK_SCRIPT "/etc/xen/qemu-ifup"
9 +#define DEFAULT_BRIDGE "xenbr0"
10 #ifdef __sun__
11 #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
12 #else
13 @@ -3288,11 +3289,11 @@
14 #endif
16 static int net_tap_init(VLANState *vlan, const char *ifname1,
17 - const char *setup_script)
18 + const char *setup_script, const char *bridge)
19 {
20 TAPState *s;
21 int pid, status, fd;
22 - char *args[3];
23 + char *args[4];
24 char **parg;
25 char ifname[128];
27 @@ -3311,9 +3312,18 @@
28 pid = fork();
29 if (pid >= 0) {
30 if (pid == 0) {
31 + int open_max = sysconf(_SC_OPEN_MAX), i;
32 + for (i = 0; i < open_max; i++)
33 + if (i != STDIN_FILENO &&
34 + i != STDOUT_FILENO &&
35 + i != STDERR_FILENO &&
36 + i != fd)
37 + close(i);
38 +
39 parg = args;
40 *parg++ = (char *)setup_script;
41 *parg++ = ifname;
42 + *parg++ = (char *)bridge;
43 *parg++ = NULL;
44 execv(setup_script, args);
45 _exit(1);
46 @@ -3869,6 +3879,7 @@
47 if (!strcmp(device, "tap")) {
48 char ifname[64];
49 char setup_script[1024];
50 + char bridge[16];
51 int fd;
52 if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
53 fd = strtol(buf, NULL, 0);
54 @@ -3882,7 +3893,10 @@
55 if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
56 pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
57 }
58 - ret = net_tap_init(vlan, ifname, setup_script);
59 + if (get_param_value(bridge, sizeof(bridge), "bridge", p) == 0) {
60 + pstrcpy(bridge, sizeof(bridge), DEFAULT_BRIDGE);
61 + }
62 + ret = net_tap_init(vlan, ifname, setup_script, bridge);
63 }
64 } else
65 #endif
66 @@ -6101,7 +6115,7 @@
67 "-net tap[,vlan=n],ifname=name\n"
68 " connect the host TAP network interface to VLAN 'n'\n"
69 #else
70 - "-net tap[,vlan=n][,fd=h][,ifname=name][,script=file]\n"
71 + "-net tap[,vlan=n][,fd=h][,ifname=name][,script=file][,bridge=br]\n"
72 " connect the host TAP network interface to VLAN 'n' and use\n"
73 " the network script 'file' (default=%s);\n"
74 " use 'script=no' to disable script execution;\n"