Revision 115defd1

b/qemu-doc.texi
262 262
@code{smc91c111} and @code{lance}.  Not all devices are supported on all
263 263
targets.
264 264

  
265
@item -net user[,vlan=n]
265
@item -net user[,vlan=n][,hostname=name]
266 266
Use the user mode network stack which requires no administrator
267
priviledge to run.
267
priviledge to run.  @option{hotname=name} can be used to specify the client
268
hostname reported by the builtin DHCP server.
268 269

  
269 270
@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]
270 271
Connect the host TAP network interface @var{name} to VLAN @var{n} and
b/slirp/bootp.c
228 228
        val = htonl(LEASE_TIME);
229 229
        memcpy(q, &val, 4);
230 230
        q += 4;
231

  
232
        if (*slirp_hostname) {
233
            val = strlen(slirp_hostname);
234
            *q++ = RFC1533_HOSTNAME;
235
            *q++ = val;
236
            memcpy(q, slirp_hostname, val);
237
            q += val;
238
        }
231 239
    }
232 240
    *q++ = RFC1533_END;
233 241
    
b/slirp/libslirp.h
32 32
                   int guest_port);
33 33

  
34 34
extern const char *tftp_prefix;
35
extern const char slirp_hostname[33];
35 36

  
36 37
#ifdef __cplusplus
37 38
}
b/slirp/slirp.c
25 25
/* XXX: suppress those select globals */
26 26
fd_set *global_readfds, *global_writefds, *global_xfds;
27 27

  
28
const char slirp_hostname[33];
29

  
28 30
#ifdef _WIN32
29 31

  
30 32
static int get_dns_addr(struct in_addr *pdns_addr)
b/vl.c
3151 3151
    } else
3152 3152
#ifdef CONFIG_SLIRP
3153 3153
    if (!strcmp(device, "user")) {
3154
        if (get_param_value(buf, sizeof(buf), "hostname", p)) {
3155
            if (strlen(buf) > 32)
3156
              buf[32] = 0;
3157
            strcpy(slirp_hostname, buf);
3158
        }
3154 3159
        ret = net_slirp_init(vlan);
3155 3160
    } else
3156 3161
#endif
......
4597 4602
           "-net nic[,vlan=n][,macaddr=addr][,model=type]\n"
4598 4603
           "                create a new Network Interface Card and connect it to VLAN 'n'\n"
4599 4604
#ifdef CONFIG_SLIRP
4600
           "-net user[,vlan=n]\n"
4601
           "                connect the user mode network stack to VLAN 'n'\n"
4605
           "-net user[,vlan=n][,hostname=host]\n"
4606
           "                connect the user mode network stack to VLAN 'n' and send\n"
4607
           "                hostname 'host' to DHCP clients\n"
4602 4608
#endif
4603 4609
#ifdef _WIN32
4604 4610
           "-net tap[,vlan=n],ifname=name\n"

Also available in: Unified diff