diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-03-02 10:20:55 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-03-02 11:09:57 +0000 |
commit | 2b5d3f582f718ca11488fb6d92ea39dd22b8ffed (patch) | |
tree | a4ab380c613b7fa3261f7538fc8524b04b610dc0 /src/include/ipxe/linux_api.h | |
parent | 916ebef1984e9caa05646463734b51202b405774 (diff) | |
download | ipxe-2b5d3f582f718ca11488fb6d92ea39dd22b8ffed.tar.gz |
[slirp] Add libslirp driver for Linux
Add a driver using libslirp to provide a virtual network interface
without requiring root permissions on the host. This simplifies the
process of running iPXE as a Linux userspace application with network
access. For example:
make bin-x86_64-linux/slirp.linux
./bin-x86_64-linux/slirp.linux --net slirp
libslirp will provide a built-in emulated DHCP server and NAT router.
Settings such as the boot filename may be controlled via command-line
options. For example:
./bin-x86_64-linux/slirp.linux \
--net slirp,filename=http://192.168.0.1/boot.ipxe
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/linux_api.h')
-rw-r--r-- | src/include/ipxe/linux_api.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/include/ipxe/linux_api.h b/src/include/ipxe/linux_api.h index ea247a613..040b52f8c 100644 --- a/src/include/ipxe/linux_api.h +++ b/src/include/ipxe/linux_api.h @@ -50,6 +50,9 @@ FILE_LICENCE ( GPL2_OR_LATER ); #endif struct sockaddr; +struct slirp_config; +struct slirp_callbacks; +struct Slirp; extern int linux_errno; extern int linux_argc; @@ -82,5 +85,21 @@ extern ssize_t __asmcall linux_sendto ( int sockfd, const void *buf, const struct sockaddr *dest_addr, size_t addrlen ); extern const char * __asmcall linux_strerror ( int linux_errno ); +extern struct Slirp * __asmcall +linux_slirp_new ( const struct slirp_config *config, + const struct slirp_callbacks *callbacks, void *opaque ); +extern void __asmcall linux_slirp_cleanup ( struct Slirp *slirp ); +extern void __asmcall linux_slirp_input ( struct Slirp *slirp, + const uint8_t *pkt, int pkt_len ); +extern void __asmcall +linux_slirp_pollfds_fill ( struct Slirp *slirp, uint32_t *timeout, + int ( __asmcall * add_poll ) ( int fd, int events, + void *opaque ), + void *opaque ); +extern void __asmcall +linux_slirp_pollfds_poll ( struct Slirp *slirp, int select_error, + int ( __asmcall * get_revents ) ( int idx, + void *opaque ), + void *opaque ); #endif /* _IPXE_LINUX_API_H */ |