|
iPXE
|
EFI PXE base code protocol. More...
#include <string.h>#include <errno.h>#include <ipxe/refcnt.h>#include <ipxe/list.h>#include <ipxe/netdevice.h>#include <ipxe/fakedhcp.h>#include <ipxe/process.h>#include <ipxe/uri.h>#include <ipxe/in.h>#include <ipxe/socket.h>#include <ipxe/tcpip.h>#include <ipxe/xferbuf.h>#include <ipxe/open.h>#include <ipxe/dhcppkt.h>#include <ipxe/udp.h>#include <ipxe/efi/efi.h>#include <ipxe/efi/efi_snp.h>#include <ipxe/efi/efi_pxe.h>#include <ipxe/efi/efi_null.h>#include <ipxe/efi/Protocol/PxeBaseCode.h>#include <ipxe/efi/Protocol/AppleNetBoot.h>#include <usr/ifmgmt.h>#include <config/general.h>Go to the source code of this file.
Data Structures | |
| struct | efi_pxe |
| A PXE base code. More... | |
| struct | sockaddr_efi |
| An EFI socket address. More... | |
| struct | efi_pxe_udp_pseudo_header |
| EFI UDP pseudo-header. More... | |
Variables | |
| static struct interface_operation | efi_pxe_tftp_operations [] |
| PXE file data transfer interface operations. More... | |
| static struct interface_descriptor | efi_pxe_tftp_desc |
| PXE file data transfer interface descriptor. More... | |
| static struct interface_operation | efi_pxe_udp_operations [] |
| PXE UDP interface operations. More... | |
| static struct interface_descriptor | efi_pxe_udp_desc |
| PXE UDP interface descriptor. More... | |
| static struct process_descriptor | efi_pxe_process_desc |
| UDP close process descriptor. More... | |
| static EFI_PXE_BASE_CODE_PROTOCOL | efi_pxe_base_code_protocol |
| PXE base code protocol. More... | |
| static EFI_APPLE_NET_BOOT_PROTOCOL | efi_apple_net_boot_protocol |
| Apple NetBoot protocol. More... | |
EFI PXE base code protocol.
Definition in file efi_pxe.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Free PXE base code.
| refcnt | Reference count |
Definition at line 116 of file efi_pxe.c.
References container_of, free, efi_pxe::netdev, and netdev_put().
Referenced by efi_pxe_install().
|
static |
List of PXE base codes.
|
static |
Locate PXE base code.
| handle | EFI handle |
| pxe | PXE base code, or NULL |
Definition at line 132 of file efi_pxe.c.
References handle, efi_pxe::handle, efi_pxe::list, list_for_each_entry, and NULL.
Referenced by efi_pxe_uninstall().
|
static |
Populate socket address from EFI IP address.
| pxe | PXE base code |
| ip | EFI IP address |
| sa | Socket address to fill in |
Definition at line 191 of file efi_pxe.c.
References container_of, ip, memcpy(), memset(), efi_pxe::net, net_protocol::net_addr_len, efi_pxe::netdev, sa, sockaddr::sa_family, tcpip_net_protocol::sa_family, net_device::scope_id, efi_pxe::tcpip, and typeof().
Referenced by efi_pxe_tftp_open(), and efi_pxe_udp_write().
|
static |
Transcribe EFI IP address (for debugging)
| pxe | PXE base code |
| ip | EFI IP address |
| text | Transcribed IP address |
Definition at line 212 of file efi_pxe.c.
References ip, efi_pxe::net, and net_protocol::ntoa.
Referenced by efi_pxe_arp(), efi_pxe_discover(), efi_pxe_mtftp(), efi_pxe_set_ip_filter(), efi_pxe_set_station_ip(), efi_pxe_tftp_open(), efi_pxe_udp_read(), and efi_pxe_udp_write().
|
static |
Populate local IP address.
| pxe | PXE base code |
| rc | Return status code |
Definition at line 224 of file efi_pxe.c.
References address, ENOTSUP, fetch_ipv4_setting(), memcpy(), memset(), mode, efi_pxe::mode, efi_pxe::netdev, and netdev_settings().
Referenced by efi_pxe_dhcp(), and efi_pxe_start().
|
static |
Check if IP address matches filter.
| pxe | PXE base code |
| ip | EFI IP address |
| is_match | IP address matches filter |
Definition at line 257 of file efi_pxe.c.
References container_of, EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST, EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS, EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST, EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP, filter, in, IN6_IS_ADDR_MULTICAST, IN_IS_MULTICAST, INADDR_BROADCAST, ip, memcmp(), mode, efi_pxe::mode, efi_pxe::net, net_protocol::net_addr_len, typeof(), and u.
Referenced by efi_pxe_udp_read().
|
static |
Close PXE (M)TFTP download interface.
| pxe | PXE base code |
| rc | Reason for close |
Definition at line 319 of file efi_pxe.c.
References intf_restart(), efi_pxe::rc, rc, and efi_pxe::tftp.
Referenced by efi_pxe_mtftp(), efi_pxe_stop(), and efi_pxe_tftp_deliver().
Check PXE (M)TFTP download flow control window.
| pxe | PXE base code |
| len | Length of window |
Definition at line 334 of file efi_pxe.c.
References efi_pxe::blksize.
|
static |
Receive new PXE (M)TFTP download data.
| pxe | PXE base code |
| iobuf | I/O buffer |
| meta | Transfer metadata |
| rc | Return status code |
Definition at line 348 of file efi_pxe.c.
References efi_pxe::buf, efi_pxe_tftp_close(), iob_disown, meta, rc, and xferbuf_deliver().
|
static |
Open (M)TFTP download interface.
| pxe | PXE base code |
| ip | EFI IP address |
| filename | Filename |
| rc | Return status code |
Definition at line 384 of file efi_pxe.c.
References DBGC, efi_pxe_ip_ntoa(), efi_pxe_ip_sockaddr(), ENOTSUP, ip, efi_pxe::name, pxe_uri(), rc, strerror(), efi_pxe::tftp, uri_put(), and xfer_open_uri().
Referenced by efi_pxe_mtftp().
|
static |
Close UDP interface.
| pxe | PXE base code |
| rc | Reason for close |
Definition at line 436 of file efi_pxe.c.
References efi_snp_release(), free_iob(), intf_restart(), io_buffer::list, list_del, list_for_each_entry_safe, efi_pxe::process, process_del(), process_running(), efi_pxe::queue, rc, tmp, and efi_pxe::udp.
Referenced by efi_pxe_stop(), and efi_pxe_udp_scheduled_close().
|
static |
Receive UDP packet.
| pxe | PXE base code |
| iobuf | I/O buffer |
| meta | Data transfer metadata |
| rc | Return status code |
Definition at line 465 of file efi_pxe.c.
References assert(), efi_pxe_udp_pseudo_header::dest_port, ENOTSUP, free_iob(), iob_ensure_headroom(), iob_push, io_buffer::list, list_add_tail, memcpy(), meta, efi_pxe_udp_pseudo_header::net, net_protocol::net_addr_len, tcpip_net_protocol::net_protocol, ntohs, NULL, efi_pxe::queue, rc, sockaddr_efi::se_addr, sockaddr_efi::se_family, sockaddr_efi::se_port, efi_pxe_udp_pseudo_header::src_port, and tcpip_net_protocol().
|
static |
Open UDP interface.
| pxe | PXE base code |
| rc | Return status code |
Definition at line 531 of file efi_pxe.c.
References DBGC, efi_snp_claim(), efi_pxe::name, efi_pxe::process, process_del(), process_running(), rc, strerror(), efi_pxe::udp, and udp_open_promisc().
Referenced by efi_pxe_udp_read(), and efi_pxe_udp_write().
|
static |
Schedule close of UDP interface.
| pxe | PXE base code |
Definition at line 558 of file efi_pxe.c.
References efi_pxe::process, and process_add().
Referenced by efi_pxe_udp_read(), and efi_pxe_udp_write().
|
static |
Scheduled close of UDP interface.
| pxe | PXE base code |
Definition at line 575 of file efi_pxe.c.
References efi_pxe_udp_close().
|
static |
Name fake DHCP packet.
| pxe | PXE base code |
| packet | Packet |
| name | Name of packet |
Definition at line 599 of file efi_pxe.c.
References mode, and efi_pxe::mode.
Referenced by efi_pxe_fake().
|
static |
Construct fake DHCP packet and flag.
| pxe | PXE base code |
| fake | Fake packet constructor |
| packet | Packet to fill in |
| exists | Packet existence flag |
Definition at line 628 of file efi_pxe.c.
References EFI_PXE_BASE_CODE_DHCPV4_PACKET::BootpOpcode, container_of, DBGC, DHCP_END, dhcppkt_init(), dhcppkt_len(), EFI_PXE_BASE_CODE_PACKET::Dhcpv4, efi_pxe_fake_name(), FALSE, len, mode, efi_pxe::mode, efi_pxe::name, efi_pxe::netdev, op, EFI_PXE_BASE_CODE_PACKET::Raw, rc, strerror(), and TRUE.
Referenced by efi_pxe_fake_all().
|
static |
Construct fake DHCP packets.
| pxe | PXE base code |
Definition at line 680 of file efi_pxe.c.
References create_fakedhcpack(), create_fakedhcpdiscover(), create_fakepxebsack(), efi_pxe_fake(), mode, and efi_pxe::mode.
Referenced by efi_pxe_dhcp(), and efi_pxe_start().
|
static |
Start PXE base code.
| base | PXE base code protocol |
| use_ipv6 | Use IPv6 |
| efirc | EFI status code |
Definition at line 709 of file efi_pxe.c.
References AF_INET, AF_INET6, base, container_of, DBGC, DEFAULT_ToS, DEFAULT_TTL, EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST, EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS, EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST, EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP, efi_pxe_fake_all(), efi_pxe_ip(), EFI_UNSUPPORTED, memset(), mode, efi_pxe::mode, efi_pxe::name, efi_pxe::net, tcpip_net_protocol::net_protocol, net_protocol::ntoa, NULL, rc, socket_family_name(), efi_pxe::tcpip, tcpip_net_protocol(), and TRUE.
Referenced by efi_pxe_install().
|
static |
Stop PXE base code.
| base | PXE base code protocol |
| efirc | EFI status code |
Definition at line 764 of file efi_pxe.c.
References base, container_of, DBGC, efi_pxe_tftp_close(), efi_pxe_udp_close(), FALSE, mode, efi_pxe::mode, and efi_pxe::name.
Referenced by efi_pxe_uninstall().
|
static |
Perform DHCP.
| base | PXE base code protocol |
| sort | Offers should be sorted |
| efirc | EFI status code |
Definition at line 789 of file efi_pxe.c.
References base, container_of, DBGC, efi_pxe_fake_all(), efi_pxe_ip(), efi_snp_claim(), efi_snp_release(), EFIRC, ETIMEDOUT, efi_pxe::name, netdev, efi_pxe::netdev, netdev_configuration_in_progress(), netdev_configuration_ok(), netdev_configure_all(), rc, step(), and strerror().
|
static |
Perform boot server discovery.
| base | PXE base code protocol |
| type | Boot server type |
| layer | Boot server layer |
| bis | Use boot integrity services |
| info | Additional information |
| efirc | EFI status code |
Definition at line 843 of file efi_pxe.c.
References base, container_of, DBGC, efi_pxe_ip_ntoa(), EFI_UNSUPPORTED, info, ip, efi_pxe::name, and type.
|
static |
Perform (M)TFTP.
| base | PXE base code protocol |
| opcode | TFTP opcode |
| data | Data buffer |
| overwrite | Overwrite file |
| len | Length of data buffer |
| blksize | Block size |
| ip | Server address |
| filename | Filename |
| info | Additional information |
| callback | Pass packets to callback instead of data buffer |
| efirc | EFI status code |
Definition at line 887 of file efi_pxe.c.
References base, blksize, efi_pxe::blksize, efi_pxe::buf, container_of, data, DBGC, EFI_PXE_BASE_CODE_MTFTP_READ_FILE, EFI_PXE_BASE_CODE_TFTP_READ_FILE, efi_pxe_ip_ntoa(), efi_pxe_tftp_close(), efi_pxe_tftp_open(), efi_snp_claim(), efi_snp_release(), EFIRC, EINPROGRESS, ENOTSUP, info, ip, len, efi_pxe::name, NULL, opcode, overwrite(), efi_pxe::rc, rc, step(), strerror(), and xferbuf_fixed_init().
|
static |
Transmit UDP packet.
| base | PXE base code protocol |
| flags | Operation flags |
| dest_ip | Destination address |
| dest_port | Destination port |
| gateway | Gateway address |
| src_ip | Source address |
| src_port | Source port |
| hdr_len | Header length |
| hdr | Header data |
| len | Length |
| data | Data |
| efirc | EFI status code |
Definition at line 970 of file efi_pxe.c.
References base, container_of, data, DBGC, DBGC2, dest, dest_ip, EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT, EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT, efi_pxe_ip_ntoa(), efi_pxe_ip_sockaddr(), efi_pxe_udp_open(), efi_pxe_udp_schedule_close(), EFIRC, ENOMEM, flags, free_iob(), hdr, htons, iob_disown, iob_put, len, memcpy(), memset(), meta, mode, efi_pxe::mode, efi_pxe::name, efi_pxe::netdev, ntohs, random(), rc, sa, src, src_ip, src_port, st, strerror(), efi_pxe::udp, xfer_alloc_iob(), and xfer_deliver().
|
static |
Receive UDP packet.
| base | PXE base code protocol |
| flags | Operation flags |
| dest_ip | Destination address |
| dest_port | Destination port |
| src_ip | Source address |
| src_port | Source port |
| hdr_len | Header length |
| hdr | Header data |
| len | Length |
| data | Data |
| efirc | EFI status code |
Definition at line 1084 of file efi_pxe.c.
References base, container_of, data, io_buffer::data, DBGC2, dest_ip, efi_pxe_udp_pseudo_header::dest_port, EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP, EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT, EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP, EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT, EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER, efi_pxe_ip_filter(), efi_pxe_ip_ntoa(), efi_pxe_udp_open(), efi_pxe_udp_schedule_close(), EFIRC, ERANGE, ETIMEDOUT, flags, free_iob(), hdr, iob_len(), iob_pull, len, io_buffer::list, list_del, list_empty, list_first_entry, memcmp(), memcpy(), net_protocol::name, efi_pxe::name, efi_pxe::net, efi_pxe_udp_pseudo_header::net, net_protocol::net_addr_len, net_protocol::ntoa, efi_pxe::queue, rc, src_ip, src_port, efi_pxe_udp_pseudo_header::src_port, and step().
|
static |
Set receive filter.
| base | PXE base code protocol |
| filter | Receive filter |
| efirc | EFI status code |
Definition at line 1265 of file efi_pxe.c.
References base, container_of, DBGC, efi_pxe_ip_ntoa(), filter, memcpy(), mode, efi_pxe::mode, and efi_pxe::name.
|
static |
Resolve MAC address.
| base | PXE base code protocol |
| ip | IP address |
| mac | MAC address to fill in |
| efirc | EFI status code |
Definition at line 1293 of file efi_pxe.c.
References base, container_of, DBGC, efi_pxe_ip_ntoa(), EFI_UNSUPPORTED, ip, mac, and efi_pxe::name.
|
static |
Set parameters.
| base | PXE base code protocol |
| autoarp | Automatic ARP packet generation |
| sendguid | Send GUID as client hardware address |
| ttl | IP time to live |
| tos | IP type of service |
| callback | Make callbacks |
| efirc | EFI status code |
Definition at line 1317 of file efi_pxe.c.
References base, container_of, DBGC, mode, efi_pxe::mode, and efi_pxe::name.
|
static |
Set IP address.
| base | PXE base code protocol |
| ip | IP address |
| netmask | Subnet mask |
| efirc | EFI status code |
Definition at line 1362 of file efi_pxe.c.
References base, container_of, DBGC, efi_pxe_ip_ntoa(), ip, memcpy(), mode, efi_pxe::mode, and efi_pxe::name.
|
static |
Update cached DHCP packets.
| base | PXE base code protocol |
| dhcpdisc_ok | DHCPDISCOVER is valid |
| dhcpack_ok | DHCPACK received |
| proxyoffer_ok | ProxyDHCPOFFER received |
| pxebsdisc_ok | PxeBsDISCOVER valid |
| pxebsack_ok | PxeBsACK received |
| pxebsbis_ok | PxeBsBIS received |
| dhcpdisc | DHCPDISCOVER packet |
| dhcpack | DHCPACK packet |
| proxyoffer | ProxyDHCPOFFER packet |
| pxebsdisc | PxeBsDISCOVER packet |
| pxebsack | PxeBsACK packet |
| pxebsbis | PxeBsBIS packet |
| efirc | EFI status code |
Definition at line 1402 of file efi_pxe.c.
References base, container_of, DBGC, memcpy(), mode, efi_pxe::mode, and efi_pxe::name.
|
static |
Get DHCP/BSDP response.
| packet | Packet |
| len | Length of data buffer |
| data | Data buffer |
| efirc | EFI status code |
Definition at line 1480 of file efi_pxe.c.
References data, EFI_BUFFER_TOO_SMALL, EFI_SUCCESS, len, and memcpy().
Referenced by efi_apple_get_bsdp_response(), and efi_apple_get_dhcp_response().
|
static |
Get DHCP response.
| apple | Apple NetBoot protocol |
| len | Length of data buffer |
| data | Data buffer |
| efirc | EFI status code |
Definition at line 1505 of file efi_pxe.c.
References efi_pxe::apple, container_of, data, EFI_PXE_BASE_CODE_MODE::DhcpAck, efi_apple_get_response(), len, and efi_pxe::mode.
|
static |
Get BSDP response.
| apple | Apple NetBoot protocol |
| len | Length of data buffer |
| data | Data buffer |
| efirc | EFI status code |
Definition at line 1521 of file efi_pxe.c.
References efi_pxe::apple, container_of, data, efi_apple_get_response(), len, efi_pxe::mode, and EFI_PXE_BASE_CODE_MODE::PxeReply.
| int efi_pxe_install | ( | EFI_HANDLE | handle, |
| struct net_device * | netdev | ||
| ) |
Install PXE base code protocol.
| handle | EFI handle |
| netdev | Underlying network device |
| rc | Return status code |
Definition at line 1548 of file efi_pxe.c.
References AF_INET6, efi_pxe::apple, efi_pxe::base, EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI, efi_apple_net_boot_protocol, efi_apple_net_boot_protocol_guid, efi_handle_name(), efi_nullify_apple(), efi_nullify_pxe(), efi_pxe_base_code_protocol, efi_pxe_base_code_protocol_guid, efi_pxe_free(), efi_pxe_process_desc, efi_pxe_start(), efi_pxe_tftp_desc, efi_pxe_udp_desc, efi_systab, ENOMEM, FALSE, fetch_ipv4_setting(), handle, efi_pxe::handle, INIT_LIST_HEAD, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, intf_init(), ip, efi_pxe::list, list_add_tail, memcpy(), efi_pxe::mode, _EFI_PXE_BASE_CODE_PROTOCOL::Mode, efi_pxe::name, net_device::name, netdev, efi_pxe::netdev, netdev_get(), netdev_settings(), NULL, efi_pxe::process, process_init_stopped(), efi_pxe::queue, rc, ref_init, ref_put, efi_pxe::refcnt, strerror(), tcpip_net_protocol(), efi_pxe::tftp, efi_pxe::udp, EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, and zalloc().
Referenced by efi_image_exec().
| void efi_pxe_uninstall | ( | EFI_HANDLE | handle | ) |
Uninstall PXE base code protocol.
| handle | EFI handle |
Definition at line 1631 of file efi_pxe.c.
References efi_pxe::apple, efi_pxe::base, EFI_SYSTEM_TABLE::BootServices, DBG, DBGC, EEFI, efi_apple_net_boot_protocol_guid, efi_handle_name(), efi_nullify_apple(), efi_nullify_pxe(), efi_pxe_base_code_protocol_guid, efi_pxe_find(), efi_pxe_stop(), efi_shutdown_in_progress, efi_systab, handle, efi_pxe::list, list_del, efi_pxe::name, NULL, ref_put, efi_pxe::refcnt, strerror(), and EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces.
Referenced by efi_image_exec().
|
static |
PXE file data transfer interface operations.
|
static |
PXE file data transfer interface descriptor.
Definition at line 373 of file efi_pxe.c.
Referenced by efi_pxe_install().
|
static |
PXE UDP interface operations.
|
static |
PXE UDP interface descriptor.
Definition at line 522 of file efi_pxe.c.
Referenced by efi_pxe_install().
|
static |
UDP close process descriptor.
Definition at line 582 of file efi_pxe.c.
Referenced by efi_pxe_install().
|
static |
PXE base code protocol.
Definition at line 1448 of file efi_pxe.c.
Referenced by efi_pxe_install().
|
static |
Apple NetBoot protocol.
Definition at line 1529 of file efi_pxe.c.
Referenced by efi_pxe_install().
1.8.15