]> xenbits.xensource.com Git - qemu-xen-3.3-testing.git/commitdiff
Set slirp client hostname.
authorpbrook <pbrook>
Sun, 16 Apr 2006 11:06:58 +0000 (11:06 +0000)
committerpbrook <pbrook>
Sun, 16 Apr 2006 11:06:58 +0000 (11:06 +0000)
qemu-doc.texi
slirp/bootp.c
slirp/libslirp.h
slirp/slirp.c
vl.c

index 7ab05206247943720c545828009620f24d237aaf..e97e51a99d8fc8d36fa094bedbf4939b1da08684 100644 (file)
@@ -262,9 +262,10 @@ Qemu can emulate several different models of network card.  Valid values for
 @code{smc91c111} and @code{lance}.  Not all devices are supported on all
 targets.
 
-@item -net user[,vlan=n]
+@item -net user[,vlan=n][,hostname=name]
 Use the user mode network stack which requires no administrator
-priviledge to run.
+priviledge to run.  @option{hotname=name} can be used to specify the client
+hostname reported by the builtin DHCP server.
 
 @item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]
 Connect the host TAP network interface @var{name} to VLAN @var{n} and
index 9f0652fd6317633ae576f73c6096bf28f70b346a..62cbcfd8f3396f0b6bcd7c4e1b690bb9dbb89547 100644 (file)
@@ -228,6 +228,14 @@ static void bootp_reply(struct bootp_t *bp)
         val = htonl(LEASE_TIME);
         memcpy(q, &val, 4);
         q += 4;
+
+        if (*slirp_hostname) {
+            val = strlen(slirp_hostname);
+            *q++ = RFC1533_HOSTNAME;
+            *q++ = val;
+            memcpy(q, slirp_hostname, val);
+            q += val;
+        }
     }
     *q++ = RFC1533_END;
     
index cff159e7917d3b67f9dfe6a041a28cd42617b821..36c8ec21fdbd4405065aaeb75ae4fae32583916b 100644 (file)
@@ -32,6 +32,7 @@ int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
                    int guest_port);
 
 extern const char *tftp_prefix;
+extern const char slirp_hostname[33];
 
 #ifdef __cplusplus
 }
index 404cce8f768b661a1771677ba883bd6e1d24e39f..28b8c887a4f97dee47233f0bb3b4a16294b71e41 100644 (file)
@@ -25,6 +25,8 @@ struct ex_list *exec_list;
 /* XXX: suppress those select globals */
 fd_set *global_readfds, *global_writefds, *global_xfds;
 
+const char slirp_hostname[33];
+
 #ifdef _WIN32
 
 static int get_dns_addr(struct in_addr *pdns_addr)
diff --git a/vl.c b/vl.c
index 8fba6e76eeef53951d40fef41818ce29902c928c..4f9b8c85484abcbf8eb0159cb0eaf7d367c4dd45 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -3151,6 +3151,11 @@ int net_client_init(const char *str)
     } else
 #ifdef CONFIG_SLIRP
     if (!strcmp(device, "user")) {
+        if (get_param_value(buf, sizeof(buf), "hostname", p)) {
+            if (strlen(buf) > 32)
+              buf[32] = 0;
+            strcpy(slirp_hostname, buf);
+        }
         ret = net_slirp_init(vlan);
     } else
 #endif
@@ -4597,8 +4602,9 @@ void help(void)
            "-net nic[,vlan=n][,macaddr=addr][,model=type]\n"
            "                create a new Network Interface Card and connect it to VLAN 'n'\n"
 #ifdef CONFIG_SLIRP
-           "-net user[,vlan=n]\n"
-           "                connect the user mode network stack to VLAN 'n'\n"
+           "-net user[,vlan=n][,hostname=host]\n"
+           "                connect the user mode network stack to VLAN 'n' and send\n"
+           "                hostname 'host' to DHCP clients\n"
 #endif
 #ifdef _WIN32
            "-net tap[,vlan=n],ifname=name\n"