Commit graph

809 commits

Author SHA1 Message Date
Michael Kubacki
df9111c2d3 Global: Set MarkdownLintCheck plugin to AuditOnly
In preparation for the MarkdownLintCheck plugin being added to the
repo, this change defaults the plugin to `AuditOnly` mode in each
package. This allows package maintainers to enable the plugin as they
see fit.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-07-29 12:32:09 +00:00
abuthahirm
7442655403 NetworkPkg/UefiPxeBcDxe: Fix CopyMem destination in PxeBcDhcp6CallBack
When caching the DHCPv6 discover packet to Mode->DhcpDiscover in
PxeBcDhcp6CallBack, the destination was incorrectly specified as
Mode->DhcpDiscover.Dhcpv4 (the DHCPv4 union member). Change it to
Mode->DhcpDiscover to correctly reference the union and avoid
type confusion when copying a DHCPv6 packet.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
2026-07-14 18:10:05 +00:00
abuthahirm
a589f6fe03 NetworkPkg/Ip6Dxe: Add NULL check for InterfaceId before dereference
In Ip6ProcessRouterAdvertise, IpSb->InterfaceId is dereferenced in
CopyMem to form a stateless address. Add a guard to ensure
IpSb->InterfaceId is not NULL before entering the block, preventing
a potential NULL pointer dereference.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
2026-07-14 18:10:05 +00:00
abuthahirm
d21677e0bc NetworkPkg/Ip6Dxe: Move neighbor table cleanup before MNP teardown
In Ip6CleanService, Ip6FreeNeighborEntry may attempt to send packets via
MNP. Defensively move the neighbor table cleanup to occur before MNP
teardown so that the MNP child handle and its resources remain valid
during neighbor entry cleanup.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
2026-07-14 18:10:05 +00:00
abuthahirm
bc15a87b74 NetworkPkg/Dhcp6Dxe: Defensively check for NULL Config in Dhcp6UpdateIaInfo
Replace the ASSERT (Instance->Config != NULL) in Dhcp6UpdateIaInfo with
an explicit NULL check that returns EFI_DEVICE_ERROR. Also add a
complementary guard in Dhcp6GenerateIaCb alongside the existing check
for Instance->IaCb.Ia. These are defensive changes to prevent potential
NULL pointer dereferences.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
2026-07-14 18:10:05 +00:00
Jared Pan
9a65be14eb NetworkPkg/SnpDxe: Fix MAC address passthrough support
During SnpUndi32Initialize(), CurrentAddress is unconditionally
overwritten with PermanentAddress before UNDI initialization. This
causes MAC address passthrough (MacPassthru) to fail, as the NIC's
actual current address, which may differ from its permanent address,
is lost.

After UNDI initialization completes, call PxeGetStnAddr() to read
the NIC's station address via the UNDI interface and update
CurrentAddress, PermanentAddress, and BroadcastAddress in the mode
structure with the values reported by the hardware.

The call is added to both initialization paths: the cable-detect
success path and the fallback no-cable-detect path.

Signed-off-by: Jared Pan <jared.pan@dell.com>
2026-06-30 17:27:16 +00:00
Syed Mohammed Nayyar
24788b6190 NetworkPkg/IScsiDxe: bound value length in IScsiBuildKeyValueList
IScsiBuildKeyValueList parses the data segment of a received iSCSI
login, text or CHAP response into key=value pairs. After locating '='
within the remaining length, it sets KeyValuePair->Value and calls
AsciiStrLen(Value) to measure the value before subtracting it from the
remaining length. AsciiStrLen has no length cap, and the data segment
copied from the received PDU (AllocatePool(Len) + NetbufQueCopy of the
data-segment length) is not guaranteed to be NUL-terminated.

A malicious or redirecting target can send a data segment whose final
value lacks a trailing NUL (e.g. the 3 bytes "X=Y"), so AsciiStrLen
reads past the end of the segment allocation, an attacker-controlled
out-of-bounds read. The SafeUint32Sub bound check only runs after the
over-read.

Replace AsciiStrLen(Value) with AsciiStrnLenS(Value, Len), capping the
scan to the bytes remaining from Value onward. An unterminated value
then returns Len and the existing SafeUint32Sub rejects the segment.
The single change covers all three callers (login redirect, operational
parameter negotiation and CHAP).

Signed-off-by: Syed Mohammed Nayyar <jmestwa@gmail.com>
2026-06-30 16:34:46 +00:00
Michael Kubacki
b3f57868ce NetworkPkg/UefiPxeBcDxe: Initialize IPV4 token in IPV4 branch
EfiPxeBcStart() in PxeBcImpl.c has conditional code branches for
IPV4 and IPV6.

- IPV4 branch should use EFI_IP4_COMPLETION_TOKEN which is
Private->IcmpToken.
- IPV6 branch should use EFI_IP6_COMPLETION_TOKEN which is
Private->Icmp6Token.

Right now, the IPv4 branch incorrectly initializes
Private->Icmp6Token to EFI_NOT_READY. That is changed to
Private->IcmpToken.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-06-25 01:13:27 +00:00
Tuan Phan
1cb1184b50 NetworkPkg: Ip4Dxe: Fix uninitialized variable warning
In Ip4FormExtractConfig(), the Status variable was assigned only within
a conditional block but used outside of it, which could lead to an
uninitialized variable warning.

Fix this by moving the relevant code outside of the conditional block so
that Status is always properly initialized before use.

Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
2026-06-24 14:49:50 +00:00
Tuan Phan
56723842fd NetworkPkg: HttpBootDxe: Fix uninitialized variable warnings
In HttpBootGetBootFileCaller(), under the LoadBootFile case, the Status
variable is only assigned within a for loop. If the loop is not executed,
this results in an uninitialized variable warning when Status is later
referenced.

Resolve this issue by return Status directly inside the loop.

Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
2026-06-24 14:49:50 +00:00
jmestwa-coder
9bf69ed7ed NetworkPkg/Dhcp6Dxe: bound IA inner option length to buffer
Dhcp6SeekInnerOptionSafe() reads the IA_NA/IA_TA option-len field from a
received datagram and only validates it against the fixed minimums, never
against OptionLen (the bytes actually remaining in the packet). A reply
can declare an option-len up to 0xFFFF while the real buffer is only the
16-byte (IA_NA) or 8-byte (IA_TA) minimum, so the returned inner length
is far larger than the buffer.

That length is then passed as SeekLen to Dhcp6SeekOption(), which walks
ReadUnaligned16() cursors up to Buf + SeekLen and reads past the end of
the packet allocation, an attacker-controlled out-of-bounds read.

Bound the declared inner length against OptionLen minus the IA header
size in both the IA_NA and IA_TA branches, rejecting over-declared
options with EFI_DEVICE_ERROR. Parenthesize DHCP6_MIN_SIZE_OF_IA_NA so
the subtraction in that bound binds correctly. Add host tests covering
the over-declared, off-by-one, and exact-boundary cases for both IA_NA
and IA_TA.

Signed-off-by: jmestwa-coder <jmestwa@gmail.com>
2026-06-18 21:59:02 +00:00
abuthahirm
7bb72bd6de NetworkPkg/IScsiDxe: Fix AttemptName cleared on loading defaults
Root Cause:
The AttemptName string field in IScsiConfigVfr.vfr had
default = STRING_TOKEN(STR_NULL), which resolves to an empty
string. When optimized defaults are loaded (F3), the form browser
resets every field to its defined default, wiping out the actual
attempt names (e.g. Attempt 1, Attempt 2) and leaving the field
blank.

Fix:
Add the INTERACTIVE flag to the AttemptName string field in VFR.
This tells the form browser to invoke the driver callback when
loading defaults instead of applying the hardcoded empty string.

Introduce a helper function IScsiGetAttemptNameDefault() that reads
the stored attempt name from mCallbackInfo->Current->AttemptName,
registers it as a HII string, and returns it as the default value.
The helper also validates that the question type is
EFI_IFR_TYPE_STRING before accessing Value->string.

