]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Input.c
index e6943230195cb6e056c132e214e483206817a6ba..f22a3c3199ed89e2a7f5836d60af228af8e1ae51 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   IP4 input process.\r
-  \r
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
+\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -441,8 +441,8 @@ DROP:
 }\r
 \r
 /**\r
-  The callback function for the net buffer which wraps the packet processed by \r
-  IPsec. It releases the wrap packet and also signals IPsec to free the resources. \r
+  The callback function for the net buffer which wraps the packet processed by\r
+  IPsec. It releases the wrap packet and also signals IPsec to free the resources.\r
 \r
   @param[in]  Arg       The wrap context\r
 \r
@@ -469,25 +469,25 @@ Ip4IpSecFree (
 }\r
 \r
 /**\r
-  The work function to locate IPsec protocol to process the inbound or \r
+  The work function to locate IPsec protocol to process the inbound or\r
   outbound IP packets. The process routine handls the packet with following\r
-  actions: bypass the packet, discard the packet, or protect the packet.       \r
+  actions: bypass the packet, discard the packet, or protect the packet.\r
 \r
   @param[in]       IpSb          The IP4 service instance.\r
   @param[in, out]  Head          The The caller supplied IP4 header.\r
   @param[in, out]  Netbuf        The IP4 packet to be processed by IPsec.\r
   @param[in, out]  Options       The caller supplied options.\r
   @param[in, out]  OptionsLen    The length of the option.\r
-  @param[in]       Direction     The directionality in an SPD entry, \r
+  @param[in]       Direction     The directionality in an SPD entry,\r
                                  EfiIPsecInBound or EfiIPsecOutBound.\r
   @param[in]       Context       The token's wrap.\r
 \r
   @retval EFI_SUCCESS            The IPsec protocol is not available or disabled.\r
   @retval EFI_SUCCESS            The packet was bypassed and all buffers remain the same.\r
   @retval EFI_SUCCESS            The packet was protected.\r
-  @retval EFI_ACCESS_DENIED      The packet was discarded.  \r
+  @retval EFI_ACCESS_DENIED      The packet was discarded.\r
   @retval EFI_OUT_OF_RESOURCES   There is no suffcient resource to complete the operation.\r
-  @retval EFI_BUFFER_TOO_SMALL   The number of non-empty block is bigger than the \r
+  @retval EFI_BUFFER_TOO_SMALL   The number of non-empty block is bigger than the\r
                                  number of input data blocks when build a fragment table.\r
 \r
 **/\r
@@ -519,12 +519,12 @@ Ip4IpSecProcessPacket (
     goto ON_EXIT;\r
   }\r
   ASSERT (mIpSec != NULL);\r
-  \r
+\r
   Packet        = *Netbuf;\r
   RecycleEvent  = NULL;\r
   IpSecWrap     = NULL;\r
   FragmentTable = NULL;\r
-  TxWrap        = (IP4_TXTOKEN_WRAP *) Context; \r
+  TxWrap        = (IP4_TXTOKEN_WRAP *) Context;\r
   FragmentCount = Packet->BlockOpNum;\r
 \r
   ZeroMem (&ZeroHead, sizeof (IP4_HEAD));\r
