summaryrefslogtreecommitdiff
path: root/NetworkPkg
diff options
context:
space:
mode:
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c6
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h4
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Io.c209
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c148
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h7
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c4
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h4
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6ConfigNv.c496
-rw-r--r--NetworkPkg/Ip6Dxe/Ip6NvData.h4
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c4
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c29
-rw-r--r--NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c10
12 files changed, 514 insertions, 411 deletions
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
index 934c03ed..d8c0ad0d 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
@@ -104,12 +104,6 @@ EfiDhcp6Start (
Instance->UdpSts = EFI_ALREADY_STARTED;
//
- // Need to clear initial time to make sure that elapsed-time
- // is set to 0 for first Solicit.
- //
- Instance->StartTime = 0;
-
- //
// Send the solicit message to start S.A.R.R process.
//
Status = Dhcp6SendSolicitMsg (Instance);
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
index 71b16b19..e3e75531 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.h
@@ -249,6 +249,10 @@ struct _DHCP6_INSTANCE {
volatile EFI_STATUS UdpSts;
BOOLEAN InDestroy;
BOOLEAN MediaPresent;
+ //
+ // StartTime is used to calculate the 'elapsed-time' option. Refer to RFC3315,
+ // the elapsed-time is amount of time since the client began its current DHCP transaction.
+ //
UINT64 StartTime;
};
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
index 0e83d078..1da31dcc 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Io.c
@@ -1,7 +1,7 @@
/** @file
Dhcp6 internal functions implementation.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -593,6 +593,14 @@ Dhcp6UpdateIaInfo (
if (Instance->Config->IaDescriptor.Type == Dhcp6OptIana) {
T1 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 8)));
T2 = NTOHL (ReadUnaligned32 ((UINT32 *) (Option + 12)));
+ //
+ // Refer to RFC3155 Chapter 22.4. If a client receives an IA_NA with T1 greater than T2,
+ // 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) {
+ return EFI_DEVICE_ERROR;
+ }
IaInnerOpt = Option + 16;
IaInnerLen = (UINT16) (NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 2))) - 12);
} else {
@@ -697,7 +705,7 @@ Dhcp6SeekStsOption (
&Instance->Config->IaDescriptor
);
if (*Option == NULL) {
- return EFI_DEVICE_ERROR;
+ return EFI_SUCCESS;
}
//
@@ -949,7 +957,8 @@ Dhcp6SendSolicitMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
//
@@ -987,6 +996,10 @@ Dhcp6SendSolicitMsg (
// Dhcp6selecting.
//
Instance->IaCb.Ia->State = Dhcp6Selecting;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1133,7 +1146,8 @@ Dhcp6SendRequestMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
//
@@ -1171,6 +1185,10 @@ Dhcp6SendRequestMsg (
// Dhcp6requesting.
//
Instance->IaCb.Ia->State = Dhcp6Requesting;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1282,7 +1300,7 @@ Dhcp6SendDeclineMsg (
ServerId->Duid
);
- Cursor = Dhcp6AppendIaOption (Cursor, DecIa, 0, 0);
+ Cursor = Dhcp6AppendIaOption (Cursor, DecIa, 0, 0, Packet->Dhcp6.Header.MessageType);
//
// Determine the size/length of packet.
@@ -1305,6 +1323,10 @@ Dhcp6SendDeclineMsg (
// Dhcp6declining.
//
Instance->IaCb.Ia->State = Dhcp6Declining;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1415,7 +1437,7 @@ Dhcp6SendReleaseMsg (
&Elapsed
);
- Cursor = Dhcp6AppendIaOption (Cursor, RelIa, 0, 0);
+ Cursor = Dhcp6AppendIaOption (Cursor, RelIa, 0, 0, Packet->Dhcp6.Header.MessageType);
//
// Determine the size/length of packet
@@ -1540,7 +1562,8 @@ Dhcp6SendRenewRebindMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
if (!RebindRequest) {
@@ -1612,6 +1635,10 @@ Dhcp6SendRenewRebindMsg (
//
Instance->IaCb.Ia->State = State;
Instance->IaCb.LeaseTime = (RebindRequest) ? Instance->IaCb.T2 : Instance->IaCb.T1;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -1844,6 +1871,11 @@ Dhcp6SendInfoRequestMsg (
//
Packet->Length += (UINT32) (Cursor - Packet->Dhcp6.Option);
ASSERT (Packet->Size > Packet->Length + 8);
+
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
//
// Send info-request packet with no state.
@@ -1941,7 +1973,8 @@ Dhcp6SendConfirmMsg (
Cursor,
Instance->IaCb.Ia,
Instance->IaCb.T1,
- Instance->IaCb.T2
+ Instance->IaCb.T2,
+ Packet->Dhcp6.Header.MessageType
);
//
@@ -1978,6 +2011,10 @@ Dhcp6SendConfirmMsg (
// Dhcp6Confirming.
//
Instance->IaCb.Ia->State = Dhcp6Confirming;
+ //
+ // Clear initial time for current transaction.
+ //
+ Instance->StartTime = 0;
Status = Dhcp6TransmitPacket (Instance, Packet, Elapsed);
@@ -2020,6 +2057,8 @@ Dhcp6HandleReplyMsg (
ASSERT (Instance->IaCb.Ia != NULL);
ASSERT (Packet != NULL);
+ Status = EFI_SUCCESS;
+
if (Packet->Dhcp6.Header.MessageType != Dhcp6MsgReply) {
return EFI_DEVICE_ERROR;
}
@@ -2056,7 +2095,7 @@ Dhcp6HandleReplyMsg (
&Instance->Config->IaDescriptor
);
if (Option == NULL) {
- return EFI_DEVICE_ERROR;
+ return EFI_SUCCESS;
}
}
@@ -2070,19 +2109,6 @@ Dhcp6HandleReplyMsg (
}
//
- // Dequeue the sent packet from retransmit list since reply received.
- //
- Status = Dhcp6DequeueRetry (
- Instance,
- Packet->Dhcp6.Header.TransactionId,
- FALSE
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
// When receive a valid reply packet in response to a decline/release packet,
// the client considers the decline/release event completed regardless of the
// status code.
@@ -2115,7 +2141,8 @@ Dhcp6HandleReplyMsg (
//
Instance->StartTime = 0;
- return EFI_SUCCESS;
+ Status = EFI_SUCCESS;
+ goto ON_EXIT;
}
//
@@ -2132,55 +2159,63 @@ Dhcp6HandleReplyMsg (
if (!EFI_ERROR (Status)) {
//
- // Reset start time for next exchange.
- //
- Instance->StartTime = 0;
-
- //
// No status code or no error status code means succeed to reply.
//
Status = Dhcp6UpdateIaInfo (Instance, Packet);
+ if (!EFI_ERROR (Status)) {
+ //
+ // Reset start time for next exchange.
+ //
+ Instance->StartTime = 0;
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Set bound state and store the reply packet.
- //
- if (Instance->IaCb.Ia->ReplyPacket != NULL) {
- FreePool (Instance->IaCb.Ia->ReplyPacket);
- }
+ //
+ // Set bound state and store the reply packet.
+ //
+ if (Instance->IaCb.Ia->ReplyPacket != NULL) {
+ FreePool (Instance->IaCb.Ia->ReplyPacket);
+ }
- Instance->IaCb.Ia->ReplyPacket = AllocateZeroPool (Packet->Size);
+ Instance->IaCb.Ia->ReplyPacket = AllocateZeroPool (Packet->Size);
- if (Instance->IaCb.Ia->ReplyPacket == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
+ if (Instance->IaCb.Ia->ReplyPacket == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ON_EXIT;
+ }
- CopyMem (Instance->IaCb.Ia->ReplyPacket, Packet, Packet->Size);
+ CopyMem (Instance->IaCb.Ia->ReplyPacket, Packet, Packet->Size);
- Instance->IaCb.Ia->State = Dhcp6Bound;
+ Instance->IaCb.Ia->State = Dhcp6Bound;
- //
- // For sync, set the success flag out of polling in start/renewrebind.
- //
- Instance->UdpSts = EFI_SUCCESS;
+ //
+ // For sync, set the success flag out of polling in start/renewrebind.
+ //
+ Instance->UdpSts = EFI_SUCCESS;
- //
- // Maybe this is a new round DHCP process due to some reason, such as NotOnLink
- // ReplyMsg for ConfirmMsg should triger new round to acquire new address. In that
- // case, clear old address.ValidLifetime and append to new address. Therefore, DHCP
- // consumers can be notified to flush old address.
- //
- Dhcp6AppendCacheIa (Instance);
+ //
+ // Maybe this is a new round DHCP process due to some reason, such as NotOnLink
+ // ReplyMsg for ConfirmMsg should triger new round to acquire new address. In that
+ // case, clear old address.ValidLifetime and append to new address. Therefore, DHCP
+ // consumers can be notified to flush old address.
+ //
+ Dhcp6AppendCacheIa (Instance);
- //
- // For async, signal the Ia event to inform Ia infomation update.
- //
- if (Instance->Config->IaInfoEvent != NULL) {
- gBS->SignalEvent (Instance->Config->IaInfoEvent);
+ //
+ // For async, signal the Ia event to inform Ia infomation update.
+ //
+ if (Instance->Config->IaInfoEvent != NULL) {
+ gBS->SignalEvent (Instance->Config->IaInfoEvent);
+ }
+ } else if (Status == EFI_NOT_FOUND) {
+ //
+ // Refer to RFC3315 Chapter 18.1.8, for each IA in the original Renew or Rebind message,
+ // the client sends a Renew or Rebind if the IA is not in the Reply message.
+ // Return EFI_SUCCESS so we can continue to restart the Renew/Rebind process.
+ //
+ return EFI_SUCCESS;
}
+
+ goto ON_EXIT;
+
} else if (Option != NULL) {
//
// Any error status code option is found.
@@ -2226,6 +2261,19 @@ Dhcp6HandleReplyMsg (
}
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.
@@ -2235,6 +2283,18 @@ Dhcp6HandleReplyMsg (
}
return EFI_SUCCESS;
+
+ON_EXIT:
+
+ if (!EFI_ERROR(Status)) {
+ Status = Dhcp6DequeueRetry (
+ Instance,
+ Packet->Dhcp6.Header.TransactionId,
+ FALSE
+ );
+ }
+
+ return Status;
}
@@ -2378,17 +2438,13 @@ Dhcp6HandleAdvertiseMsg (
// display the associated status message to the user.
// See the details in the section-17.1.3 of rfc-3315.
//
- Option = Dhcp6SeekOption(
- Packet->Dhcp6.Option,
- Packet->Length - 4,
- Dhcp6OptStatusCode
+ Status = Dhcp6SeekStsOption (
+ Instance,
+ Packet,
+ &Option
);
-
- if (Option != NULL) {
- StsCode = NTOHS (ReadUnaligned16 ((UINT16 *) (Option + 4)));
- if (StsCode != Dhcp6StsSuccess) {
- return EFI_DEVICE_ERROR;
- }
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
}
//
@@ -2925,7 +2981,9 @@ Dhcp6OnTimerTick (
// Select the advertisement received before.
//
Status = Dhcp6SelectAdvertiseMsg (Instance, Instance->AdSelect);
- if (EFI_ERROR (Status)) {
+ if (Status == EFI_ABORTED) {
+ goto ON_CLOSE;
+ } else if (EFI_ERROR (Status)) {
TxCb->RetryCnt++;
}
return;
@@ -2941,6 +2999,7 @@ Dhcp6OnTimerTick (
// Check whether overflow the max retry count limit for this packet
//
if (TxCb->RetryCtl.Mrc != 0 && TxCb->RetryCtl.Mrc < TxCb->RetryCnt) {
+ Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -2948,6 +3007,7 @@ Dhcp6OnTimerTick (
// Check whether overflow the max retry duration for this packet
//
if (TxCb->RetryCtl.Mrd != 0 && TxCb->RetryCtl.Mrd <= TxCb->RetryLos) {
+ Status = EFI_NO_RESPONSE;
goto ON_CLOSE;
}
@@ -3037,9 +3097,10 @@ Dhcp6OnTimerTick (
ON_CLOSE:
- if (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
+ if (TxCb->TxPacket != NULL &&
+ (TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgInfoRequest ||
TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgRenew ||
- TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm
+ TxCb->TxPacket->Dhcp6.Header.MessageType == Dhcp6MsgConfirm)
) {
//
// The failure of renew/Confirm will still switch to the bound state.
@@ -3064,6 +3125,6 @@ Dhcp6OnTimerTick (
//
// The failure of the others will terminate current state machine if timeout.
//
- Dhcp6CleanupSession (Instance, EFI_NO_RESPONSE);
+ Dhcp6CleanupSession (Instance, Status);
}
}
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
index 4c320286..32247c92 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
@@ -647,6 +647,75 @@ Dhcp6AppendOption (
return Buf;
}
+/**
+ Append the appointed IA Address option to Buf, and move Buf to the end.
+
+ @param[in, out] Buf The pointer to the position to append.
+ @param[in] IaAddr The pointer to the IA Address.
+ @param[in] MessageType Message type of DHCP6 package.
+
+ @return Buf The position to append the next option.
+
+**/
+UINT8 *
+Dhcp6AppendIaAddrOption (
+ IN OUT UINT8 *Buf,
+ IN EFI_DHCP6_IA_ADDRESS *IaAddr,
+ IN UINT32 MessageType
+)
+{
+
+ // The format of the IA Address option is:
+ //
+ // 0 1 2 3
+ // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | OPTION_IAADDR | option-len |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | |
+ // | IPv6 address |
+ // | |
+ // | |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | preferred-lifetime |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | valid-lifetime |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // . .
+ // . IAaddr-options .
+ // . .
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ //
+ // Fill the value of Ia Address option type
+ //
+ WriteUnaligned16 ((UINT16 *) Buf, HTONS (Dhcp6OptIaAddr));
+ Buf += 2;
+
+ WriteUnaligned16 ((UINT16 *) Buf, HTONS (sizeof (EFI_DHCP6_IA_ADDRESS)));
+ Buf += 2;
+
+ CopyMem (Buf, &IaAddr->IpAddress, sizeof(EFI_IPv6_ADDRESS));
+ Buf += sizeof(EFI_IPv6_ADDRESS);
+
+ //
+ // Fill the value of preferred-lifetime and valid-lifetime.
+ // According to RFC3315 Chapter 18.1.2, the preferred-lifetime and valid-lifetime fields
+ // should set to 0 when initiate a Confirm message.
+ //
+ if (MessageType != Dhcp6MsgConfirm) {
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->PreferredLifetime));
+ }
+ Buf += 4;
+
+ if (MessageType != Dhcp6MsgConfirm) {
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL (IaAddr->ValidLifetime));
+ }
+ Buf += 4;
+
+ return Buf;
+}
+
/**
Append the appointed Ia option to Buf, and move Buf to the end.
@@ -655,6 +724,7 @@ Dhcp6AppendOption (
@param[in] Ia The pointer to the Ia.
@param[in] T1 The time of T1.
@param[in] T2 The time of T2.
+ @param[in] MessageType Message type of DHCP6 package.
@return Buf The position to append the next Ia option.
@@ -664,13 +734,13 @@ Dhcp6AppendIaOption (
IN OUT UINT8 *Buf,
IN EFI_DHCP6_IA *Ia,
IN UINT32 T1,
- IN UINT32 T2
+ IN UINT32 T2,
+ IN UINT32 MessageType
)
{
UINT8 *AddrOpt;
UINT16 *Len;
UINTN Index;
- UINT16 Length;
//
// The format of IA_NA and IA_TA option:
@@ -713,9 +783,9 @@ Dhcp6AppendIaOption (
// Fill the value of t1 and t2 if iana, keep it 0xffffffff if no specified.
//
if (Ia->Descriptor.Type == Dhcp6OptIana) {
- WriteUnaligned32 ((UINT32 *) Buf, ((T1 != 0) ? T1 : 0xffffffff));
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T1 != 0) ? T1 : 0xffffffff));
Buf += 4;
- WriteUnaligned32 ((UINT32 *) Buf, ((T2 != 0) ? T2 : 0xffffffff));
+ WriteUnaligned32 ((UINT32 *) Buf, HTONL ((T2 != 0) ? T2 : 0xffffffff));
Buf += 4;
}
@@ -723,15 +793,8 @@ Dhcp6AppendIaOption (
// Fill all the addresses belong to the Ia
//
for (Index = 0; Index < Ia->IaAddressCount; Index++) {
-
- AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS);
- Length = HTONS ((UINT16) sizeof (EFI_DHCP6_IA_ADDRESS));
- Buf = Dhcp6AppendOption (
- Buf,
- HTONS (Dhcp6OptIaAddr),
- Length,
- AddrOpt
- );
+ AddrOpt = (UINT8 *) Ia->IaAddress + Index * sizeof (EFI_DHCP6_IA_ADDRESS);
+ Buf = Dhcp6AppendIaAddrOption (Buf, (EFI_DHCP6_IA_ADDRESS *) AddrOpt, MessageType);
}
//
@@ -827,7 +890,7 @@ SetElapsedTime (
//
// Sentinel value of 0 means that this is the first DHCP packet that we are
- // sending and that we need to initialize the value. First DHCP Solicit
+ // sending and that we need to initialize the value. First DHCP message
// gets 0 elapsed-time. Otherwise, calculate based on StartTime.
//
if (Instance->StartTime == 0) {
@@ -934,10 +997,39 @@ Dhcp6SeekIaOption (
return Option;
}
+/**
+ Check whether the incoming IPv6 address in IaAddr is one of the maintained
+ addresses in the IA control blcok.
+
+ @param[in] IaAddr The pointer to the IA Address to be checked.
+ @param[in] CurrentIa The pointer to the IA in IA control block.
+
+ @retval TRUE Yes, this Address is already in IA control block.
+ @retval FALSE No, this Address is NOT in IA control block.
+
+**/
+BOOLEAN
+Dhcp6AddrIsInCurrentIa (
+ IN EFI_DHCP6_IA_ADDRESS *IaAddr,
+ IN EFI_DHCP6_IA *CurrentIa
+ )
+{
+ UINT32 Index;
+
+ ASSERT (IaAddr != NULL && CurrentIa != NULL);
+
+ for (Index = 0; Index < CurrentIa->IaAddressCount; Index++) {
+ if (EFI_IP6_EQUAL(&IaAddr->IpAddress, &CurrentIa->IaAddress[Index].IpAddress)) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
/**
Parse the address option and update the address infomation.
+ @param[in] CurrentIa The pointer to the Ia Address in control blcok.
@param[in] IaInnerOpt The pointer to the buffer.
@param[in] IaInnerLen The length to parse.
@param[out] AddrNum The number of addresses.
@@ -946,6 +1038,7 @@ Dhcp6SeekIaOption (
**/
VOID
Dhcp6ParseAddrOption (
+ IN EFI_DHCP6_IA *CurrentIa,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
OUT UINT32 *AddrNum,
@@ -956,6 +1049,8 @@ Dhcp6ParseAddrOption (
UINT16 DataLen;
UINT16 OpCode;
UINT32 ValidLt;
+ UINT32 PreferredLt;
+ EFI_DHCP6_IA_ADDRESS *IaAddr;
//
// The format of the IA Address option:
@@ -992,19 +1087,21 @@ Dhcp6ParseAddrOption (
while (Cursor < IaInnerOpt + IaInnerLen) {
//
- // Count the Ia address option with non-0 valid time.
+ // Refer to RFC3315 Chapter 18.1.8, we need to update lifetimes for any addresses in the IA option
+ // that the client already has recorded in the IA, and discard the Ia address option with 0 valid time.
//
OpCode = ReadUnaligned16 ((UINT16 *) Cursor);
- ValidLt = ReadUnaligned32 ((UINT32 *) (Cursor + 24));
- if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt != 0) {
-
+ PreferredLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 20)));
+ ValidLt = NTOHL (ReadUnaligned32 ((UINT32 *) (Cursor + 24)));
+ IaAddr = (EFI_DHCP6_IA_ADDRESS *) (Cursor + 4);
+ if (OpCode == HTONS (Dhcp6OptIaAddr) && ValidLt >= PreferredLt &&
+ (Dhcp6AddrIsInCurrentIa(IaAddr, CurrentIa) || ValidLt !=0)) {
if (AddrBuf != NULL) {
- CopyMem (AddrBuf, Cursor + 4, sizeof (EFI_DHCP6_IA_ADDRESS));
- AddrBuf->PreferredLifetime = NTOHL (AddrBuf->PreferredLifetime);
- AddrBuf->ValidLifetime = NTOHL (AddrBuf->ValidLifetime);
+ CopyMem (AddrBuf, IaAddr, sizeof (EFI_DHCP6_IA_ADDRESS));
+ AddrBuf->PreferredLifetime = PreferredLt;
+ AddrBuf->ValidLifetime = ValidLt;
AddrBuf = (EFI_DHCP6_IA_ADDRESS *) ((UINT8 *) AddrBuf + sizeof (EFI_DHCP6_IA_ADDRESS));
}
-
(*AddrNum)++;
}
DataLen = NTOHS (ReadUnaligned16 ((UINT16 *) (Cursor + 2)));
@@ -1025,6 +1122,7 @@ Dhcp6ParseAddrOption (
@retval EFI_NOT_FOUND No valid IA option is found.
@retval EFI_SUCCESS Create an IA control block successfully.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
+ @retval EFI_DEVICE_ERROR An unexpected error.
**/
EFI_STATUS
@@ -1041,14 +1139,14 @@ Dhcp6GenerateIaCb (
EFI_DHCP6_IA *Ia;
if (Instance->IaCb.Ia == NULL) {
- return EFI_NOT_FOUND;
+ return EFI_DEVICE_ERROR;
}
//
// Calculate the number of addresses for this Ia, excluding the addresses with
// the value 0 of valid lifetime.
//
- Dhcp6ParseAddrOption (IaInnerOpt, IaInnerLen, &AddrNum, NULL);
+ Dhcp6ParseAddrOption (Instance->IaCb.Ia, IaInnerOpt, IaInnerLen, &AddrNum, NULL);
if (AddrNum == 0) {
return EFI_NOT_FOUND;
@@ -1070,7 +1168,7 @@ Dhcp6GenerateIaCb (
Ia->State = Instance->IaCb.Ia->State;
Ia->IaAddressCount = AddrNum;
CopyMem (&Ia->Descriptor, &Instance->Config->IaDescriptor, sizeof (EFI_DHCP6_IA_DESCRIPTOR));
- Dhcp6ParseAddrOption (IaInnerOpt, IaInnerLen, &AddrNum, Ia->IaAddress);
+ Dhcp6ParseAddrOption (Instance->IaCb.Ia, IaInnerOpt, IaInnerLen, &AddrNum, Ia->IaAddress);
//
// Free original IA resource.
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
index 2a44d006..8c3151e3 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.h
@@ -192,6 +192,7 @@ Dhcp6AppendOption (
@param[in] Ia The pointer to the Ia.
@param[in] T1 The time of T1.
@param[in] T2 The time of T2.
+ @param[in] MessageType Message type of DHCP6 package.
@return Buf The position to append the next Ia option.
@@ -201,7 +202,8 @@ Dhcp6AppendIaOption (
IN OUT UINT8 *Buf,
IN EFI_DHCP6_IA *Ia,
IN UINT32 T1,
- IN UINT32 T2
+ IN UINT32 T2,
+ IN UINT32 MessageType
);
/**
@@ -274,6 +276,7 @@ Dhcp6SeekIaOption (
/**
Parse the address option and update the address info.
+ @param[in] CurrentIa The pointer to the Ia Address in control blcok.
@param[in] IaInnerOpt The pointer to the buffer.
@param[in] IaInnerLen The length to parse.
@param[out] AddrNum The number of addresses.
@@ -282,6 +285,7 @@ Dhcp6SeekIaOption (
**/
VOID
Dhcp6ParseAddrOption (
+ IN EFI_DHCP6_IA *CurrentIa,
IN UINT8 *IaInnerOpt,
IN UINT16 IaInnerLen,
OUT UINT32 *AddrNum,
@@ -300,6 +304,7 @@ Dhcp6ParseAddrOption (
@retval EFI_NOT_FOUND No valid IA option is found.
@retval EFI_SUCCESS Create an IA control block successfully.
@retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
+ @retval EFI_DEVICE_ERROR An unexpected error.
**/
EFI_STATUS
diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
index b9840444..ddb8dcd3 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
@@ -1,7 +1,7 @@
/** @file
The implementation of EFI IPv6 Configuration Protocol.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -473,7 +473,7 @@ Ip6ConfigWriteConfigData (
DataRecord = &Variable->DataRecord[Variable->DataRecordCount];
DataRecord->DataType = (EFI_IP6_CONFIG_DATA_TYPE) Index;
- DataRecord->DataSize = DataItem->DataSize;
+ DataRecord->DataSize = (UINT32) DataItem->DataSize;
DataRecord->Offset = (UINT16) (Heap - (CHAR8 *) Variable);
Variable->DataRecordCount++;
diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h
index ccb09ccc..581978bd 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h
@@ -1,7 +1,7 @@
/** @file
Definitions for EFI IPv6 Configuartion Protocol implementation.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -129,7 +129,7 @@ typedef struct {
typedef struct {
UINT16 Offset;
- UINTN DataSize;
+ UINT32 DataSize;
EFI_IP6_CONFIG_DATA_TYPE DataType;
} IP6_CONFIG_DATA_RECORD;
diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
index d4f25d03..eaeb44b2 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigNv.c
@@ -1,7 +1,7 @@
/** @file
Helper functions for configuring or obtaining the parameters relating to IP6.
- Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -669,9 +669,8 @@ Error:
/**
This function converts the interface info to string and draws it to the IP6 UI.
- The interface information includes interface name, interface type, hardware address,
- address info, and route table information. The address information is also used as the
- content of manual addresses in IP6 UI.
+ The interface information includes interface name, interface type, hardware
+ address and route table information.
@param[in] IfInfo The pointer of EFI_IP6_CONFIG_INTERFACE_INFO.
@param[in] HiiHandle The handle that was previously registered in the
@@ -693,11 +692,9 @@ Ip6ConvertInterfaceInfoToString (
UINT32 Index;
UINTN Number;
CHAR16 *String;
- CHAR16 *LinkLocalStr;
CHAR16 PortString[ADDRESS_STR_MAX_SIZE];
CHAR16 FormatString[8];
EFI_STRING_ID StringId;
- EFI_STATUS Status;
if ((IfInfo == NULL) || (HiiHandle == NULL) || (IfrNvData == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -782,54 +779,7 @@ Ip6ConvertInterfaceInfoToString (
return EFI_OUT_OF_RESOURCES;
}
- //
- // Print the host address Information.
- //
- Status = Ip6ConvertAddressListToString (
- PortString,
- HiiHandle,
- Ip6ConfigNvHostAddress,
- IfInfo->AddressInfo,
- IfInfo->AddressInfoCount
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Copy the Host Address Info to manual address field.
- // Do not copy the link local address.
- //
- LinkLocalStr = StrStr (PortString, IP6_LINK_LOCAL_PREFIX);
- if (LinkLocalStr != NULL) {
- Number = LinkLocalStr - PortString;
- if (Number > 0) {
- CopyMem (IfrNvData->ManualAddress, PortString, Number * sizeof (CHAR16));
- }
-
- while ((*LinkLocalStr != L' ') && (*LinkLocalStr != L'\0')) {
- LinkLocalStr++;
- }
-
- if (*LinkLocalStr != L'\0') {
- LinkLocalStr++;
- StrCat (IfrNvData->ManualAddress, LinkLocalStr);
- }
- } else {
- StrCpy (IfrNvData->ManualAddress, PortString);
- }
-
- //
- // Print the route table information.
- //
- Status = Ip6ConvertAddressListToString (
- PortString,
- HiiHandle,
- Ip6ConfigNvRouteTable,
- IfInfo->RouteTable,
- IfInfo->RouteCount
- );
- return Status;
+ return EFI_SUCCESS;
}
/**
@@ -1033,75 +983,6 @@ Ip6ConvertConfigNvDataToIfrNvData (
IfrNvData->DadTransmitCount = DadXmits.DupAddrDetectTransmits;
- //
- // Get DNS server list.
- //
- FreePool (Data);
- Data = NULL;
- DataSize = 0;
- Status = Ip6ConfigNvGetData (
- Ip6Config,
- Ip6ConfigDataTypeDnsServer,
- &DataSize,
- (VOID **) &Data
- );
-
- if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- goto Exit;
- }
-
- if (DataSize > 0) {
- //
- // Convert the DNS server address to string and draw it to UI.
- //
- Status = Ip6ConvertAddressListToString (
- IfrNvData->DnsAddress,
- HiiHandle,
- Ip6ConfigNvDnsAddress,
- Data,
- DataSize / sizeof (EFI_IPv6_ADDRESS)
- );
- if (EFI_ERROR (Status)) {
- goto Exit;
- }
-
- FreePool (Data);
- Data = NULL;
- }
-
- //
- // Get gateway adderss list.
- //
- DataSize = 0;
- Status = Ip6ConfigNvGetData (
- Ip6Config,
- Ip6ConfigDataTypeGateway,
- &DataSize,
- (VOID **) &Data
- );
-
- if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- goto Exit;
- }
-
- if (DataSize > 0) {
- //
- // Convert the gateway address to string and draw it to UI.
- //
- Status = Ip6ConvertAddressListToString (
- IfrNvData->GatewayAddress,
- HiiHandle,
- Ip6ConfigNvGatewayAddress,
- Data,
- DataSize / sizeof (EFI_IPv6_ADDRESS)
- );
- if (EFI_ERROR (Status)) {
- goto Exit;
- }
- }
-
- Status = EFI_SUCCESS;
-
Exit:
if (Data != NULL) {
FreePool (Data);
@@ -1112,8 +993,7 @@ Exit:
/**
Convert IFR data into IP6 configuration data. The policy, alternative interface
- ID, and DAD transmit counts, and will be saved. If under manual policy, the configured
- manual address, gateway address, and DNS server address will be saved.
+ ID, and DAD transmit counts, and will be saved.
@param[in] IfrNvData The IFR NV data.
@param[in, out] Instance The IP6 config instance data.
@@ -1124,7 +1004,7 @@ Exit:
**/
EFI_STATUS
-Ip6ConvertIfrNvDataToConfigNvData (
+Ip6ConvertIfrNvDataToConfigNvDataGeneral (
IN IP6_CONFIG_IFR_NVDATA *IfrNvData,
IN OUT IP6_CONFIG_INSTANCE *Instance
)
@@ -1132,12 +1012,6 @@ Ip6ConvertIfrNvDataToConfigNvData (
IP6_CONFIG_NVDATA *Ip6NvData;
EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
EFI_STATUS Status;
- EFI_IP6_CONFIG_MANUAL_ADDRESS *ManualAddress;
- EFI_IPv6_ADDRESS *Address;
- BOOLEAN IsAddressOk;
- EFI_EVENT SetAddressEvent;
- EFI_EVENT TimeoutEvent;
- UINTN DataSize;
if ((IfrNvData == NULL) || (Instance == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -1197,11 +1071,67 @@ Ip6ConvertIfrNvDataToConfigNvData (
return Status;
}
+ return EFI_SUCCESS;
+}
+
+/**
+ Convert IFR data into IP6 configuration data. The policy, configured
+ manual address, gateway address, and DNS server address will be saved.
+
+ @param[in] IfrNvData The IFR NV data.
+ @param[in, out] Instance The IP6 config instance data.
- if (Ip6NvData->Policy == Ip6ConfigPolicyAutomatic) {
+ @retval EFI_SUCCESS The operation finished successfully.
+ @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
+ @retval Others Other errors as indicated.
+
+**/
+EFI_STATUS
+Ip6ConvertIfrNvDataToConfigNvDataAdvanced (
+ IN IP6_CONFIG_IFR_NVDATA *IfrNvData,
+ IN OUT IP6_CONFIG_INSTANCE *Instance
+ )
+{
+ IP6_CONFIG_NVDATA *Ip6NvData;
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
+ EFI_STATUS Status;
+ EFI_IP6_CONFIG_MANUAL_ADDRESS *ManualAddress;
+ EFI_IPv6_ADDRESS *Address;
+ BOOLEAN IsAddressOk;
+ EFI_EVENT SetAddressEvent;
+ EFI_EVENT TimeoutEvent;
+ UINTN DataSize;
+
+ if ((IfrNvData == NULL) || (Instance == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (IfrNvData->Policy == IP6_POLICY_AUTO) {
return EFI_SUCCESS;
}
+ NET_CHECK_SIGNATURE (Instance, IP6_CONFIG_INSTANCE_SIGNATURE);
+ Ip6NvData = &Instance->Ip6NvData;
+ Ip6Config = &Instance->Ip6Config;
+
+ //
+ // Update those fields which don't have INTERACTIVE attribute.
+ //
+ Ip6NvData->Policy = Ip6ConfigPolicyManual;
+
+ //
+ // Set the configured policy.
+ //
+ Status = Ip6Config->SetData (
+ Ip6Config,
+ Ip6ConfigDataTypePolicy,
+ sizeof (EFI_IP6_CONFIG_POLICY),
+ &Ip6NvData->Policy
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
//
// Create events & timers for asynchronous settings.
//
@@ -1358,6 +1288,7 @@ Exit:
return Status;
}
+
/**
This function allows the caller to request the current
configuration for one or more named elements. The resulting
@@ -1588,6 +1519,160 @@ Ip6FormRouteConfig (
}
/**
+ Display host addresses, route table, DNS addresses and gateway addresses in
+ "IPv6 Current Setting" page.
+
+ @param[in] Instance The IP6 config instance data.
+
+ @retval EFI_SUCCESS The operation finished successfully.
+ @retval Others Other errors as indicated.
+
+**/
+EFI_STATUS
+Ip6GetCurrentSetting (
+ IN IP6_CONFIG_INSTANCE *Instance
+ )
+{
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
+ EFI_HII_HANDLE HiiHandle;
+ EFI_IP6_CONFIG_INTERFACE_INFO *Data;
+ UINTN DataSize;
+ EFI_STATUS Status;
+ CHAR16 PortString[ADDRESS_STR_MAX_SIZE];
+ EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
+
+
+ Ip6Config = &Instance->Ip6Config;
+ HiiHandle = Instance->CallbackInfo.RegisteredHandle;
+ Data = NULL;
+
+ //
+ // Get current interface info.
+ //
+ Status = Ip6ConfigNvGetData (
+ Ip6Config,
+ Ip6ConfigDataTypeInterfaceInfo,
+ &DataSize,
+ (VOID **) &Data
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Generate dynamic text opcode for host address and draw it.
+ //
+ IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data;
+ Status = Ip6ConvertAddressListToString (
+ PortString,
+ HiiHandle,
+ Ip6ConfigNvHostAddress,
+ IfInfo->AddressInfo,
+ IfInfo->AddressInfoCount
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (Data);
+ return Status;
+ }
+
+ //
+ // Generate the dynamic text opcode for route table and draw it.
+ //
+ Status = Ip6ConvertAddressListToString (
+ PortString,
+ HiiHandle,
+ Ip6ConfigNvRouteTable,
+ IfInfo->RouteTable,
+ IfInfo->RouteCount
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (Data);
+ return Status;
+ }
+
+ //
+ // Get DNS server list.
+ //
+ FreePool (Data);
+ DataSize = 0;
+ Data = NULL;
+ Status = Ip6ConfigNvGetData (
+ Ip6Config,
+ Ip6ConfigDataTypeDnsServer,
+ &DataSize,
+ (VOID **) &Data
+ );
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
+ if (Data != NULL) {
+ FreePool (Data);
+ }
+ return Status;
+ }
+
+ if (DataSize > 0) {
+ //
+ // Generate the dynamic text opcode for DNS server and draw it.
+ //
+ Status = Ip6ConvertAddressListToString (
+ PortString,
+ HiiHandle,
+ Ip6ConfigNvDnsAddress,
+ Data,
+ DataSize / sizeof (EFI_IPv6_ADDRESS)
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (Data);
+ return Status;
+ }
+ }
+
+ //
+ // Get gateway adderss list.
+ //
+ if (Data != NULL) {
+ FreePool (Data);
+ }
+
+ DataSize = 0;
+ Data = NULL;
+ Status = Ip6ConfigNvGetData (
+ Ip6Config,
+ Ip6ConfigDataTypeGateway,
+ &DataSize,
+ (VOID **) &Data
+ );
+ if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
+ if (Data != NULL) {
+ FreePool (Data);
+ }
+ return Status;
+ }
+
+ if (DataSize > 0) {
+ //
+ // Generate the dynamic text opcode for gateway and draw it.
+ //
+ Status = Ip6ConvertAddressListToString (
+ PortString,
+ HiiHandle,
+ Ip6ConfigNvGatewayAddress,
+ Data,
+ DataSize / sizeof (EFI_IPv6_ADDRESS)
+ );
+ if (EFI_ERROR (Status)) {
+ FreePool (Data);
+ return Status;
+ }
+ }
+
+ if (Data != NULL) {
+ FreePool (Data);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
This function is called to provide results data to the driver.
This data consists of a unique key that is used to identify
which data is either being passed back or being asked for.
@@ -1632,12 +1717,6 @@ Ip6FormCallback (
EFI_INPUT_KEY Key;
IP6_CONFIG_INSTANCE *Instance;
IP6_CONFIG_NVDATA *Ip6NvData;
- EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
- EFI_IP6_CONFIG_INTERFACE_INFO *Data;
- UINTN DataSize;
- CHAR16 PortString[ADDRESS_STR_MAX_SIZE];
- EFI_HII_HANDLE HiiHandle;
- EFI_IP6_CONFIG_INTERFACE_INFO *IfInfo;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1676,135 +1755,7 @@ Ip6FormCallback (
if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
case KEY_GET_CURRENT_SETTING:
- Ip6Config = &Instance->Ip6Config;
- HiiHandle = Instance->CallbackInfo.RegisteredHandle;
- Data = NULL;
-
- //
- // Get current interface info.
- //
- Status = Ip6ConfigNvGetData (
- Ip6Config,
- Ip6ConfigDataTypeInterfaceInfo,
- &DataSize,
- (VOID **) &Data
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Generate dynamic text opcode for host address and draw it.
- //
- IfInfo = (EFI_IP6_CONFIG_INTERFACE_INFO *) Data;
- Status = Ip6ConvertAddressListToString (
- PortString,
- HiiHandle,
- Ip6ConfigNvHostAddress,
- IfInfo->AddressInfo,
- IfInfo->AddressInfoCount
- );
- if (EFI_ERROR (Status)) {
- FreePool (Data);
- return Status;
- }
-
- //
- // Generate the dynamic text opcode for route table and draw it.
- //
- Status = Ip6ConvertAddressListToString (
- PortString,
- HiiHandle,
- Ip6ConfigNvRouteTable,
- IfInfo->RouteTable,
- IfInfo->RouteCount
- );
- if (EFI_ERROR (Status)) {
- FreePool (Data);
- return Status;
- }
-
- //
- // Get DNS server list.
- //
- FreePool (Data);
- DataSize = 0;
- Data = NULL;
- Status = Ip6ConfigNvGetData (
- Ip6Config,
- Ip6ConfigDataTypeDnsServer,
- &DataSize,
- (VOID **) &Data
- );
- if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- if (Data != NULL) {
- FreePool (Data);
- }
- return Status;
- }
-
- if (DataSize > 0) {
- //
- // Generate the dynamic text opcode for DNS server and draw it.
- //
- Status = Ip6ConvertAddressListToString (
- PortString,
- HiiHandle,
- Ip6ConfigNvDnsAddress,
- Data,
- DataSize / sizeof (EFI_IPv6_ADDRESS)
- );
- if (EFI_ERROR (Status)) {
- FreePool (Data);
- return Status;
- }
- }
-
- //
- // Get gateway adderss list.
- //
- if (Data != NULL) {
- FreePool (Data);
- }
-
- DataSize = 0;
- Data = NULL;
- Status = Ip6ConfigNvGetData (
- Ip6Config,
- Ip6ConfigDataTypeGateway,
- &DataSize,
- (VOID **) &Data
- );
- if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
- if (Data != NULL) {
- FreePool (Data);
- }
- return Status;
- }
-
- if (DataSize > 0) {
- //
- // Generate the dynamic text opcode for gateway and draw it.
- //
- Status = Ip6ConvertAddressListToString (
- PortString,
- HiiHandle,
- Ip6ConfigNvGatewayAddress,
- Data,
- DataSize / sizeof (EFI_IPv6_ADDRESS)
- );
- if (EFI_ERROR (Status)) {
- FreePool (Data);
- return Status;
- }
- }
-
- if (Data != NULL) {
- FreePool (Data);
- }
-
- Status = EFI_SUCCESS;
-
+ Status = Ip6GetCurrentSetting (Instance);
break;
default:
@@ -1813,6 +1764,13 @@ Ip6FormCallback (
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case KEY_SAVE_CONFIG_CHANGES:
+ Status = Ip6ConvertIfrNvDataToConfigNvDataAdvanced (IfrNvData, Instance);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ Status = Ip6GetCurrentSetting (Instance);
+
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
break;
@@ -1829,7 +1787,7 @@ Ip6FormCallback (
break;
case KEY_SAVE_CHANGES:
- Status = Ip6ConvertIfrNvDataToConfigNvData (IfrNvData, Instance);
+ Status = Ip6ConvertIfrNvDataToConfigNvDataGeneral (IfrNvData, Instance);
if (EFI_ERROR (Status)) {
break;
}
diff --git a/NetworkPkg/Ip6Dxe/Ip6NvData.h b/NetworkPkg/Ip6Dxe/Ip6NvData.h
index b67e6249..09177613 100644
--- a/NetworkPkg/Ip6Dxe/Ip6NvData.h
+++ b/NetworkPkg/Ip6Dxe/Ip6NvData.h
@@ -1,7 +1,7 @@
/** @file
NVData structure used by the IP6 configuration component.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -43,7 +43,7 @@
#define INTERFACE_ID_STR_MIN_SIZE 1
#define INTERFACE_ID_STR_MAX_SIZE 23
-#define INTERFACE_ID_STR_STORAGE 24
+#define INTERFACE_ID_STR_STORAGE 25
#define IP6_STR_MAX_SIZE 40
#define ADDRESS_STR_MIN_SIZE 2
#define ADDRESS_STR_MAX_SIZE 255
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
index e814d5a8..540adee3 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcBoot.c
@@ -1,7 +1,7 @@
/** @file
Boot functions implementation for UefiPxeBc Driver.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -278,7 +278,7 @@ PxeBcSelectBootMenu (
PXEBC_BOOT_MENU_ENTRY *MenuArray[PXEBC_MENU_MAX_NUM];
Finish = FALSE;
- Select = 1;
+ Select = 0;
Index = 0;
*Type = 0;
Mode = Private->PxeBc.Mode;
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index 183dc0ce..07f2b6cf 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
/** @file
This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
- Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -428,10 +428,6 @@ EfiPxeBcDhcp (
// Start S.A.R.R. process to get a IPv6 address and other boot information.
//
Status = PxeBcDhcp6Sarr (Private, Private->Dhcp6);
-
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
} else {
//
@@ -443,13 +439,11 @@ EfiPxeBcDhcp (
// Start D.O.R.A. process to get a IPv4 address and other boot information.
//
Status = PxeBcDhcp4Dora (Private, Private->Dhcp4);
-
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
}
-
-ON_EXIT:
+
+ //
+ // Reconfigure the UDP instance with the default configuration.
+ //
if (Mode->UsingIpv6) {
Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else {
@@ -572,6 +566,7 @@ EfiPxeBcDiscover (
//
// There are 3 methods to get the information for discover.
//
+ ZeroMem (&DefaultInfo, sizeof (EFI_PXE_BASE_CODE_DISCOVER_INFO));
if (*Layer != EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL) {
//
// 1. Take the previous setting as the discover info.
@@ -690,9 +685,7 @@ EfiPxeBcDiscover (
}
}
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- } else {
+ if (!EFI_ERROR (Status)) {
//
// Parse the cached PXE reply packet, and store it into mode data if valid.
//
@@ -964,11 +957,9 @@ EfiPxeBcMtftp (
Mode->IcmpErrorReceived = TRUE;
}
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
-ON_EXIT:
+ //
+ // Reconfigure the UDP instance with the default configuration.
+ //
if (Mode->UsingIpv6) {
Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
} else {
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index f918d6a2..e6fb01ca 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,7 +1,7 @@
/** @file
Support functions implementation for UefiPxeBc Driver.
- Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -59,10 +59,6 @@ PxeBcFlushStaionIp (
}
Status = Private->Ip6->Receive (Private->Ip6, &Private->Icmp6Token);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
} else {
ASSERT (SubnetMask != NULL);
CopyMem (&Private->Udp4CfgData.StationAddress, StationIp, sizeof (EFI_IPv4_ADDRESS));
@@ -82,10 +78,6 @@ PxeBcFlushStaionIp (
}
Status = Private->Ip4->Receive (Private->Ip4, &Private->IcmpToken);
- if (EFI_ERROR (Status)) {
- goto ON_EXIT;
- }
-
}
ON_EXIT: