edk2/edk2-NetworkPkg-Apply-uncrustify-changes-p2.patch

2055 lines
64 KiB
Diff
Raw Permalink Normal View History

* Tue Feb 27 2024 Miroslav Rezanina <mrezanin@redhat.com> - 20220126gitbb1bba3d77-12 - edk2-Apply-uncrustify-changes-to-.c-.h-files-in-the-Netwo.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Ip6Dxe-SECURITY-PATCH-CVE-2023-45231-Patc.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Ip6Dxe-SECURITY-PATCH-CVE-2023-45231-Unit.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Ip6Dxe-SECURITY-PATCH-CVE-2023-45232-Patc.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Ip6Dxe-SECURITY-PATCH-CVE-2023-45232-Unit.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Apply-uncrustify-changes.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-UefiPxeBcDxe-SECURITY-PATCH-CVE-2023-4523.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-UefiPxeBcDxe-SECURITY-PATCH-CVE-2023-4523p2.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-UefiPxeBcDxe-SECURITY-PATCH-CVE-2023-4523p3.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-UefiPxeBcDxe-SECURITY-PATCH-CVE-2023-4523p4.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Adds-a-SecurityFix.yaml-file.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Apply-uncrustify-changes-p2.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Dhcp6Dxe-SECURITY-PATCH-CVE-2023-45229-Re.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Dhcp6Dxe-Removes-duplicate-check-and-repl.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - edk2-NetworkPkg-Dhcp6Dxe-Packet-Length-is-not-updated-bef.patch [RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852] - Resolves: RHEL-21840 (CVE-2023-45229 edk2: Integer underflow when processing IA_NA/IA_TA options in a DHCPv6 Advertise message [rhel-8]) - Resolves: RHEL-21844 (CVE-2023-45231 edk2: Out of Bounds read when handling a ND Redirect message with truncated options [rhel-8]) - Resolves: RHEL-21846 (CVE-2023-45232 edk2: Infinite loop when parsing unknown options in the Destination Options header [rhel-8]) - Resolves: RHEL-21848 (CVE-2023-45233 edk2: Infinite loop when parsing a PadN option in the Destination Options header [rhel-8]) - Resolves: RHEL-21850 (CVE-2023-45234 edk2: Buffer overflow when processing DNS Servers option in a DHCPv6 Advertise message [rhel-8]) - Resolves: RHEL-21852 (CVE-2023-45235 edk2: Buffer overflow when handling Server ID option from a DHCPv6 proxy Advertise message [rhel-8])
2024-02-27 11:10:11 +00:00
From f7e6d9e61173d76ab9827e1af62dc9966a21e14c Mon Sep 17 00:00:00 2001
From: Jon Maloy <jmaloy@redhat.com>
Date: Fri, 16 Feb 2024 17:28:51 -0500
Subject: [PATCH 12/15] NetworkPkg: Apply uncrustify changes
RH-Author: Jon Maloy <jmaloy@redhat.com>
RH-MergeRequest: 56: Pixiefail issues in NetworkPkg package
RH-Jira: RHEL-21840 RHEL-21844 RHEL-21846 RHEL-21848 RHEL-21850 RHEL-21852
RH-Acked-by: Gerd Hoffmann <None>
RH-Acked-by: Oliver Steffen <osteffen@redhat.com>
RH-Commit: [12/15] 880596c246c87181f19fcb0a7a21f4e32d234c13
JIRA: https://issues.redhat.com/browse/RHEL-21840
CVE: CVE-2022-45229
Upstream: Merged
Conflicts: There has already been added two commits after the point where
this commit was added upstream, so we cannot apply that commit,
or even parts of it, directly. Instead, we only introduce the
whitespace changes needed to make future commits touching
the file NetworkPkg/Dhcp6Dxe/Dhcp6Io.c apply cleanly.
commit d1050b9dff1cace252aff86630bfdb59dff5f507
Author: Michael Kubacki <michael.kubacki@microsoft.com>
Date: Sun Dec 5 14:54:07 2021 -0800
NetworkPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the NetworkPkg package
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
NetworkPkg/Dhcp6Dxe/Dhcp6Io.c | 1091 ++++++++++++++++-----------------
1 file changed, 529 insertions(+), 562 deletions(-)
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
index d680febbf1..3b8feb4a20 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
@@ -10,7 +10,6 @@
#include "Dhcp6Impl.h"
-
/**
Enqueue the packet into the retry list in case of timeout.
@@ -34,8 +33,8 @@ Dhcp6EnqueueRetry (
IN EFI_DHCP6_RETRANSMISSION *RetryCtl OPTIONAL
)
{
- DHCP6_TX_CB *TxCb;
- DHCP6_IA_CB *IaCb;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_IA_CB *IaCb;
ASSERT (Packet != NULL);
@@ -55,156 +54,156 @@ Dhcp6EnqueueRetry (
//
// Save pointer to elapsed-time value so we can update it on retransmits.
//
- TxCb->Elapsed = Elapsed;
+ TxCb->Elapsed = Elapsed;
//
// Calculate the retransmission according to the message type.
//
switch (Packet->Dhcp6.Header.MessageType) {
- case Dhcp6MsgSolicit:
- //
- // Calculate the retransmission threshold value for solicit packet.
- // Use the default value by rfc-3315 if user doesn't configure.
- //
- if (RetryCtl == NULL) {
- TxCb->RetryCtl.Irt = DHCP6_SOL_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_SOL_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_SOL_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_SOL_MRD;
- } else {
- TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_SOL_IRT;
- TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_SOL_MRC;
- TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_SOL_MRT;
- TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_SOL_MRD;
- }
+ case Dhcp6MsgSolicit:
+ //
+ // Calculate the retransmission threshold value for solicit packet.
+ // Use the default value by rfc-3315 if user doesn't configure.
+ //
+ if (RetryCtl == NULL) {
+ TxCb->RetryCtl.Irt = DHCP6_SOL_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_SOL_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_SOL_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_SOL_MRD;
+ } else {
+ TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_SOL_IRT;
+ TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_SOL_MRC;
+ TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_SOL_MRT;
+ TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_SOL_MRD;
+ }
+
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ FALSE
+ );
+ break;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ case Dhcp6MsgRequest:
+ //
+ // Calculate the retransmission threshold value for request packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REQ_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REQ_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REQ_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_REQ_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
TxCb->RetryCtl.Irt,
TRUE,
- FALSE
+ TRUE
);
- break;
-
- case Dhcp6MsgRequest:
- //
- // Calculate the retransmission threshold value for request packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REQ_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REQ_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REQ_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_REQ_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
-
- case Dhcp6MsgConfirm:
- //
- // Calculate the retransmission threshold value for confirm packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_CNF_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_CNF_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_CNF_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_CNF_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
-
- case Dhcp6MsgRenew:
- //
- // Calculate the retransmission threshold value for renew packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REB_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REB_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REB_MRT;
- TxCb->RetryCtl.Mrd = IaCb->T2 - IaCb->T1;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ break;
- case Dhcp6MsgRebind:
- //
- // Calculate the retransmission threshold value for rebind packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REN_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REN_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REN_MRT;
- TxCb->RetryCtl.Mrd = IaCb->AllExpireTime - IaCb->T2;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ case Dhcp6MsgConfirm:
+ //
+ // Calculate the retransmission threshold value for confirm packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_CNF_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_CNF_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_CNF_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_CNF_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- case Dhcp6MsgDecline:
- //
- // Calculate the retransmission threshold value for decline packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_DEC_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_DEC_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_DEC_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_DEC_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ case Dhcp6MsgRenew:
+ //
+ // Calculate the retransmission threshold value for renew packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REB_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REB_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REB_MRT;
+ TxCb->RetryCtl.Mrd = IaCb->T2 - IaCb->T1;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- case Dhcp6MsgRelease:
- //
- // Calculate the retransmission threshold value for release packet.
- //
- TxCb->RetryCtl.Irt = DHCP6_REL_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_REL_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_REL_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_REL_MRD;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
- TxCb->RetryCtl.Irt,
- TRUE,
- TRUE
- );
- break;
+ case Dhcp6MsgRebind:
+ //
+ // Calculate the retransmission threshold value for rebind packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REN_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REN_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REN_MRT;
+ TxCb->RetryCtl.Mrd = IaCb->AllExpireTime - IaCb->T2;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- case Dhcp6MsgInfoRequest:
- //
- // Calculate the retransmission threshold value for info-request packet.
- // Use the default value by rfc-3315 if user doesn't configure.
- //
- if (RetryCtl == NULL) {
- TxCb->RetryCtl.Irt = DHCP6_INF_IRT;
- TxCb->RetryCtl.Mrc = DHCP6_INF_MRC;
- TxCb->RetryCtl.Mrt = DHCP6_INF_MRT;
- TxCb->RetryCtl.Mrd = DHCP6_INF_MRD;
- } else {
- TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_INF_IRT;
- TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_INF_MRC;
- TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_INF_MRT;
- TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_INF_MRD;
- }
+ case Dhcp6MsgDecline:
+ //
+ // Calculate the retransmission threshold value for decline packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_DEC_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_DEC_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_DEC_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_DEC_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
- TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ case Dhcp6MsgRelease:
+ //
+ // Calculate the retransmission threshold value for release packet.
+ //
+ TxCb->RetryCtl.Irt = DHCP6_REL_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_REL_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_REL_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_REL_MRD;
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
TxCb->RetryCtl.Irt,
TRUE,
TRUE
);
- break;
+ break;
- default:
- //
- // Unexpected message type.
- //
- FreePool(TxCb);
- return EFI_DEVICE_ERROR;
+ case Dhcp6MsgInfoRequest:
+ //
+ // Calculate the retransmission threshold value for info-request packet.
+ // Use the default value by rfc-3315 if user doesn't configure.
+ //
+ if (RetryCtl == NULL) {
+ TxCb->RetryCtl.Irt = DHCP6_INF_IRT;
+ TxCb->RetryCtl.Mrc = DHCP6_INF_MRC;
+ TxCb->RetryCtl.Mrt = DHCP6_INF_MRT;
+ TxCb->RetryCtl.Mrd = DHCP6_INF_MRD;
+ } else {
+ TxCb->RetryCtl.Irt = (RetryCtl->Irt != 0) ? RetryCtl->Irt : DHCP6_INF_IRT;
+ TxCb->RetryCtl.Mrc = (RetryCtl->Mrc != 0) ? RetryCtl->Mrc : DHCP6_INF_MRC;
+ TxCb->RetryCtl.Mrt = (RetryCtl->Mrt != 0) ? RetryCtl->Mrt : DHCP6_INF_MRT;
+ TxCb->RetryCtl.Mrd = (RetryCtl->Mrd != 0) ? RetryCtl->Mrd : DHCP6_INF_MRD;
+ }
+
+ TxCb->RetryExp = Dhcp6CalculateExpireTime (
+ TxCb->RetryCtl.Irt,
+ TRUE,
+ TRUE
+ );
+ break;
+
+ default:
+ //
+ // Unexpected message type.
+ //
+ FreePool (TxCb);
+ return EFI_DEVICE_ERROR;
}
//
@@ -215,7 +214,6 @@ Dhcp6EnqueueRetry (
return EFI_SUCCESS;
}
-
/**
Dequeue the packet from retry list if reply received or timeout at last.
@@ -230,40 +228,36 @@ Dhcp6EnqueueRetry (
**/
EFI_STATUS
Dhcp6DequeueRetry (
- IN DHCP6_INSTANCE *Instance,
- IN UINT32 PacketXid,
- IN BOOLEAN NeedSignal
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT32 PacketXid,
+ IN BOOLEAN NeedSignal
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- DHCP6_TX_CB *TxCb;
- DHCP6_INF_CB *InfCb;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_INF_CB *InfCb;
//
// Seek the retransmit node in the retransmit list by packet xid.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
if (TxCb->Xid == PacketXid) {
-
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
-
//
// Seek the info-request node in the info-request list by packet xid.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
-
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
if (InfCb->Xid == PacketXid) {
//
// Remove the info-request node, and signal the event if timeout.
//
- if (InfCb->TimeoutEvent != NULL && NeedSignal) {
+ if ((InfCb->TimeoutEvent != NULL) && NeedSignal) {
gBS->SignalEvent (InfCb->TimeoutEvent);
}
@@ -272,11 +266,12 @@ Dhcp6DequeueRetry (
}
}
}
+
//
// Remove the retransmit node.
//
RemoveEntryList (&TxCb->Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
FreePool (TxCb->TxPacket);
FreePool (TxCb);
return EFI_SUCCESS;
@@ -286,7 +281,6 @@ Dhcp6DequeueRetry (
return EFI_NOT_FOUND;
}
-
/**
Clean up the specific nodes in the retry list.
@@ -296,24 +290,22 @@ Dhcp6DequeueRetry (
**/
VOID
Dhcp6CleanupRetry (
- IN DHCP6_INSTANCE *Instance,
- IN UINT32 Scope
+ IN DHCP6_INSTANCE *Instance,
+ IN UINT32 Scope
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- DHCP6_TX_CB *TxCb;
- DHCP6_INF_CB *InfCb;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_INF_CB *InfCb;
//
// Clean up all the stateful messages from the retransmit list.
//
- if (Scope == DHCP6_PACKET_STATEFUL || Scope == DHCP6_PACKET_ALL) {
-
+ if ((Scope == DHCP6_PACKET_STATEFUL) || (Scope == DHCP6_PACKET_ALL)) {
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
if (TxCb->TxPacket->Dhcp6.Header.MessageType != Dhcp6MsgInfoRequest) {
RemoveEntryList (&TxCb->Link);
@@ -326,15 +318,13 @@ Dhcp6CleanupRetry (
//
// Clean up all the stateless messages from the retransmit list.
//
- if (Scope == DHCP6_PACKET_STATELESS || Scope == DHCP6_PACKET_ALL) {
-
+ if ((Scope == DHCP6_PACKET_STATELESS) || (Scope == DHCP6_PACKET_ALL)) {
//
// Clean up all the retransmit list for stateless messages.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
- ASSERT(TxCb->TxPacket);
+ ASSERT (TxCb->TxPacket);
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
RemoveEntryList (&TxCb->Link);
@@ -347,12 +337,12 @@ Dhcp6CleanupRetry (
// Clean up all the info-request messages list.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->InfList) {
-
InfCb = NET_LIST_USER_STRUCT (Entry, DHCP6_INF_CB, Link);
if (InfCb->TimeoutEvent != NULL) {
gBS->SignalEvent (InfCb->TimeoutEvent);
}
+
RemoveEntryList (&InfCb->Link);
FreePool (InfCb);
}
@@ -371,11 +361,11 @@ Dhcp6CleanupRetry (
**/
BOOLEAN
Dhcp6IsValidTxCb (
- IN DHCP6_INSTANCE *Instance,
- IN DHCP6_TX_CB *TxCb
+ IN DHCP6_INSTANCE *Instance,
+ IN DHCP6_TX_CB *TxCb
)
{
- LIST_ENTRY *Entry;
+ LIST_ENTRY *Entry;
NET_LIST_FOR_EACH (Entry, &Instance->TxList) {
if (TxCb == NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link)) {
@@ -395,15 +385,15 @@ Dhcp6IsValidTxCb (
**/
VOID
Dhcp6CleanupSession (
- IN OUT DHCP6_INSTANCE *Instance,
- IN EFI_STATUS Status
+ IN OUT DHCP6_INSTANCE *Instance,
+ IN EFI_STATUS Status
)
{
- UINTN Index;
- EFI_DHCP6_IA *Ia;
+ UINTN Index;
+ EFI_DHCP6_IA *Ia;
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
//
// Clean up the retransmit list for stateful messages.
@@ -425,23 +415,23 @@ Dhcp6CleanupSession (
//
// Reinitialize the Ia fields of the instance.
//
- Instance->UdpSts = Status;
- Instance->AdSelect = NULL;
- Instance->AdPref = 0;
- Instance->Unicast = NULL;
- Instance->IaCb.T1 = 0;
- Instance->IaCb.T2 = 0;
- Instance->IaCb.AllExpireTime = 0;
- Instance->IaCb.LeaseTime = 0;
+ Instance->UdpSts = Status;
+ Instance->AdSelect = NULL;
+ Instance->AdPref = 0;
+ Instance->Unicast = NULL;
+ Instance->IaCb.T1 = 0;
+ Instance->IaCb.T2 = 0;
+ Instance->IaCb.AllExpireTime = 0;
+ Instance->IaCb.LeaseTime = 0;
//
// Clear start time
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
- Ia = Instance->IaCb.Ia;
- Ia->State = Dhcp6Init;
- Ia->ReplyPacket = NULL;
+ Ia = Instance->IaCb.Ia;
+ Ia->State = Dhcp6Init;
+ Ia->ReplyPacket = NULL;
//
// Set the addresses as zero lifetime, and then the notify
@@ -461,7 +451,6 @@ Dhcp6CleanupSession (
}
}
-
/**
Callback to user when Dhcp6 transmit/receive occurs.
@@ -477,15 +466,15 @@ Dhcp6CleanupSession (
EFI_STATUS
EFIAPI
Dhcp6CallbackUser (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_EVENT Event,
- IN OUT EFI_DHCP6_PACKET **Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_EVENT Event,
+ IN OUT EFI_DHCP6_PACKET **Packet
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *NewPacket;
- EFI_DHCP6_CALLBACK Callback;
- VOID *Context;
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *NewPacket;
+ EFI_DHCP6_CALLBACK Callback;
+ VOID *Context;
ASSERT (Packet != NULL);
ASSERT (Instance->Config != NULL);
@@ -500,7 +489,6 @@ Dhcp6CallbackUser (
// Callback to user with the new message if has.
//
if (Callback != NULL) {
-
Status = Callback (
&Instance->Dhcp6,
Context,
@@ -522,7 +510,6 @@ Dhcp6CallbackUser (
return Status;
}
-
/**
Update Ia according to the new reply message.
@@ -535,17 +522,17 @@ Dhcp6CallbackUser (
**/
EFI_STATUS
Dhcp6UpdateIaInfo (
- IN OUT DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN OUT DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 *Option;
- UINT8 *IaInnerOpt;
- UINT16 IaInnerLen;
- UINT16 StsCode;
- UINT32 T1;
- UINT32 T2;
+ EFI_STATUS Status;
+ UINT8 *Option;
+ UINT8 *IaInnerOpt;
+ UINT16 IaInnerLen;
+ UINT16 StsCode;
+ UINT32 T1;
+ UINT32 T2;
ASSERT (Instance->Config != NULL);
//
@@ -618,9 +605,10 @@ Dhcp6UpdateIaInfo (
// and both T1 and T2 are greater than 0, the client discards the IA_NA option and processes
// the remainder of the message as though the server had not included the invalid IA_NA option.
//
- if (T1 > T2 && T2 > 0) {
+ if ((T1 > T2) && (T2 > 0)) {
return EFI_DEVICE_ERROR;
}
+
IaInnerOpt = DHCP6_OFFSET_OF_IA_NA_INNER_OPT (Option);
IaInnerLen = (UINT16)(NTOHS (ReadUnaligned16 ((UINT16 *)(DHCP6_OFFSET_OF_OPT_LEN (Option)))) - DHCP6_SIZE_OF_COMBINED_IAID_T1_T2);
} else {
@@ -674,8 +662,6 @@ Dhcp6UpdateIaInfo (
return Status;
}
-
-
/**
Seeks the Inner Options from a DHCP6 Option
@@ -772,9 +758,9 @@ Dhcp6SeekInnerOptionSafe (
**/
EFI_STATUS
Dhcp6SeekStsOption (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet,
- OUT UINT8 **Option
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet,
+ OUT UINT8 **Option
)
{
UINT8 *IaInnerOpt;
@@ -830,7 +816,7 @@ Dhcp6SeekStsOption (
// IA option to the end of the DHCP6 option area, thus subtract the space
// up until this option
//
- OptionLen = OptionLen - (*Option - Packet->Dhcp6.Option);
+ OptionLen = OptionLen - (UINT32)(*Option - Packet->Dhcp6.Option);
//
// Seek the inner option
@@ -867,7 +853,7 @@ Dhcp6SeekStsOption (
//
// sizeof (option-code + option-len) = 4
//
- *Option = Dhcp6SeekOption (IaInnerOpt, IaInnerLen, Dhcp6OptStatusCode);
+ *Option = Dhcp6SeekOption (IaInnerOpt, IaInnerLen, Dhcp6OptStatusCode);
if (*Option != NULL) {
StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)((DHCP6_OFFSET_OF_STATUS_CODE (*Option)))));
if (StsCode != Dhcp6StsSuccess) {
@@ -878,7 +864,6 @@ Dhcp6SeekStsOption (
return EFI_SUCCESS;
}
-
/**
Transmit Dhcp6 message by udpio.
@@ -893,23 +878,23 @@ Dhcp6SeekStsOption (
**/
EFI_STATUS
Dhcp6TransmitPacket (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet,
- IN UINT16 *Elapsed
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet,
+ IN UINT16 *Elapsed
)
{
- EFI_STATUS Status;
- NET_BUF *Wrap;
- NET_FRAGMENT Frag;
- UDP_END_POINT EndPt;
- DHCP6_SERVICE *Service;
+ EFI_STATUS Status;
+ NET_BUF *Wrap;
+ NET_FRAGMENT Frag;
+ UDP_END_POINT EndPt;
+ DHCP6_SERVICE *Service;
Service = Instance->Service;
//
// Wrap it into a netbuf then send it.
//
- Frag.Bulk = (UINT8 *) &Packet->Dhcp6.Header;
+ Frag.Bulk = (UINT8 *)&Packet->Dhcp6.Header;
Frag.Len = Packet->Length;
//
@@ -970,7 +955,6 @@ Dhcp6TransmitPacket (
return EFI_SUCCESS;
}
-
/**
Create the solicit message and send it.
@@ -983,19 +967,19 @@ Dhcp6TransmitPacket (
**/
EFI_STATUS
Dhcp6SendSolicitMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- DHCP6_SERVICE *Service;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
Service = Instance->Service;
ClientId = Service->ClientId;
@@ -1069,7 +1053,6 @@ Dhcp6SendSolicitMsg (
// Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
-
UserOpt = Instance->Config->OptionList[Index];
Status = Dhcp6AppendOption (
Packet,
@@ -1139,17 +1122,16 @@ ON_ERROR:
**/
EFI_STATUS
Dhcp6InitSolicitMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- Instance->IaCb.T1 = 0;
- Instance->IaCb.T2 = 0;
+ Instance->IaCb.T1 = 0;
+ Instance->IaCb.T2 = 0;
Instance->IaCb.Ia->IaAddressCount = 0;
return Dhcp6SendSolicitMsg (Instance);
}
-
/**
Create the request message and send it.
@@ -1163,31 +1145,31 @@ Dhcp6InitSolicitMsg (
**/
EFI_STATUS
Dhcp6SendRequestMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
-
- ASSERT(Instance->AdSelect != NULL);
- ASSERT(Instance->Config != NULL);
- ASSERT(Instance->IaCb.Ia != NULL);
- ASSERT(Instance->Service != NULL);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
+
+ ASSERT (Instance->AdSelect != NULL);
+ ASSERT (Instance->Config != NULL);
+ ASSERT (Instance->IaCb.Ia != NULL);
+ ASSERT (Instance->Service != NULL);
Service = Instance->Service;
ClientId = Service->ClientId;
- ASSERT(ClientId != NULL);
+ ASSERT (ClientId != NULL);
//
// Get the server Id from the selected advertisement message.
@@ -1201,7 +1183,7 @@ Dhcp6SendRequestMsg (
return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Calculate the added length of customized option list.
@@ -1279,7 +1261,6 @@ Dhcp6SendRequestMsg (
// Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
-
UserOpt = Instance->Config->OptionList[Index];
Status = Dhcp6AppendOption (
Packet,
@@ -1334,7 +1315,6 @@ ON_ERROR:
return Status;
}
-
/**
Create the decline message and send it.
@@ -1349,20 +1329,20 @@ ON_ERROR:
**/
EFI_STATUS
Dhcp6SendDeclineMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *DecIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *DecIa
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET *LastReply;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT16 Length;
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET *LastReply;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT16 Length;
ASSERT (Instance->Config != NULL);
ASSERT (Instance->IaCb.Ia != NULL);
@@ -1390,7 +1370,7 @@ Dhcp6SendDeclineMsg (
//
// EFI_DHCP6_DUID contains a length field of 2 bytes.
//
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Create the Dhcp6 packet and initialize common fields.
@@ -1495,7 +1475,6 @@ ON_ERROR:
return Status;
}
-
/**
Create the release message and send it.
@@ -1510,30 +1489,30 @@ ON_ERROR:
**/
EFI_STATUS
Dhcp6SendReleaseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_IA *RelIa
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_IA *RelIa
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET *LastReply;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT16 Length;
-
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET *LastReply;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT16 Length;
+
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
Service = Instance->Service;
ClientId = Service->ClientId;
LastReply = Instance->IaCb.Ia->ReplyPacket;
- ASSERT(ClientId);
- ASSERT(LastReply);
+ ASSERT (ClientId);
+ ASSERT (LastReply);
//
// Get the server Id from the last reply message.
@@ -1547,7 +1526,7 @@ Dhcp6SendReleaseMsg (
return EFI_DEVICE_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
//
// Create the Dhcp6 packet and initialize common fields.
@@ -1651,7 +1630,6 @@ ON_ERROR:
return Status;
}
-
/**
Create the renew/rebind message and send it.
@@ -1667,33 +1645,33 @@ ON_ERROR:
**/
EFI_STATUS
Dhcp6SendRenewRebindMsg (
- IN DHCP6_INSTANCE *Instance,
- IN BOOLEAN RebindRequest
+ IN DHCP6_INSTANCE *Instance,
+ IN BOOLEAN RebindRequest
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET *LastReply;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_DUID *ServerId;
- EFI_DHCP6_STATE State;
- EFI_DHCP6_EVENT Event;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
-
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET *LastReply;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_DUID *ServerId;
+ EFI_DHCP6_STATE State;
+ EFI_DHCP6_EVENT Event;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
- Service = Instance->Service;
- ClientId = Service->ClientId;
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
- ASSERT(ClientId);
+ Service = Instance->Service;
+ ClientId = Service->ClientId;
+
+ ASSERT (ClientId);
//
// Calculate the added length of customized option list.
@@ -1774,7 +1752,7 @@ Dhcp6SendRenewRebindMsg (
goto ON_ERROR;
}
- ServerId = (EFI_DHCP6_DUID *) (Option + 2);
+ ServerId = (EFI_DHCP6_DUID *)(Option + 2);
Status = Dhcp6AppendOption (
Packet,
@@ -1792,7 +1770,6 @@ Dhcp6SendRenewRebindMsg (
// Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < Instance->Config->OptionCount; Index++) {
-
UserOpt = Instance->Config->OptionList[Index];
Status = Dhcp6AppendOption (
Packet,
@@ -1811,8 +1788,8 @@ Dhcp6SendRenewRebindMsg (
//
// Callback to user with the packet to be sent and check the user's feedback.
//
- State = (RebindRequest) ? Dhcp6Rebinding : Dhcp6Renewing;
- Event = (RebindRequest) ? Dhcp6EnterRebinding : Dhcp6EnterRenewing;
+ State = (RebindRequest) ? Dhcp6Rebinding : Dhcp6Renewing;
+ Event = (RebindRequest) ? Dhcp6EnterRebinding : Dhcp6EnterRenewing;
Status = Dhcp6CallbackUser (Instance, Event, &Packet);
if (EFI_ERROR (Status)) {
@@ -1885,19 +1862,19 @@ Dhcp6StartInfoRequest (
IN VOID *CallbackContext OPTIONAL
)
{
- EFI_STATUS Status;
- DHCP6_INF_CB *InfCb;
- DHCP6_SERVICE *Service;
- EFI_TPL OldTpl;
+ EFI_STATUS Status;
+ DHCP6_INF_CB *InfCb;
+ DHCP6_SERVICE *Service;
+ EFI_TPL OldTpl;
- Service = Instance->Service;
+ Service = Instance->Service;
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Instance->UdpSts = EFI_ALREADY_STARTED;
//
// Create and initialize the control block for the info-request.
//
- InfCb = AllocateZeroPool (sizeof(DHCP6_INF_CB));
+ InfCb = AllocateZeroPool (sizeof (DHCP6_INF_CB));
if (InfCb == NULL) {
gBS->RestoreTPL (OldTpl);
@@ -1930,7 +1907,7 @@ Dhcp6StartInfoRequest (
//
// Register receive callback for the stateless exchange process.
//
- Status = UdpIoRecvDatagram(
+ Status = UdpIoRecvDatagram (
Service->UdpIo,
Dhcp6ReceivePacket,
Service,
@@ -1981,24 +1958,24 @@ Dhcp6SendInfoRequestMsg (
IN EFI_DHCP6_RETRANSMISSION *Retransmission
)
{
- EFI_STATUS Status;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- EFI_DHCP6_DUID *ClientId;
- DHCP6_SERVICE *Service;
- UINT8 *Cursor;
- UINT16 *Elapsed;
- UINT32 UserLen;
- UINTN Index;
- UINT16 Length;
-
- ASSERT(OptionRequest);
+ EFI_STATUS Status;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ EFI_DHCP6_DUID *ClientId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Cursor;
+ UINT16 *Elapsed;
+ UINT32 UserLen;
+ UINTN Index;
+ UINT16 Length;
+
+ ASSERT (OptionRequest);
Service = Instance->Service;
ClientId = Service->ClientId;
UserLen = NTOHS (OptionRequest->OpLen) + 4;
- ASSERT(ClientId);
+ ASSERT (ClientId);
//
// Calculate the added length of customized option list.
@@ -2021,7 +1998,7 @@ Dhcp6SendInfoRequestMsg (
Packet->Dhcp6.Header.MessageType = Dhcp6MsgInfoRequest;
Packet->Dhcp6.Header.TransactionId = Service->Xid++;
- InfCb->Xid = Packet->Dhcp6.Header.TransactionId;
+ InfCb->Xid = Packet->Dhcp6.Header.TransactionId;
//
// Assembly Dhcp6 options for info-request message.
@@ -2067,7 +2044,6 @@ Dhcp6SendInfoRequestMsg (
// Append user-defined when configurate Dhcp6 service.
//
for (Index = 0; Index < OptionCount; Index++) {
-
UserOpt = OptionList[Index];
Status = Dhcp6AppendOption (
Packet,
@@ -2110,7 +2086,6 @@ ON_ERROR:
return Status;
}
-
/**
Create the Confirm message and send it.
@@ -2124,19 +2099,19 @@ ON_ERROR:
**/
EFI_STATUS
Dhcp6SendConfirmMsg (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
- UINT8 *Cursor;
- UINTN Index;
- UINT16 Length;
- UINT32 UserLen;
- EFI_STATUS Status;
- DHCP6_SERVICE *Service;
- EFI_DHCP6_DUID *ClientId;
- EFI_DHCP6_PACKET *Packet;
- EFI_DHCP6_PACKET_OPTION *UserOpt;
- UINT16 *Elapsed;
+ UINT8 *Cursor;
+ UINTN Index;
+ UINT16 Length;
+ UINT32 UserLen;
+ EFI_STATUS Status;
+ DHCP6_SERVICE *Service;
+ EFI_DHCP6_DUID *ClientId;
+ EFI_DHCP6_PACKET *Packet;
+ EFI_DHCP6_PACKET_OPTION *UserOpt;
+ UINT16 *Elapsed;
ASSERT (Instance->Config != NULL);
ASSERT (Instance->IaCb.Ia != NULL);
@@ -2263,8 +2238,6 @@ ON_ERROR:
return Status;
}
-
-
/**
Handle with the Dhcp6 reply message.
@@ -2279,13 +2252,13 @@ ON_ERROR:
**/
EFI_STATUS
Dhcp6HandleReplyMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 *Option;
- UINT16 StsCode;
+ EFI_STATUS Status;
+ UINT8 *Option;
+ UINT16 StsCode;
ASSERT (Instance->Config != NULL);
ASSERT (Instance->IaCb.Ia != NULL);
@@ -2310,7 +2283,7 @@ Dhcp6HandleReplyMsg (
Dhcp6OptRapidCommit
);
- if ((Option != NULL && !Instance->Config->RapidCommit) || (Option == NULL && Instance->Config->RapidCommit)) {
+ if (((Option != NULL) && !Instance->Config->RapidCommit) || ((Option == NULL) && Instance->Config->RapidCommit)) {
return EFI_DEVICE_ERROR;
}
@@ -2318,11 +2291,11 @@ Dhcp6HandleReplyMsg (
// As to a valid reply packet in response to a request/renew/rebind packet,
// ignore the packet if not contains the Ia option
//
- if (Instance->IaCb.Ia->State == Dhcp6Requesting ||
- Instance->IaCb.Ia->State == Dhcp6Renewing ||
- Instance->IaCb.Ia->State == Dhcp6Rebinding
- ) {
-
+ if ((Instance->IaCb.Ia->State == Dhcp6Requesting) ||
+ (Instance->IaCb.Ia->State == Dhcp6Renewing) ||
+ (Instance->IaCb.Ia->State == Dhcp6Rebinding)
+ )
+ {
Option = Dhcp6SeekIaOption (
Packet->Dhcp6.Option,
Packet->Length,
@@ -2347,10 +2320,9 @@ Dhcp6HandleReplyMsg (
// the client considers the decline/release event completed regardless of the
// status code.
//
- if (Instance->IaCb.Ia->State == Dhcp6Declining || Instance->IaCb.Ia->State == Dhcp6Releasing) {
-
+ if ((Instance->IaCb.Ia->State == Dhcp6Declining) || (Instance->IaCb.Ia->State == Dhcp6Releasing)) {
if (Instance->IaCb.Ia->IaAddressCount != 0) {
- Instance->IaCb.Ia->State = Dhcp6Bound;
+ Instance->IaCb.Ia->State = Dhcp6Bound;
} else {
ASSERT (Instance->IaCb.Ia->ReplyPacket);
FreePool (Instance->IaCb.Ia->ReplyPacket);
@@ -2373,7 +2345,7 @@ Dhcp6HandleReplyMsg (
//
// Reset start time for next exchange.
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
Status = EFI_SUCCESS;
goto ON_EXIT;
@@ -2400,7 +2372,7 @@ Dhcp6HandleReplyMsg (
//
// Reset start time for next exchange.
//
- Instance->StartTime = 0;
+ Instance->StartTime = 0;
//
// Set bound state and store the reply packet.
@@ -2423,7 +2395,7 @@ Dhcp6HandleReplyMsg (
//
// For sync, set the success flag out of polling in start/renewrebind.
//
- Instance->UdpSts = EFI_SUCCESS;
+ Instance->UdpSts = EFI_SUCCESS;
//
// Maybe this is a new round DHCP process due to some reason, such as NotOnLink
@@ -2449,70 +2421,72 @@ Dhcp6HandleReplyMsg (
}
goto ON_EXIT;
-
} else if (Option != NULL) {
//
// Any error status code option is found.
//
StsCode = NTOHS (ReadUnaligned16 ((UINT16 *)((DHCP6_OFFSET_OF_STATUS_CODE (Option)))));
switch (StsCode) {
- case Dhcp6StsUnspecFail:
- //
- // It indicates the server is unable to process the message due to an
- // unspecified failure condition, so just retry if possible.
- //
- break;
-
- case Dhcp6StsUseMulticast:
- //
- // It indicates the server receives a message via unicast from a client
- // to which the server has not sent a unicast option, so retry it by
- // multi-cast address.
- //
- if (Instance->Unicast != NULL) {
- FreePool (Instance->Unicast);
- Instance->Unicast = NULL;
- }
- break;
-
- case Dhcp6StsNotOnLink:
- if (Instance->IaCb.Ia->State == Dhcp6Confirming) {
+ case Dhcp6StsUnspecFail:
//
- // Before initiate new round DHCP, cache the current IA.
+ // It indicates the server is unable to process the message due to an
+ // unspecified failure condition, so just retry if possible.
//
- Status = Dhcp6CacheIa (Instance);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ break;
+ case Dhcp6StsUseMulticast:
//
- // Restart S.A.R.R process to acquire new address.
+ // It indicates the server receives a message via unicast from a client
+ // to which the server has not sent a unicast option, so retry it by
+ // multi-cast address.
//
- Status = Dhcp6InitSolicitMsg (Instance);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (Instance->Unicast != NULL) {
+ FreePool (Instance->Unicast);
+ Instance->Unicast = NULL;
}
- }
- break;
- case Dhcp6StsNoBinding:
- if (Instance->IaCb.Ia->State == Dhcp6Renewing || Instance->IaCb.Ia->State == Dhcp6Rebinding) {
- //
- // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client
- // sends a Request message if the IA contained a Status Code option with the NoBinding status.
- //
- Status = Dhcp6SendRequestMsg(Instance);
- if (EFI_ERROR (Status)) {
- return Status;
+ break;
+
+ case Dhcp6StsNotOnLink:
+ if (Instance->IaCb.Ia->State == Dhcp6Confirming) {
+ //
+ // Before initiate new round DHCP, cache the current IA.
+ //
+ Status = Dhcp6CacheIa (Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Restart S.A.R.R process to acquire new address.
+ //
+ Status = Dhcp6InitSolicitMsg (Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
- }
- break;
- default:
- //
- // The other status code, just restart solicitation.
- //
- break;
+ break;
+
+ case Dhcp6StsNoBinding:
+ if ((Instance->IaCb.Ia->State == Dhcp6Renewing) || (Instance->IaCb.Ia->State == Dhcp6Rebinding)) {
+ //
+ // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message, the client
+ // sends a Request message if the IA contained a Status Code option with the NoBinding status.
+ //
+ Status = Dhcp6SendRequestMsg (Instance);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ break;
+
+ default:
+ //
+ // The other status code, just restart solicitation.
+ //
+ break;
}
}
@@ -2520,7 +2494,7 @@ Dhcp6HandleReplyMsg (
ON_EXIT:
- if (!EFI_ERROR(Status)) {
+ if (!EFI_ERROR (Status)) {
Status = Dhcp6DequeueRetry (
Instance,
Packet->Dhcp6.Header.TransactionId,
@@ -2531,7 +2505,6 @@ ON_EXIT:
return Status;
}
-
/**
Select the appointed Dhcp6 advertisement message.
@@ -2545,12 +2518,12 @@ ON_EXIT:
**/
EFI_STATUS
Dhcp6SelectAdvertiseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *AdSelect
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *AdSelect
)
{
- EFI_STATUS Status;
- UINT8 *Option;
+ EFI_STATUS Status;
+ UINT8 *Option;
ASSERT (AdSelect != NULL);
@@ -2575,7 +2548,7 @@ Dhcp6SelectAdvertiseMsg (
FALSE
);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
@@ -2583,15 +2556,14 @@ Dhcp6SelectAdvertiseMsg (
// Check whether there is server unicast option in the selected advertise
// packet, and update it.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
AdSelect->Dhcp6.Option,
AdSelect->Length - sizeof (EFI_DHCP6_HEADER),
Dhcp6OptServerUnicast
);
if (Option != NULL) {
-
- Instance->Unicast = AllocateZeroPool (sizeof(EFI_IPv6_ADDRESS));
+ Instance->Unicast = AllocateZeroPool (sizeof (EFI_IPv6_ADDRESS));
if (Instance->Unicast == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -2615,7 +2587,6 @@ Dhcp6SelectAdvertiseMsg (
return Dhcp6SendRequestMsg (Instance);
}
-
/**
Handle with the Dhcp6 advertisement message.
@@ -2630,16 +2601,16 @@ Dhcp6SelectAdvertiseMsg (
**/
EFI_STATUS
Dhcp6HandleAdvertiseMsg (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- UINT8 *Option;
- BOOLEAN Timeout;
+ EFI_STATUS Status;
+ UINT8 *Option;
+ BOOLEAN Timeout;
- ASSERT(Instance->Config);
- ASSERT(Instance->IaCb.Ia);
+ ASSERT (Instance->Config);
+ ASSERT (Instance->IaCb.Ia);
Timeout = FALSE;
@@ -2649,14 +2620,13 @@ Dhcp6HandleAdvertiseMsg (
// this reply message. Or else, process the advertise messages as normal.
// See details in the section-17.1.4 of rfc-3315.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - sizeof (EFI_DHCP6_HEADER),
Dhcp6OptRapidCommit
);
- if (Option != NULL && Instance->Config->RapidCommit && Packet->Dhcp6.Header.MessageType == Dhcp6MsgReply) {
-
+ if ((Option != NULL) && Instance->Config->RapidCommit && (Packet->Dhcp6.Header.MessageType == Dhcp6MsgReply)) {
return Dhcp6HandleReplyMsg (Instance, Packet);
}
@@ -2704,12 +2674,11 @@ Dhcp6HandleAdvertiseMsg (
CopyMem (Instance->AdSelect, Packet, Packet->Size);
Instance->AdPref = 0xff;
-
} else if (Status == EFI_NOT_READY) {
//
// Not_ready means user wants to continue to receive more advertise packets.
//
- if (Instance->AdPref == 0xff && Instance->AdSelect == NULL) {
+ if ((Instance->AdPref == 0xff) && (Instance->AdSelect == NULL)) {
//
// It's a tricky point. The timer routine set adpref as 0xff if the first
// rt timeout and no advertisement received, which means any advertisement
@@ -2722,13 +2691,13 @@ Dhcp6HandleAdvertiseMsg (
// Check whether the current packet has a 255 preference option or not.
// Take non-preference option as 0 value.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - 4,
Dhcp6OptPreference
);
- if (Instance->AdSelect == NULL || (Option != NULL && *(Option + 4) > Instance->AdPref)) {
+ if ((Instance->AdSelect == NULL) || ((Option != NULL) && (*(Option + 4) > Instance->AdPref))) {
//
// No advertisements received before or preference is more than other
// advertisements received before. Then store the new packet and the
@@ -2755,7 +2724,6 @@ Dhcp6HandleAdvertiseMsg (
// preference is less than other advertisements received before.
// Leave the packet alone.
}
-
} else {
//
// Other error status means termination.
@@ -2768,14 +2736,13 @@ Dhcp6HandleAdvertiseMsg (
// RT has elapsed, or get a highest preference 255 advertise.
// See details in the section-17.1.2 of rfc-3315.
//
- if (Instance->AdPref == 0xff || Timeout) {
+ if ((Instance->AdPref == 0xff) || Timeout) {
Status = Dhcp6SelectAdvertiseMsg (Instance, Instance->AdSelect);
}
return Status;
}
-
/**
The Dhcp6 stateful exchange process routine.
@@ -2785,14 +2752,14 @@ Dhcp6HandleAdvertiseMsg (
**/
VOID
Dhcp6HandleStateful (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- EFI_DHCP6_DUID *ClientId;
- DHCP6_SERVICE *Service;
- UINT8 *Option;
+ EFI_STATUS Status;
+ EFI_DHCP6_DUID *ClientId;
+ DHCP6_SERVICE *Service;
+ UINT8 *Option;
Service = Instance->Service;
ClientId = Service->ClientId;
@@ -2809,14 +2776,14 @@ Dhcp6HandleStateful (
//
// Discard the packet if not advertisement or reply packet.
//
- if (Packet->Dhcp6.Header.MessageType != Dhcp6MsgAdvertise && Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply) {
+ if ((Packet->Dhcp6.Header.MessageType != Dhcp6MsgAdvertise) && (Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply)) {
goto ON_CONTINUE;
}
//
// Check whether include client Id or not.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - DHCP6_SIZE_OF_COMBINED_CODE_AND_LEN,
Dhcp6OptClientId
@@ -2829,7 +2796,7 @@ Dhcp6HandleStateful (
//
// Check whether include server Id or not.
//
- Option = Dhcp6SeekOption(
+ Option = Dhcp6SeekOption (
Packet->Dhcp6.Option,
Packet->Length - DHCP6_SIZE_OF_COMBINED_CODE_AND_LEN,
Dhcp6OptServerId
@@ -2840,35 +2807,36 @@ Dhcp6HandleStateful (
}
switch (Instance->IaCb.Ia->State) {
- case Dhcp6Selecting:
- //
- // Handle the advertisement message when in the Dhcp6Selecting state.
- // Do not need check return status, if failed, just continue to the next.
- //
- Dhcp6HandleAdvertiseMsg (Instance, Packet);
- break;
-
- case Dhcp6Requesting:
- case Dhcp6Confirming:
- case Dhcp6Renewing:
- case Dhcp6Rebinding:
- case Dhcp6Releasing:
- case Dhcp6Declining:
- //
- // Handle the reply message when in the Dhcp6Requesting, Dhcp6Renewing
- // Dhcp6Rebinding, Dhcp6Releasing and Dhcp6Declining state.
- // If failed here, it should reset the current session.
- //
- Status = Dhcp6HandleReplyMsg (Instance, Packet);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
- break;
- default:
- //
- // Other state has not supported yet.
- //
- break;
+ case Dhcp6Selecting:
+ //
+ // Handle the advertisement message when in the Dhcp6Selecting state.
+ // Do not need check return status, if failed, just continue to the next.
+ //
+ Dhcp6HandleAdvertiseMsg (Instance, Packet);
+ break;
+
+ case Dhcp6Requesting:
+ case Dhcp6Confirming:
+ case Dhcp6Renewing:
+ case Dhcp6Rebinding:
+ case Dhcp6Releasing:
+ case Dhcp6Declining:
+ //
+ // Handle the reply message when in the Dhcp6Requesting, Dhcp6Renewing
+ // Dhcp6Rebinding, Dhcp6Releasing and Dhcp6Declining state.
+ // If failed here, it should reset the current session.
+ //
+ Status = Dhcp6HandleReplyMsg (Instance, Packet);
+ if (EFI_ERROR (Status)) {
+ goto ON_EXIT;
+ }
+
+ break;
+ default:
+ //
+ // Other state has not supported yet.
+ //
+ break;
}
ON_CONTINUE:
@@ -2887,7 +2855,6 @@ ON_EXIT:
}
}
-
/**
The Dhcp6 stateless exchange process routine.
@@ -2897,15 +2864,15 @@ ON_EXIT:
**/
VOID
Dhcp6HandleStateless (
- IN DHCP6_INSTANCE *Instance,
- IN EFI_DHCP6_PACKET *Packet
+ IN DHCP6_INSTANCE *Instance,
+ IN EFI_DHCP6_PACKET *Packet
)
{
- EFI_STATUS Status;
- DHCP6_SERVICE *Service;
- DHCP6_INF_CB *InfCb;
- UINT8 *Option;
- BOOLEAN IsMatched;
+ EFI_STATUS Status;
+ DHCP6_SERVICE *Service;
+ DHCP6_INF_CB *InfCb;
+ UINT8 *Option;
+ BOOLEAN IsMatched;
Service = Instance->Service;
Status = EFI_SUCCESS;
@@ -2990,7 +2957,6 @@ ON_EXIT:
}
}
-
/**
The receive callback function for Dhcp6 exchange process.
@@ -3003,37 +2969,37 @@ ON_EXIT:
VOID
EFIAPI
Dhcp6ReceivePacket (
- IN NET_BUF *Udp6Wrap,
- IN UDP_END_POINT *EndPoint,
- IN EFI_STATUS IoStatus,
- IN VOID *Context
+ IN NET_BUF *Udp6Wrap,
+ IN UDP_END_POINT *EndPoint,
+ IN EFI_STATUS IoStatus,
+ IN VOID *Context
)
{
- EFI_DHCP6_HEADER *Head;
- EFI_DHCP6_PACKET *Packet;
- DHCP6_SERVICE *Service;
- DHCP6_INSTANCE *Instance;
- DHCP6_TX_CB *TxCb;
- UINT32 Size;
- BOOLEAN IsDispatched;
- BOOLEAN IsStateless;
- LIST_ENTRY *Entry1;
- LIST_ENTRY *Next1;
- LIST_ENTRY *Entry2;
- LIST_ENTRY *Next2;
- EFI_STATUS Status;
+ EFI_DHCP6_HEADER *Head;
+ EFI_DHCP6_PACKET *Packet;
+ DHCP6_SERVICE *Service;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_TX_CB *TxCb;
+ UINT32 Size;
+ BOOLEAN IsDispatched;
+ BOOLEAN IsStateless;
+ LIST_ENTRY *Entry1;
+ LIST_ENTRY *Next1;
+ LIST_ENTRY *Entry2;
+ LIST_ENTRY *Next2;
+ EFI_STATUS Status;
ASSERT (Udp6Wrap != NULL);
ASSERT (Context != NULL);
- Service = (DHCP6_SERVICE *) Context;
+ Service = (DHCP6_SERVICE *)Context;
Instance = NULL;
Packet = NULL;
IsDispatched = FALSE;
IsStateless = FALSE;
if (EFI_ERROR (IoStatus)) {
- return ;
+ return;
}
if (Udp6Wrap->TotalSize < sizeof (EFI_DHCP6_HEADER)) {
@@ -3044,7 +3010,7 @@ Dhcp6ReceivePacket (
// Copy the net buffer received from upd6 to a Dhcp6 packet.
//
Size = sizeof (EFI_DHCP6_PACKET) + Udp6Wrap->TotalSize;
- Packet = (EFI_DHCP6_PACKET *) AllocateZeroPool (Size);
+ Packet = (EFI_DHCP6_PACKET *)AllocateZeroPool (Size);
if (Packet == NULL) {
goto ON_CONTINUE;
@@ -3052,7 +3018,7 @@ Dhcp6ReceivePacket (
Packet->Size = Size;
Head = &Packet->Dhcp6.Header;
- Packet->Length = NetbufCopy (Udp6Wrap, 0, Udp6Wrap->TotalSize, (UINT8 *) Head);
+ Packet->Length = NetbufCopy (Udp6Wrap, 0, Udp6Wrap->TotalSize, (UINT8 *)Head);
if (Packet->Length == 0) {
goto ON_CONTINUE;
@@ -3062,11 +3028,9 @@ Dhcp6ReceivePacket (
// Dispatch packet to right instance by transaction id.
//
NET_LIST_FOR_EACH_SAFE (Entry1, Next1, &Service->Child) {
-
Instance = NET_LIST_USER_STRUCT (Entry1, DHCP6_INSTANCE, Link);
NET_LIST_FOR_EACH_SAFE (Entry2, Next2, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry2, DHCP6_TX_CB, Link);
if (Packet->Dhcp6.Header.TransactionId == TxCb->Xid) {
@@ -3077,7 +3041,8 @@ Dhcp6ReceivePacket (
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
IsStateless = TRUE;
}
- IsDispatched = TRUE;
+
+ IsDispatched = TRUE;
break;
}
}
@@ -3107,11 +3072,11 @@ ON_CONTINUE:
if (!IsDispatched) {
Status = UdpIoRecvDatagram (
- Service->UdpIo,
- Dhcp6ReceivePacket,
- Service,
- 0
- );
+ Service->UdpIo,
+ Dhcp6ReceivePacket,
+ Service,
+ 0
+ );
if (EFI_ERROR (Status)) {
NET_LIST_FOR_EACH_SAFE (Entry1, Next1, &Service->Child) {
Instance = NET_LIST_USER_STRUCT (Entry1, DHCP6_INSTANCE, Link);
@@ -3143,7 +3108,7 @@ ON_CONTINUE:
**/
BOOLEAN
Dhcp6LinkMovDetect (
- IN DHCP6_INSTANCE *Instance
+ IN DHCP6_INSTANCE *Instance
)
{
UINT32 InterruptStatus;
@@ -3152,7 +3117,7 @@ Dhcp6LinkMovDetect (
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
ASSERT (Instance != NULL);
- Snp = Instance->Service->Snp;
+ Snp = Instance->Service->Snp;
MediaPresent = Instance->MediaPresent;
//
@@ -3177,10 +3142,10 @@ Dhcp6LinkMovDetect (
if (!MediaPresent && Instance->MediaPresent) {
return TRUE;
}
+
return FALSE;
}
-
/**
The timer routine of the Dhcp6 instance for each second.
@@ -3191,28 +3156,27 @@ Dhcp6LinkMovDetect (
VOID
EFIAPI
Dhcp6OnTimerTick (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- LIST_ENTRY *Entry;
- LIST_ENTRY *NextEntry;
- DHCP6_INSTANCE *Instance;
- DHCP6_TX_CB *TxCb;
- DHCP6_IA_CB *IaCb;
- UINT32 LossTime;
- EFI_STATUS Status;
+ LIST_ENTRY *Entry;
+ LIST_ENTRY *NextEntry;
+ DHCP6_INSTANCE *Instance;
+ DHCP6_TX_CB *TxCb;
+ DHCP6_IA_CB *IaCb;
+ UINT32 LossTime;
+ EFI_STATUS Status;
ASSERT (Context != NULL);
- Instance = (DHCP6_INSTANCE *) Context;
+ Instance = (DHCP6_INSTANCE *)Context;
//
// 1. Loop the tx list, count live time of every tx packet to check whether
// need re-transmit or not.
//
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Instance->TxList) {
-
TxCb = NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link);
TxCb->TickTime++;
@@ -3221,7 +3185,7 @@ Dhcp6OnTimerTick (
//
// Handle the first rt in the transmission of solicit specially.
//
- if ((TxCb->RetryCnt == 0 || TxCb->SolicitRetry) && TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgSolicit) {
+ if (((TxCb->RetryCnt == 0) || TxCb->SolicitRetry) && (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgSolicit)) {
if (Instance->AdSelect == NULL) {
//
// Set adpref as 0xff here to indicate select any advertisement
@@ -3238,9 +3202,11 @@ Dhcp6OnTimerTick (
} else if (EFI_ERROR (Status)) {
TxCb->RetryCnt++;
}
+
return;
}
}
+
//
// Increase the retry count for the packet and add up the total loss time.
//
@@ -3250,7 +3216,7 @@ Dhcp6OnTimerTick (
//
// Check whether overflow the max retry count limit for this packet
//
- if (TxCb->RetryCtl.Mrc != 0 && TxCb->RetryCtl.Mrc < TxCb->RetryCnt) {
+ if ((TxCb->RetryCtl.Mrc != 0) && (TxCb->RetryCtl.Mrc < TxCb->RetryCnt)) {
Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3258,7 +3224,7 @@ Dhcp6OnTimerTick (
//
// Check whether overflow the max retry duration for this packet
//
- if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd <= TxCb->RetryLos) {
+ if ((TxCb->RetryCtl.Mrd != 0) && (TxCb->RetryCtl.Mrd <= TxCb->RetryLos)) {
Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3275,7 +3241,7 @@ Dhcp6OnTimerTick (
TRUE
);
- if (TxCb->RetryCtl.Mrt != 0 && TxCb->RetryCtl.Mrt < TxCb->RetryExp) {
+ if ((TxCb->RetryCtl.Mrt != 0) && (TxCb->RetryCtl.Mrt < TxCb->RetryExp)) {
TxCb->RetryExp = Dhcp6CalculateExpireTime (
TxCb->RetryCtl.Mrt,
TRUE,
@@ -3288,7 +3254,7 @@ Dhcp6OnTimerTick (
// duration time.
//
LossTime = TxCb->RetryLos + TxCb->RetryExp;
- if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd < LossTime) {
+ if ((TxCb->RetryCtl.Mrd != 0) && (TxCb->RetryCtl.Mrd < LossTime)) {
TxCb->RetryExp = TxCb->RetryCtl.Mrd - TxCb->RetryLos;
}
@@ -3314,22 +3280,19 @@ Dhcp6OnTimerTick (
//
IaCb = &Instance->IaCb;
- if (Instance->Config == NULL || IaCb->Ia == NULL) {
+ if ((Instance->Config == NULL) || (IaCb->Ia == NULL)) {
return;
}
- if (IaCb->Ia->State == Dhcp6Bound || IaCb->Ia->State == Dhcp6Renewing || IaCb->Ia->State == Dhcp6Rebinding) {
-
+ if ((IaCb->Ia->State == Dhcp6Bound) || (IaCb->Ia->State == Dhcp6Renewing) || (IaCb->Ia->State == Dhcp6Rebinding)) {
IaCb->LeaseTime++;
- if (IaCb->LeaseTime > IaCb->T2 && IaCb->Ia->State == Dhcp6Bound) {
+ if ((IaCb->LeaseTime > IaCb->T2) && (IaCb->Ia->State == Dhcp6Bound)) {
//
// Exceed t2, send rebind packet to extend the Ia lease.
//
Dhcp6SendRenewRebindMsg (Instance, TRUE);
-
- } else if (IaCb->LeaseTime > IaCb->T1 && IaCb->Ia->State == Dhcp6Bound) {
-
+ } else if ((IaCb->LeaseTime > IaCb->T1) && (IaCb->Ia->State == Dhcp6Bound)) {
//
// Exceed t1, send renew packet to extend the Ia lease.
//
@@ -3347,28 +3310,32 @@ Dhcp6OnTimerTick (
return;
- ON_CLOSE:
+ON_CLOSE:
if (Dhcp6IsValidTxCb (Instance, TxCb) &&
- TxCb->TxPacket != NULL &&
- (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
- TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew ||
- TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)
- ) {
+ (TxCb->TxPacket != NULL) &&
+ ((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) ||
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm))
+ )
+ {
//
// The failure of renew/Confirm will still switch to the bound state.
//
if ((TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew) ||
- (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)) {
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm))
+ {
ASSERT (Instance->IaCb.Ia);
Instance->IaCb.Ia->State = Dhcp6Bound;
}
+
//
// The failure of info-request will return no response.
//
if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest) {
Instance->UdpSts = EFI_NO_RESPONSE;
}
+
Dhcp6DequeueRetry (
Instance,
TxCb->Xid,
--
2.39.3