@@ -535,14 +535,14 @@ Ip4IpSecProcessPacket (
   if (mIpSec->DisabledFlag) {\r
     //\r
     // If IPsec is disabled, restore the original MTU\r
-    //   \r
+    //\r
     IpSb->MaxPacketSize = IpSb->OldMaxPacketSize;\r
     goto ON_EXIT;\r
   } else {\r
     //\r
-    // If IPsec is enabled, use the MTU which reduce the IPsec header length.  \r
+    // If IPsec is enabled, use the MTU which reduce the IPsec header length.\r
     //\r
-    IpSb->MaxPacketSize = IpSb->OldMaxPacketSize - IP4_MAX_IPSEC_HEADLEN;   \r
+    IpSb->MaxPacketSize = IpSb->OldMaxPacketSize - IP4_MAX_IPSEC_HEADLEN;\r
   }\r
 \r
   //\r
@@ -554,9 +554,9 @@ Ip4IpSecProcessPacket (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto ON_EXIT;\r
   }\r
\r
+\r
   Status = NetbufBuildExt (Packet, FragmentTable, &FragmentCount);\r
-  \r
+\r
   //\r
   // Record the original FragmentTable and count.\r
   //\r
@@ -572,7 +572,7 @@ Ip4IpSecProcessPacket (
   // Convert host byte order to network byte order\r
   //\r
   Ip4NtohHead (*Head);\r
-  \r
+\r
   Status = mIpSec->ProcessExt (\r
                      mIpSec,\r
                      IpSb->Controller,\r
@@ -590,7 +590,7 @@ Ip4IpSecProcessPacket (
   // Convert back to host byte order\r
   //\r
   Ip4NtohHead (*Head);\r
-  \r
+\r
   if (EFI_ERROR (Status)) {\r
     FreePool (OriginalFragmentTable);\r
     goto ON_EXIT;\r
@@ -610,7 +610,7 @@ Ip4IpSecProcessPacket (
   }\r
 \r
   if (Direction == EfiIPsecOutBound && TxWrap != NULL) {\r
-  \r
+\r
     TxWrap->IpSecRecycleSignal = RecycleEvent;\r
     TxWrap->Packet             = NetbufFromExt (\r
                                    FragmentTable,\r
@@ -635,28 +635,28 @@ Ip4IpSecProcessPacket (
     //\r
     NetIpSecNetbufFree (*Netbuf);\r
     *Netbuf = TxWrap->Packet;\r
-    \r
+\r
   } else {\r
-  \r
+\r
     IpSecWrap = AllocateZeroPool (sizeof (IP4_IPSEC_WRAP));\r
-  \r
+\r
     if (IpSecWrap == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
       gBS->SignalEvent (RecycleEvent);\r
       goto ON_EXIT;\r
     }\r
-    \r
+\r
     IpSecWrap->IpSecRecycleSignal = RecycleEvent;\r
     IpSecWrap->Packet             = Packet;\r
     Packet                        = NetbufFromExt (\r
-                                      FragmentTable, \r
-                                      FragmentCount, \r
-                                      IP4_MAX_HEADLEN, \r
-                                      0, \r
-                                      Ip4IpSecFree, \r
+                                      FragmentTable,\r
+                                      FragmentCount,\r
+                                      IP4_MAX_HEADLEN,\r
+                                      0,\r
+                                      Ip4IpSecFree,\r
                                       IpSecWrap\r
                                       );\r
-  \r
+\r
     if (Packet == NULL) {\r
       Packet = IpSecWrap->Packet;\r
       gBS->SignalEvent (RecycleEvent);\r
@@ -686,7 +686,7 @@ ON_EXIT:
 /**\r
   Pre-process the IPv4 packet. First validates the IPv4 packet, and\r
   then reassembles packet if it is necessary.\r
-  \r
+\r
   @param[in]       IpSb            Pointer to IP4_SERVICE.\r
   @param[in, out]  Packet          Pointer to the Packet to be processed.\r
   @param[in]       Head            Pointer to the IP4_HEAD.\r
@@ -696,7 +696,7 @@ ON_EXIT:
                                    as multicast.\r
 \r
   @retval     EFI_SEUCCESS               The recieved packet is in well form.\r
-  @retval     EFI_INVAILD_PARAMETER      The recieved packet is malformed.  \r
+  @retval     EFI_INVAILD_PARAMETER      The recieved packet is malformed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -705,9 +705,9 @@ Ip4PreProcessPacket (
   IN OUT NET_BUF        **Packet,\r
   IN     IP4_HEAD       *Head,\r
   IN     UINT8          *Option,\r
-  IN     UINT32         OptionLen, \r
+  IN     UINT32         OptionLen,\r
   IN     UINT32         Flag\r
-  ) \r
+  )\r
 {\r
   IP4_CLIP_INFO             *Info;\r
   UINT32                    HeadLen;\r
@@ -720,7 +720,7 @@ Ip4PreProcessPacket (
   if ((*Packet)->TotalSize < IP4_MIN_HEADLEN) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   HeadLen  = (Head->HeadLen << 2);\r
   TotalLen = NTOHS (Head->TotalLen);\r
 \r
@@ -769,7 +769,7 @@ Ip4PreProcessPacket (
   // Validate the options. Don't call the Ip4OptionIsValid if\r
   // there is no option to save some CPU process.\r
   //\r
-  \r
+\r
   if ((OptionLen > 0) && !Ip4OptionIsValid (Option, OptionLen, TRUE)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -810,7 +810,7 @@ Ip4PreProcessPacket (
       return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -842,7 +842,7 @@ Ip4AccpetFrame (
   IP4_HEAD                  ZeroHead;\r
   UINT8                     *Option;\r
   UINT32                    OptionLen;\r
-  \r
+\r
   IpSb   = (IP4_SERVICE *) Context;\r
   Option = NULL;\r
 \r
@@ -861,11 +861,11 @@ Ip4AccpetFrame (
   // Validate packet format and reassemble packet if it is necessary.\r
   //\r
   Status = Ip4PreProcessPacket (\r
-             IpSb, \r
-             &Packet, \r
-             Head, \r
+             IpSb,\r
+             &Packet,\r
+             Head,\r
              Option,\r
-             OptionLen,  \r
+             OptionLen,\r
              Flag\r
              );\r
 \r
@@ -890,7 +890,7 @@ Ip4AccpetFrame (
   if (EFI_ERROR (Status)) {\r
     goto RESTART;\r
   }\r
-  \r
+\r
   //\r
   // If the packet is protected by tunnel mode, parse the inner Ip Packet.\r
   //\r
@@ -914,7 +914,7 @@ Ip4AccpetFrame (
       goto RESTART;\r
     }\r
   }\r
-  \r
+\r
   ASSERT (Packet != NULL);\r
   Head  = Packet->Ip.Ip4;\r
   IP4_GET_CLIP_INFO (Packet)->Status = EFI_SUCCESS;\r
@@ -1298,7 +1298,7 @@ Ip4InstanceDeliverPacket (
         //\r
         Head = NetbufAllocSpace (Dup, IP4_MAX_HEADLEN, NET_BUF_HEAD);\r
         ASSERT (Head != NULL);\r
-        \r
+\r
         Dup->Ip.Ip4 = (IP4_HEAD *) Head;\r
 \r
         CopyMem (Head, Packet->Ip.Ip4, Packet->Ip.Ip4->HeadLen << 2);\r
@@ -1345,7 +1345,7 @@ Ip4InstanceDeliverPacket (
   @param[in]  Head               The header of the received packet.\r
   @param[in]  Packet             The data of the received packet.\r
   @param[in]  Option             Point to the IP4 packet header options.\r
-  @param[in]  OptionLen          Length of the IP4 packet header options.  \r
+  @param[in]  OptionLen          Length of the IP4 packet header options.\r
   @param[in]  IpIf               The interface to enqueue the packet to.\r
 \r
   @return The number of the IP4 children that accepts the packet\r