mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 11:00:27 +03:00
[af_packet] Add new AF_PACKET driver for Linux
This code largely inspired by tap.c. Allows for testing iPXE on real NICs from within Linux. For example: make bin-x86_64-linux/af_packet.linux valgrind ./bin-x86_64-linux/af_packet.linux --net af_packet,if=eth3 Tested as x86_64 and i386 binary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
committed by
Michael Brown
parent
04c7befa73
commit
b6f524388b
@@ -194,6 +194,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define ERRFILE_pciea ( ERRFILE_DRIVER | 0x00c00000 )
|
||||
#define ERRFILE_axge ( ERRFILE_DRIVER | 0x00c10000 )
|
||||
#define ERRFILE_thunderx ( ERRFILE_DRIVER | 0x00c20000 )
|
||||
#define ERRFILE_af_packet ( ERRFILE_DRIVER | 0x00c30000 )
|
||||
|
||||
#define ERRFILE_aoe ( ERRFILE_NET | 0x00000000 )
|
||||
#define ERRFILE_arp ( ERRFILE_NET | 0x00010000 )
|
||||
|
||||
@@ -46,6 +46,8 @@ typedef __kernel_loff_t loff_t;
|
||||
#include <linux/poll.h>
|
||||
typedef unsigned long nfds_t;
|
||||
typedef uint32_t useconds_t;
|
||||
typedef uint32_t socklen_t;
|
||||
struct sockaddr;
|
||||
#define MAP_FAILED ( ( void * ) -1 )
|
||||
#define SEEK_SET 0
|
||||
|
||||
@@ -68,6 +70,11 @@ extern void * linux_mmap ( void *addr, __kernel_size_t length, int prot,
|
||||
extern void * linux_mremap ( void *old_address, __kernel_size_t old_size,
|
||||
__kernel_size_t new_size, int flags );
|
||||
extern int linux_munmap ( void *addr, __kernel_size_t length );
|
||||
extern int linux_socket ( int domain, int type_, int protocol );
|
||||
extern int linux_bind ( int fd, const struct sockaddr *addr,
|
||||
socklen_t addrlen );
|
||||
extern ssize_t linux_sendto ( int fd, const void *buf, size_t len, int flags,
|
||||
const struct sockaddr *daddr, socklen_t addrlen );
|
||||
|
||||
extern const char * linux_strerror ( int errnum );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user