summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/Mtftp4Dxe
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-12-18 07:01:23 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-12-18 07:01:23 +0000
commitc4a62a12c2890297cfcb9828b51b058fb347c01a (patch)
treef60f918368c8c96325bcfbc050c7b6189f567492 /MdeModulePkg/Universal/Network/Mtftp4Dxe
parent372787b85a2a6a6da0a7b0357f58953da26d81a8 (diff)
downloadedk2-c4a62a12c2890297cfcb9828b51b058fb347c01a.zip
edk2-c4a62a12c2890297cfcb9828b51b058fb347c01a.tar.gz
edk2-c4a62a12c2890297cfcb9828b51b058fb347c01a.tar.bz2
Sync the latest version from R8.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4400 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Mtftp4Dxe')
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c45
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c10
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c26
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c4
4 files changed, 51 insertions, 34 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
index 1186249..f6f431d 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
@@ -348,7 +348,7 @@ Mtftp4DriverBindingStop (
NicHandle = NetLibGetNicHandle (Controller, &gEfiUdp4ProtocolGuid);
if (NicHandle == NULL) {
- return EFI_SUCCESS;
+ return EFI_DEVICE_ERROR;
}
Status = gBS->OpenProtocol (
@@ -370,37 +370,32 @@ Mtftp4DriverBindingStop (
return EFI_SUCCESS;
}
- OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
- MtftpSb->InDestory = TRUE;
+ OldTpl = NET_RAISE_TPL (NET_TPL_LOCK);
- while (!NetListIsEmpty (&MtftpSb->Children)) {
- Instance = NET_LIST_HEAD (&MtftpSb->Children, MTFTP4_PROTOCOL, Link);
- Mtftp4ServiceBindingDestroyChild (ServiceBinding, Instance->Handle);
- }
+ if (NumberOfChildren == 0) {
- if (MtftpSb->ChildrenNum != 0) {
- Status = EFI_DEVICE_ERROR;
- goto ON_ERROR;
- }
+ MtftpSb->InDestory = TRUE;
- Status = gBS->UninstallProtocolInterface (
- NicHandle,
- &gEfiMtftp4ServiceBindingProtocolGuid,
- ServiceBinding
- );
+ gBS->UninstallProtocolInterface (
+ NicHandle,
+ &gEfiMtftp4ServiceBindingProtocolGuid,
+ ServiceBinding
+ );
- if (EFI_ERROR (Status)) {
- goto ON_ERROR;
- }
+ Mtftp4CleanService (MtftpSb);
- Mtftp4CleanService (MtftpSb);
- NetFreePool (MtftpSb);
+ NetFreePool (MtftpSb);
+ } else {
- NET_RESTORE_TPL (OldTpl);
- return EFI_SUCCESS;
+ while (!NetListIsEmpty (&MtftpSb->Children)) {
+ Instance = NET_LIST_HEAD (&MtftpSb->Children, MTFTP4_PROTOCOL, Link);
+ Mtftp4ServiceBindingDestroyChild (ServiceBinding, Instance->Handle);
+ }
-ON_ERROR:
- MtftpSb->InDestory = FALSE;
+ if (MtftpSb->ChildrenNum != 0) {
+ Status = EFI_DEVICE_ERROR;
+ }
+ }
NET_RESTORE_TPL (OldTpl);
return Status;
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
index 3ce8792..0bd835b 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
@@ -585,6 +585,16 @@ Mtftp4ConfigUnicastPort (
return EFI_SUCCESS;
}
+ if (!Config->UseDefaultSetting && !EFI_IP4_EQUAL (&mZeroIp4Addr, &Config->GatewayIp)) {
+ //
+ // The station IP address is manually configured and the Gateway IP is not 0.
+ // Add the default route for this UDP instance.
+ //
+ Status = UdpIo->Udp->Routes (UdpIo->Udp, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, &Config->GatewayIp);
+ if (EFI_ERROR (Status)) {
+ UdpIo->Udp->Configure (UdpIo->Udp, NULL);
+ }
+ }
return Status;
}
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
index 906cce8..7c2114e 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
@@ -412,6 +412,18 @@ Mtftp4RrqConfigMcastPort (
return Status;
}
+ if (!Config->UseDefaultSetting && !EFI_IP4_EQUAL (&mZeroIp4Addr, &Config->GatewayIp)) {
+ //
+ // The station IP address is manually configured and the Gateway IP is not 0.
+ // Add the default route for this UDP instance.
+ //
+ Status = McastIo->Udp->Routes (McastIo->Udp, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, &Config->GatewayIp);
+ if (EFI_ERROR (Status)) {
+ McastIo->Udp->Configure (McastIo->Udp, NULL);
+ return Status;
+ }
+ }
+
//
// join the multicast group
//
@@ -534,22 +546,22 @@ Mtftp4RrqHandleOack (
return Status;
}
-
+
//
// Update the parameters used.
//
if (Reply.BlkSize != 0) {
Instance->BlkSize = Reply.BlkSize;
}
-
+
if (Reply.Timeout != 0) {
Instance->Timeout = Reply.Timeout;
- }
- }
-
+ }
+ }
+
} else {
Instance->Master = TRUE;
-
+
if (Reply.BlkSize != 0) {
Instance->BlkSize = Reply.BlkSize;
}
@@ -558,7 +570,7 @@ Mtftp4RrqHandleOack (
Instance->Timeout = Reply.Timeout;
}
}
-
+
//
// Send an ACK to (Expected - 1) which is 0 for unicast download,
// or tell the server we want to receive the Expected block.
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
index ce9db68..e56aa15 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
@@ -467,7 +467,7 @@ Mtftp4SendPacket (
Instance->UnicastPort,
Packet,
&UdpPoint,
- Instance->Gateway,
+ 0,
Mtftp4OnPacketSent,
Instance
);
@@ -524,7 +524,7 @@ Mtftp4Retransmit (
Instance->UnicastPort,
Instance->LastPacket,
&UdpPoint,
- Instance->Gateway,
+ 0,
Mtftp4OnPacketSent,
Instance
);