In IScsiFormCallback, handle EFI_BROWSER_ACTION_DEFAULT_STANDARD,
EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING, and
EFI_BROWSER_ACTION_DEFAULT_SAFE for KEY_ATTEMPT_NAME by delegating
to the helper. This ensures loading any class of defaults always
restores the correct attempt name for whichever attempt is open.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
2026-06-10 20:21:51 +00:00
abuthahirm
1f28f1e819 NetworkPkg/HttpDxe: Fix missing error check in TlsCommonTransmit
In HttpsReceive(), the return value of TlsCommonTransmit() was not
checked. Add error handling with proper cleanup of PacketOut and
BufferOut before returning on failure.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: abuthahirm <abuthahirm@ami.com>
2026-06-04 15:32:31 +00:00
abuthahirm
a90f2a0d9a NetworkPkg/DnsDxe: Add error check for Dhcp4->Build
In GetDns4ServerFromDhcp4(), the return value of Dhcp4->Build()
was not checked. Add error handling and a NULL check on the
resulting Token.Packet before use.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: abuthahirm <abuthahirm@ami.com>
2026-06-04 15:32:31 +00:00
abuthahirm
ece24799e5 NetworkPkg: Remove redundant Status initializations
Remove redundant Status = EFI_SUCCESS and Status = EFI_DEVICE_ERROR
initializations that are immediately overwritten before being read,
across multiple modules: Dhcp6Dxe, DnsDxe, HttpBootDxe, HttpDxe,
Ip4Dxe, Ip6Dxe, MnpDxe, Mtftp4Dxe, Mtftp6Dxe, SnpDxe, TcpDxe,
TlsAuthConfigDxe, UefiPxeBcDxe and WifiConnectionManagerDxe.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: abuthahirm <abuthahirm@ami.com>
2026-06-04 15:32:31 +00:00
Dongyan Qian
845daa9f12 NetworkPkg/DpcDxe: Stop adding entries on allocation failure
DpcQueueDpc() expands the DPC entry free list when it is empty. If an
allocation fails after at least one entry has already been added to the
free list, the current code continues and inserts the failed allocation
result into the list.

Stop expanding the free list when an allocation fails and the free list
already contains entries. The caller can then continue with one of the
entries that was successfully allocated.

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2026-05-30 01:10:39 +00:00
Matthew Graham
551b320502 NetworkPkg/TcpDxe: Skip RST when no IpIo sender exists for Dst
Unknown or closed segments still go down the RST path into
TcpSendIpPacket. When no IpIo sender exists for the destination,
each packet logs “No appropriate IpSender.” next to the usual
discard traces and floods the console. The change calls
IpIoFindSender before SEND_RESET and discards when it fails,
which stops that storm and leaves normal RST behavior unchanged
when a sender is present.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>
Cc: Mike Beaton <mjsbeaton@gmail.com>
Signed-off-by: Matthew Graham <Matthew.Graham@amd.com>
2026-05-25 08:41:54 +00:00
abuthahirm
6d4e973807 NetworkPkg/DnsDxe: Refactor answer loop to for in ParseDnsResponse
The answer section loop in ParseDnsResponse() iterated a counter
AnswerSectionNum from 0 to DnsHeader->AnswersNum using a while loop
with a manual increment at the bottom. Convert it to an equivalent
for loop to make the initialization, condition, and increment
explicit.

