]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Output.c
Update IPsec.h file to follow approved ECR which will be collected into future UEFI...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Output.c
index 863ca2a46451ec84903f8073a6bbebb754e64dda..93cc52eb57f1687863fc1c4cd3412b8701bc38ba 100644 (file)
@@ -250,6 +250,31 @@ Ip4Output (
     Head->Src = IpIf->Ip;\r
   }\r
 \r
+  //\r
+  // Before IPsec process, prepared the IP head.\r
+  //\r
+  HeadLen        = sizeof (IP4_HEAD) + ((OptLen + 3) & (~0x03));\r
+  Head->HeadLen  = (UINT8) HeadLen >> 2;\r
+  Head->Id       = mIp4Id++;\r
+  Head->Ver      = 4;\r
+  \r
+  //\r
+  // Call IPsec process.\r
+  //\r
+  Status = Ip4IpSecProcessPacket (\r
+             IpSb, \r
+             &Head, \r
+             &Packet, \r
+             &Option, \r
+             &OptLen, \r
+             EfiIPsecOutBound,\r
+             Context\r
+             );\r
+\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // Route the packet unless overrided, that is, GateWay isn't zero.\r
   //\r
@@ -291,30 +316,11 @@ Ip4Output (
     }\r
   }\r
 \r
-  //\r
-  // TODO: currently Option/OptLen are not included into encryption scope.\r
-  //\r
-  Status = Ip4IpSecProcessPacket (\r
-             IpSb, \r
-             Head, \r
-             &Packet, \r
-             Option, \r
-             OptLen, \r
-             EfiIPsecOutBound,\r
-             Context\r
-             );\r
-\r
-  if (EFI_ERROR(Status)) {\r
-    return Status;\r
-  }\r
-\r
   //\r
   // OK, selected the source and route, fragment the packet then send\r
   // them. Tag each fragment other than the first one as spawn from it.\r
   //\r
-  Mtu            = IpSb->MaxPacketSize + sizeof (IP4_HEAD);\r
-  HeadLen        = sizeof (IP4_HEAD) + ((OptLen + 3) & (~0x03));\r
-  Head->Id       = mIp4Id++;\r
+  Mtu = IpSb->MaxPacketSize + sizeof (IP4_HEAD);  \r
 \r
   if (Packet->TotalSize + HeadLen > Mtu) {\r
     //\r