Add -bootp option for slirp, by Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2439 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
		
							parent
							
								
									5f189496c4
								
							
						
					
					
						commit
						47d5d01a45
					
				@ -452,6 +452,16 @@ guest must be configured in binary mode (use the command @code{bin} of
 | 
				
			|||||||
the Unix TFTP client). The host IP address on the guest is as usual
 | 
					the Unix TFTP client). The host IP address on the guest is as usual
 | 
				
			||||||
10.0.2.2.
 | 
					10.0.2.2.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@item -bootp file
 | 
				
			||||||
 | 
					When using the user mode network stack, broadcast @var{file} as the BOOTP
 | 
				
			||||||
 | 
					filename.  In conjunction with @option{-tftp}, this can be used to network boot
 | 
				
			||||||
 | 
					a guest from a local directory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Example (using pxelinux):
 | 
				
			||||||
 | 
					@example
 | 
				
			||||||
 | 
					qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
 | 
				
			||||||
 | 
					@end example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@item -smb dir
 | 
					@item -smb dir
 | 
				
			||||||
When using the user mode network stack, activate a built-in SMB
 | 
					When using the user mode network stack, activate a built-in SMB
 | 
				
			||||||
server so that Windows OSes can access to the host files in @file{dir}
 | 
					server so that Windows OSes can access to the host files in @file{dir}
 | 
				
			||||||
 | 
				
			|||||||
@ -38,6 +38,8 @@ typedef struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
BOOTPClient bootp_clients[NB_ADDR];
 | 
					BOOTPClient bootp_clients[NB_ADDR];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char *bootp_filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
 | 
					static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef DEBUG
 | 
					#ifdef DEBUG
 | 
				
			||||||
@ -168,6 +170,10 @@ static void bootp_reply(struct bootp_t *bp)
 | 
				
			|||||||
            goto new_addr;
 | 
					            goto new_addr;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (bootp_filename)
 | 
				
			||||||
 | 
					        snprintf(rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
 | 
					    dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
 | 
					    saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								vl.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								vl.c
									
									
									
									
									
								
							@ -6403,6 +6403,7 @@ void help(void)
 | 
				
			|||||||
           "\n"
 | 
					           "\n"
 | 
				
			||||||
#ifdef CONFIG_SLIRP
 | 
					#ifdef CONFIG_SLIRP
 | 
				
			||||||
           "-tftp prefix    allow tftp access to files starting with prefix [-net user]\n"
 | 
					           "-tftp prefix    allow tftp access to files starting with prefix [-net user]\n"
 | 
				
			||||||
 | 
					           "-bootp file     advertise file in BOOTP replies\n"
 | 
				
			||||||
#ifndef _WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
           "-smb dir        allow SMB access to files in 'dir' [-net user]\n"
 | 
					           "-smb dir        allow SMB access to files in 'dir' [-net user]\n"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -6491,6 +6492,7 @@ enum {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    QEMU_OPTION_net,
 | 
					    QEMU_OPTION_net,
 | 
				
			||||||
    QEMU_OPTION_tftp,
 | 
					    QEMU_OPTION_tftp,
 | 
				
			||||||
 | 
					    QEMU_OPTION_bootp,
 | 
				
			||||||
    QEMU_OPTION_smb,
 | 
					    QEMU_OPTION_smb,
 | 
				
			||||||
    QEMU_OPTION_redir,
 | 
					    QEMU_OPTION_redir,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -6567,6 +6569,7 @@ const QEMUOption qemu_options[] = {
 | 
				
			|||||||
    { "net", HAS_ARG, QEMU_OPTION_net},
 | 
					    { "net", HAS_ARG, QEMU_OPTION_net},
 | 
				
			||||||
#ifdef CONFIG_SLIRP
 | 
					#ifdef CONFIG_SLIRP
 | 
				
			||||||
    { "tftp", HAS_ARG, QEMU_OPTION_tftp },
 | 
					    { "tftp", HAS_ARG, QEMU_OPTION_tftp },
 | 
				
			||||||
 | 
					    { "bootp", HAS_ARG, QEMU_OPTION_bootp },
 | 
				
			||||||
#ifndef _WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
    { "smb", HAS_ARG, QEMU_OPTION_smb },
 | 
					    { "smb", HAS_ARG, QEMU_OPTION_smb },
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
@ -7085,6 +7088,9 @@ int main(int argc, char **argv)
 | 
				
			|||||||
            case QEMU_OPTION_tftp:
 | 
					            case QEMU_OPTION_tftp:
 | 
				
			||||||
		tftp_prefix = optarg;
 | 
							tftp_prefix = optarg;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case QEMU_OPTION_bootp:
 | 
				
			||||||
 | 
					                bootp_filename = optarg;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
#ifndef _WIN32
 | 
					#ifndef _WIN32
 | 
				
			||||||
            case QEMU_OPTION_smb:
 | 
					            case QEMU_OPTION_smb:
 | 
				
			||||||
		net_slirp_smb(optarg);
 | 
							net_slirp_smb(optarg);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								vl.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								vl.h
									
									
									
									
									
								
							@ -159,6 +159,7 @@ extern int smp_cpus;
 | 
				
			|||||||
extern int no_quit;
 | 
					extern int no_quit;
 | 
				
			||||||
extern int semihosting_enabled;
 | 
					extern int semihosting_enabled;
 | 
				
			||||||
extern int autostart;
 | 
					extern int autostart;
 | 
				
			||||||
 | 
					extern const char *bootp_filename;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_OPTION_ROMS 16
 | 
					#define MAX_OPTION_ROMS 16
 | 
				
			||||||
extern const char *option_rom[MAX_OPTION_ROMS];
 | 
					extern const char *option_rom[MAX_OPTION_ROMS];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user