Also replace the unconditional Status = EFI_NOT_FOUND assignment
before the loop with a conditional that only sets it when the loop
is never entered (DnsHeader->AnswersNum == 0). ParseDnsResponse()
initializes Status to EFI_SUCCESS at function entry, and the loop
body always overwrites Status, so the pre-assignment was dead code
in the common case. The conditional form makes the intent explicit:
EFI_NOT_FOUND is only the result when there are no answer records.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: abuthahirm <abuthahirm@ami.com>
2026-05-01 14:21:01 +00:00
abuthahirm
ccc95703cd NetworkPkg/Ip4Dxe: Fix missing Status check on Ip4Cfg2->SetData call
In Ip4Config2ConvertIfrNvDataToConfigNvData(), when the policy is
changed away from a static configuration (PolicyChanged is TRUE), the
first call to Ip4Cfg2->SetData() was not checking its return value and
always returned EFI_SUCCESS. Fix this to check and return Status on
error, consistent with the second SetData call in the same function.

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: abuthahirm <abuthahirm@ami.com>
2026-05-01 14:21:01 +00:00
abuthahirm
5acaac4f32 NetworkPkg/Ip4Dxe: Reject IPv4 addresses ending with dot
Issue: UI accepts invalid IPv4 addresses ending with a dot in the
IPv4 Network Configuration page. Examples:
- Local IP Address: 192.168.1.10.
- Subnet Mask: 255.255.255.0.
- Gateway: 2.2.2.2.
- DNS Servers: 1.1.1.1.

Root Cause:
The function Ip4Config2StrToIp converts user-entered IPv4 strings
into numbers. When an address ending with a dot like '1.1.1.1.' is
entered, the code skips over the 4th dot, reaches the string's null
terminator, and incorrectly treats it as valid.

Fix:
Refactor Ip4Config2StrToIp to be a thin wrapper around the existing
BaseLib StrToIpv4Address() helper. After parsing, the EndPointer is
checked to ensure the entire string was consumed (i.e. EndPointer
points to the null terminator). Any trailing characters, including
a trailing dot, cause EFI_INVALID_PARAMETER to be returned.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
2026-04-29 21:25:12 +00:00
Qihang Gao
6d4f24a749 NetworkPkg/GoogleTest: Remove duplicate file name in INF file
In GoogleTest driver, Ip6OptionGoogleTest.h appears twice in [Sources]
section, so remove the duplicate one.

Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-04-29 11:18:10 +02:00
copilot-swe-agent[bot]
2f3883dd59 NetworkPkg/HttpBootDxe: Add all events to HttpBootHttpCallback()
Include other events from EDKII_HTTP_CALLBACK_EVENT to print failure
information in the event of HTTP Boot failure

Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2026-04-27 23:30:35 +00:00
Saloni Kasbekar
56b1ab8ca3 NetworkPkg/HttpBootDxe: Print TLS errors on screen during HTTP boot
Install EDKII_HTTP_CALLBACK_PROTOCOL in HttpBootDxe to receive TLS
events from HttpDxe during the HTTP Boot process. When a TLS error
occurs (failed TLS session connection or TLS configuration), print an
error message on screen using AsciiPrint().

The callback is installed in HttpBootInstallCallback() and uninstalled
in HttpBootUninstallCallback(), ensuring TLS errors are only printed
during the HTTP Boot process and not for other TLS accesses.

Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2026-04-06 19:25:44 +00:00
Michael Kubacki
83060dd335 NetworkPkg/UefiPxeBcDxe: Add missing Token.Context initialization
Adds missing `Token.Context = Private` initialization in two MTFTP
write-file functions. Without this, the `Context` field passed to the
MTFTP `WriteFile` callback was uninitialized, which could lead to a
page fault when the callback attempted to access the `Private` driver
context. The corresponding read-file functions already set this field
correctly.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-04-01 00:11:57 +00:00
Michael Kubacki
b989871c87 NetworkPkg: Reset DHCP Service Binding IO Status on Stop
Resets DhcpSb->IoStatus on stop to prevent a stale state from
persisting which might impact future operations dependent on
the IO status.

Co-authored-by: Wenbo Hou <wenbhou@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-03-26 17:07:43 +00:00
Michael Kubacki
e1103f7dca NetworkPkg: Ip4Dxe/Ip6Dxe: Set SB notify to NULL after event close
Ip4StartAutoConfig() and Ip6ConfigStartStatefulAutoConfig() close the
DHCP service binding notify event when the service child is
successfully created, but do not NULL the instance field afterward.

On re-entry, the stale handle passes the non-NULL condition and is
closed a second time, which results in a page fault with memory
protections enabled.

This change sets the event field to NULL immediately after
CloseEvent() so that subsequent calls skip attempting to close the
event again.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-03-17 21:55:49 +00:00
Alexander Gryanko
7347c32f65 NetworkPkg: align UNI file headers with UNI Spec standard
The Uni file standard specifies that comments begin with the
characters "//". The following files contained incorrectly
formatted C-style comments and have been updated:

NetworkPkg/Application/VConfig/VConfigStrings.uni
NetworkPkg/HttpBootDxe/HttpBootConfigStrings.uni
NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni
NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxeStrings.uni

The problems were identified during testing of the parser
https://github.com/xpahos/edk2-idea.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2026-03-02 19:32:17 +00:00
Michael Kubacki
58de02af29 NetworkPkg: Replace include guards with #pragma once
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.

`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.

Compared to macro-based include guards, `#pragma once`:

- Eliminates the risk of macro name collisions or copy/paste errors
  where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
  (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
  file entirely, rather than re-reading it to find the matching
  `#endif` ("multiple-include optimization").
  - Note that some compilers may already optimize traditional include
    guards, by recognzining the idiomatic pattern.

This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.

However, this is considered acceptable given:

1. edk2 already defines a subset of supported compilers in
   BaseTools/Conf/tools_def.template, all of which have supported
   `#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
   include guard naming and potential macro collisions.

Approximate compiler support dates:

- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
  (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-23 21:01:28 +00:00
Dongyan Qian
4890db2abc NetworkPkg/UefiPxeBcDxe: Fix typo in Buffer parameter description
The comment for the Buffer parameter incorrectly said
"then no the size" instead of "then the size".
This patch fixes the typo only; no functional changes.

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2026-01-23 10:46:37 +00:00
Daniel
19fc4b7f50 NetworkPkg: Add VS2026 toolchain support
* Add VS2026 to toolchain check in NetworkPkgHostTest.dsc.

Signed-off-by: Daniel Grobert <danalexgro@gmail.com>
2026-01-07 20:19:12 +00:00
Qihang Gao
fe94475538 NetworkPkg: Add RngLib mapping for LOONGARCH64
NetworkPkg will build failed on LOONGARCH64 platform, because
LOONGARCH64 don't support MdePkg/Library/BaseRngLib. So add
MdeModulePkg/Library/BaseRngLibTimerLib as BaseRngLib of
LOONGARCH64 platform.

Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Cc: Chao Li <lichao@loongson.cn>
2025-12-29 17:07:36 +00:00
Mike Beaton
51b58f4cd9 NetworkPkg: Remove unused variable
XCODE5 toolchain finds this, with error:
WifiConnectionMgrHiiConfigAccess.c:393:29: error: variable 'AvailableCount' set but not used

Fixes: 90b24889f9

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-11-22 01:43:26 +00:00
Philipp Schuster
d5df66e297 NetworkPkg: fix various typos
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2025-11-21 21:49:59 +00:00
Mike Beaton
b197541f29 OvmfPkg,ArmVirtPkg,NetworkPkg: Fix build with -D NETWORK_ENABLE=0
Previous PR https://github.com/tianocore/edk2/pull/6087 restored the
ability to build OvmfPkg with -D NETWORK_ENABLE=0.

b3b3cfab7e has broken it again, since the
.dsc references to OvmfPkg/VirtioNetDxe/VirtioNet.inf were moved from
outside !if $(NETWORK_ENABLE) == TRUE to inside it, while the .fdf
references remained outside.

In discussion in https://github.com/tianocore/edk2/pull/11719 it was
decided to move the .fdf references inside the conditional, i.e. not to
include VirtioNetDxe unless the rest of the network stack is being built.

Removal of VirtioNetDxe driver on -D NETWORK_ENABLE=0 has only
been applied to those packages which are already using
OvmfPkg/Dsc/Includes/NetworkComponents.dsc.inc.

f9408b7cc1 introduces new PCDs which also
need to be moved inside a NETWORK_ENABLE test in order to allow building
with -D NETWORK_ENABLE=0, which is also done here.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-11-21 12:08:00 +01:00
eeshanl
9b71501f6c NetworkPkg/SnpDxe: Fix Snp used uninitialized
Ensures the Snp Structure is initialized as NULL.

Signed-off-by: Eeshan Londhe <eeshanlondhe@microsoft.com>
2025-10-31 19:35:42 +00:00
Sathya Ravichandran
41f7c0cd9e NetworkPkg: Remove DXE_SAL_DRIVER
The DXE_SAL_DRIVER module type was introduced to support
Itanium (IPF) platforms. Since support for Itanium processors has been
dropped, the instances of DXE_SAL_DRIVER have been removed.

Ref: [3cb0a311cb]

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Sathya Ravichandran <sathyar@ami.com>
2025-10-30 10:00:32 +00:00
eeshanl
302cc88ab3 NetworkPkg/SnpDxe: Update SnpDxe SNP_DRIVER struct out of DMA-able memory.
CPB, DB, and CDB structs to use DMA-able memory.

Updates the overall SNP_DRIVER allocation to use AllocatePool() instead of PciIo->AllocateBuffer(). This moves this struct out of DMA-able memory.
Allocates the PXE_CDB struct as a pointer instead, using PciIo->AllocateBuffer() for DMA-able memory.

End result:
CPB, DB, and CDB are allocated with individual PciIo->AllocateBuffer() calls with a size of 4096 for CPB and DB. and sizeof(PXE_CDB) for CDB.
Each of these members point to locations within the Allocated Buffer, and all of these pointers are at-least
8-Byte aligned.
SNP_DRIVER is allocated with AllocatePool()
In the SNP_DRIVER structure, the PXE_CDB member is changed to a pointer so we can allocate it with PciIo->AllocateBuffer()

Signed-off-by: Eeshan Londhe <eeshanlondhe@microsoft.com>
2025-10-29 18:32:42 +00:00
Marc Chen
d3a64baf4b NetworkPkg/UefiPxeBcDxe: Add buffer check before reporting status code
When PxeBcLoadBootFile() fails, it reports a status code to notify
listeners (such as telemetry/SEL logging drivers) about the error.
However, the current implementation reports the status code for all
error conditions, including benign cases, such as where the caller passes
Buffer == NULL with EFI_BUFFER_TOO_SMALL to query the required size.

This causes false positive error reports in telemetry systems, as
EFI_BUFFER_TOO_SMALL with Buffer == NULL is an expected and normal
operation for size queries, not an actual error condition.

The PXE-E05 error message is already correctly guarded with the
condition "(Status == EFI_BUFFER_TOO_SMALL) && (Buffer != NULL)",
but the status code reporting was unconditional.

Add a buffer null check before REPORT_STATUS_CODE_WITH_EXTENDED_DATA
to ensure status codes are only reported for actual errors:
- Report when Status != EFI_BUFFER_TOO_SMALL (all other errors)
- Report when Status == EFI_BUFFER_TOO_SMALL AND Buffer != NULL (PXE-E05)
- Skip when Status == EFI_BUFFER_TOO_SMALL AND Buffer == NULL (size query)

This prevents spurious error logs while maintaining proper error
reporting for genuine failures including PXE-E05, PXE-E07, PXE-E09,
PXE-E99, and all other error conditions.

Signed-off-by: Marc Chen <marc.chen@microsoft.com>
2025-10-01 16:46:03 +00:00
Pierre Gondois
432feb6b56 NetworkPkg: Use the newly introduced ShellPrintHiiDefaultEx() alias
Make use the newly introduced ShellPrintHiiDefaultEx() alias and
replace wherever it is possible:
- "ShellPrintHiiEx (-1, -1, NULL,"
with:
- "ShellPrintHiiDefaultEx ("

No functional change is introduced.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-10-01 10:02:57 +02:00
Oliver Smith-Denny
1764d4eb2b NetworkPkg: Drop ARM32 Support
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 code from NetworkPkg. This also drops
irrelevant VALID_ARCHITECTURES comments from infs that are
not arch specific.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
Michael D Kinney
9ac6e450e4 NetworkPkg/UefiPceBcDxe/GoogleTest: Add missing EFIAPI
CLANGDWARF generates a build error for calling convention
mismatch in UdpRead(), UdpWrite(), and Configure() mock
functions.  Add EFIAPI so mock function matches function
prototype of function being mocked.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-09-18 17:25:38 +00:00
Michael D Kinney
b05c8d7b80 NetworkPkg/Dhcp6Dxe/GoogleTest: Fix init of complex struct
CLANGDWARF generates build error for missing braces when
initializing a complex structure. Change initialization of
EFI_DHCP6_IA local variable to a call to ZeroMem() instead.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-09-18 17:25:38 +00:00
INDIA\kanagavels
41cde6e2e3 NetworkPkg/TlsDxe: Add SNI support
Add Server Name Indication Support.

Signed-off-by: Kanagavel S <kanagavels@ami.com>
2025-09-04 08:32:34 +00:00
Zachary Clark-Williams
d188ad6a1f NetworkPkg/WifiConnectionManagerDxe: UI Disconnect
- Fix WifiMgrOnTimerTick to ensure the timer does
not exit early when a disconnect is pending,
allowing UI-initiated disconnects to complete as
expected.

Signed-off-by: Zachary Clark-Williams <Zachary.Clark-Williams@intel.com>
2025-08-25 18:24:32 +00:00
Abdul Lateef Attar
66cc827270 NetworkPkg: Correct spelling errors and typos
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-07-04 09:41:47 +08:00
Zachary Clark-Williams
0cb71c18c5 NetworkPkg/WifiConnectionManager: net list scan ui
Commit 7c204d7 changed the behavior of the WiFi
Connection Manager. It no longer scans for available
networks when the driver loads, because scanning
during that time disrupts connections for other
features. To avoid blocking other processes, the
driver should initiate a scan only when appropriate.
This update introduces a one-time scan that occurs
when the user opens the network settings page in
the UI, enables WiFi, and then opens the network
list page to view available networks.

Signed-off-by: Zachary Clark-Williams <zachary.clark-williams@intel.com>
2025-06-25 11:49:21 +00:00
Zachary Clark-Williams
d82e9b7bbb WifiConnectionManagerDxe: clear timers not events
Replace timer eventclose with scan timerset in WifiConnectionManagerDxe.
This change ensures that the driver sets and manages scan timers
correctly without requiring a reload when the user enables WiFi and
initiates a scan for available networks.

By using scan timerset directly, the driver maintains consistent
behavior across WiFi sessions and avoids redundant event handling.

Signed-off-by: Zachary Clark-Williams <zachary.clark-williams@intel.com>
2025-06-25 01:21:51 +00:00
Zachary Clark-Williams
da7b74161b WifiConnectionManagerDxe: HII missing EAP TLS case
Add missing EAP-TLS option to HII configuration

Implemented support for EAP-TLS authentication in
the WifiConnectionManagerDxe HII interface. This
change ensures that the EAP-TLS option is available
for selection in the UI, addressing cases where it
was previously missing.

Signed-off-by: Zachary Clark-Williams <Zachary.Clark-Williams@intel.com>
2025-06-25 00:28:42 +00:00
Michael D Kinney
36a71d088b NetworkPkg: Use Library/GoogleTestLib.h
Update unit tests to use GoogleTestLib.h instead
of gtest.h so the edk2 extensions for google tests
are always available.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-06-24 19:32:41 +00:00
Rebecca Cran
0dde8cd314 NetworkPkg: Change 'Tls' to 'TLS'
Sicne it's a user-visible string, change 'Tls' to 'TLS', which is
more correct.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-06-16 23:03:46 +00:00