VirtualBox

Ignore:
Timestamp:
Mar 12, 2019 12:40:12 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129295
Message:

EFI: First step in UDK2018 merge. Does not build yet.

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/ComponentName.c

    r58466 r77662  
    33  EFI_COMPONENT_NAME2_PROTOCOL protocol.
    44
    5   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
     5  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    66
    77  This program and the accompanying materials
     
    264264  Offset = 0;
    265265  Status = Ip6->GetModeData (Ip6, &Ip6ModeData, NULL, NULL);
     266  if (!EFI_ERROR (Status)) {
     267    if (Ip6ModeData.AddressList != NULL) {
     268      FreePool (Ip6ModeData.AddressList);
     269    }
     270
     271    if (Ip6ModeData.GroupTable != NULL) {
     272      FreePool (Ip6ModeData.GroupTable);
     273    }
     274
     275    if (Ip6ModeData.RouteTable != NULL) {
     276      FreePool (Ip6ModeData.RouteTable);
     277    }
     278
     279    if (Ip6ModeData.NeighborCache != NULL) {
     280      FreePool (Ip6ModeData.NeighborCache);
     281    }
     282
     283    if (Ip6ModeData.PrefixTable != NULL) {
     284      FreePool (Ip6ModeData.PrefixTable);
     285    }
     286
     287    if (Ip6ModeData.IcmpTypeList != NULL) {
     288      FreePool (Ip6ModeData.IcmpTypeList);
     289    }
     290  }
     291
    266292  if (!EFI_ERROR (Status) && Ip6ModeData.IsStarted) {
    267293    Status = NetLibIp6ToStr (&Ip6ModeData.ConfigData.StationAddress, Address, sizeof(Address));
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Common.c

    r58466 r77662  
    22  The implementation of common functions shared by IP6 driver.
    33
    4   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    429429  EFI_IPv6_ADDRESS     SnMCastAddr;
    430430
    431   if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > IP6_PREFIX_NUM) {
     431  if (IsListEmpty (AddressList) || *AddressCount < 1 || PrefixLength > IP6_PREFIX_MAX) {
    432432    return EFI_INVALID_PARAMETER;
    433433  }
     
    607607
    608608  ASSERT (Dest != NULL && Src != NULL);
    609   ASSERT (PrefixLength < IP6_PREFIX_NUM);
     609  ASSERT (PrefixLength <= IP6_PREFIX_MAX);
    610610
    611611  Byte = (UINT8) (PrefixLength / 8);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Config.vfr

    r58466 r77662  
    2222  title    = STRING_TOKEN(STR_IP6_CONFIG_FORM_TITLE),
    2323  help     = STRING_TOKEN(STR_IP6_CONFIG_FORM_HELP),
    24   class    = EFI_NETWORK_DEVICE_CLASS,
    25   subclass = 0x03,
    2624
    2725  varstore IP6_CONFIG_IFR_NVDATA,
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c

    r58459 r77662  
    22  The implementation of EFI IPv6 Configuration Protocol.
    33
    4   Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    4848  )
    4949{
    50   LIST_ENTRY      *Entry;
    51   LIST_ENTRY      *Entry2;
    52   LIST_ENTRY      *Next;
    53   IP6_INTERFACE   *IpIf;
    54   IP6_DAD_ENTRY   *DadEntry;
     50  LIST_ENTRY          *Entry;
     51  LIST_ENTRY          *Entry2;
     52  LIST_ENTRY          *Next;
     53  IP6_INTERFACE       *IpIf;
     54  IP6_DAD_ENTRY       *DadEntry;
     55  IP6_DELAY_JOIN_LIST *DelayNode;
     56  IP6_ADDRESS_INFO    *AddrInfo;
     57  IP6_PROTOCOL        *Instance;
     58  BOOLEAN             Recovery;
     59
     60  Recovery = FALSE;
    5561
    5662  //
     
    8086  }
    8187
    82   //
    83   // All IPv6 children that use global unicast address as it's source address
    84   // should be destryoed now. The survivers are those use the link-local address
    85   // or the unspecified address as the source address.
    86   // TODO: Conduct a check here.
    87   Ip6RemoveAddr (
    88     IpSb,
    89     &IpSb->DefaultInterface->AddressList,
    90     &IpSb->DefaultInterface->AddressCount,
    91     NULL,
    92     0
    93     );
     88  if (!IsListEmpty (&IpSb->DefaultInterface->AddressList) && IpSb->DefaultInterface->AddressCount > 0) {
     89    //
     90    // If any IPv6 children (Instance) in configured state and use global unicast address, it will be
     91    // destroyed in Ip6RemoveAddr() function later. Then, the upper layer driver's Stop() function will be
     92    // called, which may break the upper layer network stacks. So, the driver should take the responsibility
     93    // for the recovery by using ConnectController() after Ip6RemoveAddr().
     94    // Here, just check whether need to recover the upper layer network stacks later.
     95    //
     96    NET_LIST_FOR_EACH (Entry, &IpSb->DefaultInterface->AddressList) {
     97      AddrInfo = NET_LIST_USER_STRUCT_S (Entry, IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);
     98      if (!IsListEmpty (&IpSb->Children)) {
     99        NET_LIST_FOR_EACH (Entry2, &IpSb->Children) {
     100          Instance = NET_LIST_USER_STRUCT_S (Entry2, IP6_PROTOCOL, Link, IP6_PROTOCOL_SIGNATURE);
     101          if ((Instance->State == IP6_STATE_CONFIGED) && EFI_IP6_EQUAL (&Instance->ConfigData.StationAddress, &AddrInfo->Address)) {
     102            Recovery = TRUE;
     103            break;
     104          }
     105        }
     106      }
     107    }
     108
     109    //
     110    // All IPv6 children that use global unicast address as it's source address
     111    // should be destroyed now. The survivers are those use the link-local address
     112    // or the unspecified address as the source address.
     113    // TODO: Conduct a check here.
     114    Ip6RemoveAddr (
     115      IpSb,
     116      &IpSb->DefaultInterface->AddressList,
     117      &IpSb->DefaultInterface->AddressCount,
     118      NULL,
     119      0
     120      );
     121
     122    if (IpSb->Controller != NULL && Recovery) {
     123      //
     124      // ConnectController() to recover the upper layer network stacks.
     125      //
     126      gBS->ConnectController (IpSb->Controller, NULL, NULL, TRUE);
     127    }
     128  }
     129
    94130
    95131  NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
    96132    //
    97     // remove all pending DAD entries for the global addresses.
     133    // remove all pending delay node and DAD entries for the global addresses.
    98134    //
    99135    IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);
     136
     137    NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DelayJoinList) {
     138      DelayNode = NET_LIST_USER_STRUCT (Entry2, IP6_DELAY_JOIN_LIST, Link);
     139      if (!NetIp6IsLinkLocalAddr (&DelayNode->AddressInfo->Address)) {
     140        RemoveEntryList (&DelayNode->Link);
     141        FreePool (DelayNode);
     142      }
     143    }
    100144
    101145    NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DupAddrDetectList) {
     
    113157  if (NewPolicy == Ip6ConfigPolicyAutomatic) {
    114158    //
    115     // Set paramters to trigger router solicitation sending in timer handler.
     159    // Set parameters to trigger router solicitation sending in timer handler.
    116160    //
    117161    IpSb->RouterAdvertiseReceived = FALSE;
     
    122166    IpSb->Ticks                   = (UINT32) IP6_GET_TICKS (IP6_ONE_SECOND_IN_MS);
    123167  }
    124 
    125168}
    126169
     
    211254  //
    212255  Oro                         = (EFI_DHCP6_PACKET_OPTION *) OptBuf;
    213   Oro->OpCode                 = HTONS (IP6_CONFIG_DHCP6_OPTION_ORO);
     256  Oro->OpCode                 = HTONS (DHCP6_OPT_ORO);
    214257  Oro->OpLen                  = HTONS (2);
    215   *((UINT16 *) &Oro->Data[0]) = HTONS (IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS);
     258  *((UINT16 *) &Oro->Data[0]) = HTONS (DHCP6_OPT_DNS_SERVERS);
    216259  OptList[0]                  = Oro;
    217260
     
    657700    return EFI_ABORTED;
    658701  } else {
    659 
    660     if (NewPolicy == Ip6ConfigPolicyAutomatic) {
    661       //
    662       // Clean the ManualAddress, Gateway and DnsServers, shrink the variable
    663       // data size, and fire up all the related events.
    664       //
    665       DataItem           = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
    666       if (DataItem->Data.Ptr != NULL) {
    667         FreePool (DataItem->Data.Ptr);
    668       }
    669       DataItem->Data.Ptr = NULL;
    670       DataItem->DataSize = 0;
    671       DataItem->Status   = EFI_NOT_FOUND;
    672       NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
    673 
    674       DataItem           = &Instance->DataItem[Ip6ConfigDataTypeGateway];
    675       if (DataItem->Data.Ptr != NULL) {
    676         FreePool (DataItem->Data.Ptr);
    677       }
    678       DataItem->Data.Ptr = NULL;
    679       DataItem->DataSize = 0;
    680       DataItem->Status   = EFI_NOT_FOUND;
    681       NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
    682 
    683       DataItem           = &Instance->DataItem[Ip6ConfigDataTypeDnsServer];
    684       DataItem->Data.Ptr = NULL;
    685       DataItem->DataSize = 0;
    686       DataItem->Status   = EFI_NOT_FOUND;
    687       NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
    688     } else {
     702    //
     703    // Clean the ManualAddress, Gateway and DnsServers, shrink the variable
     704    // data size, and fire up all the related events.
     705    //
     706    DataItem           = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
     707    if (DataItem->Data.Ptr != NULL) {
     708      FreePool (DataItem->Data.Ptr);
     709    }
     710    DataItem->Data.Ptr = NULL;
     711    DataItem->DataSize = 0;
     712    DataItem->Status   = EFI_NOT_FOUND;
     713    NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
     714
     715    DataItem           = &Instance->DataItem[Ip6ConfigDataTypeGateway];
     716    if (DataItem->Data.Ptr != NULL) {
     717      FreePool (DataItem->Data.Ptr);
     718    }
     719    DataItem->Data.Ptr = NULL;
     720    DataItem->DataSize = 0;
     721    DataItem->Status   = EFI_NOT_FOUND;
     722    NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
     723
     724    DataItem           = &Instance->DataItem[Ip6ConfigDataTypeDnsServer];
     725    DataItem->Data.Ptr = NULL;
     726    DataItem->DataSize = 0;
     727    DataItem->Status   = EFI_NOT_FOUND;
     728    NetMapIterate (&DataItem->EventMap, Ip6ConfigSignalEvent, NULL);
     729
     730    if (NewPolicy == Ip6ConfigPolicyManual) {
    689731      //
    690732      // The policy is changed from automatic to manual. Stop the DHCPv6 process
     
    749791  The callback function for Ip6SetAddr. The prototype is defined
    750792  as IP6_DAD_CALLBACK. It is called after Duplicate Address Detection is performed
    751   for the manual address set by Ip6ConfigSetMaunualAddress.
     793  for the manual address set by Ip6ConfigSetManualAddress.
    752794
    753795  @param[in]     IsDadPassed   If TRUE, Duplicate Address Detection passed.
     
    777819  ManualAddr = NULL;
    778820
     821  if (Item->DataSize == 0) {
     822    return;
     823  }
     824
    779825  for (Index = 0; Index < Item->DataSize / sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS); Index++) {
    780826    //
     
    885931**/
    886932EFI_STATUS
    887 Ip6ConfigSetMaunualAddress (
     933Ip6ConfigSetManualAddress (
    888934  IN IP6_CONFIG_INSTANCE  *Instance,
    889935  IN UINTN                DataSize,
     
    908954  EFI_STATUS                     Status;
    909955  BOOLEAN                        IsUpdated;
     956  LIST_ENTRY                     *Next;
     957  IP6_DAD_ENTRY                  *DadEntry;
     958  IP6_DELAY_JOIN_LIST            *DelayNode;
     959
     960  NewAddress      = NULL;
     961  TmpAddress      = NULL;
     962  CurrentAddrInfo = NULL;
     963  Copy            = NULL;
     964  Entry           = NULL;
     965  Entry2          = NULL;
     966  IpIf            = NULL;
     967  PrefixEntry     = NULL;
     968  Next            = NULL;
     969  DadEntry        = NULL;
     970  DelayNode       = NULL;
     971  Status          = EFI_SUCCESS;
    910972
    911973  ASSERT (Instance->DataItem[Ip6ConfigDataTypeManualAddress].Status != EFI_NOT_READY);
    912974
    913   if (((DataSize % sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS)) != 0) || (DataSize == 0)) {
     975  if ((DataSize != 0) && ((DataSize % sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS)) != 0)) {
    914976    return EFI_BAD_BUFFER_SIZE;
    915977  }
     
    919981  }
    920982
    921   NewAddressCount = DataSize / sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS);
    922   NewAddress      = (EFI_IP6_CONFIG_MANUAL_ADDRESS *) Data;
    923 
    924   for (Index1 = 0; Index1 < NewAddressCount; Index1++, NewAddress++) {
    925 
    926     if (NetIp6IsLinkLocalAddr (&NewAddress->Address)    ||
    927         !NetIp6IsValidUnicast (&NewAddress->Address)    ||
    928         (NewAddress->PrefixLength > 128)
    929         ) {
    930       //
    931       // make sure the IPv6 address is unicast and not link-local address &&
    932       // the prefix length is valid.
    933       //
    934       return EFI_INVALID_PARAMETER;
    935     }
    936 
    937     TmpAddress = NewAddress + 1;
    938     for (Index2 = Index1 + 1; Index2 < NewAddressCount; Index2++, TmpAddress++) {
    939       //
    940       // Any two addresses in the array can't be equal.
    941       //
    942       if (EFI_IP6_EQUAL (&TmpAddress->Address, &NewAddress->Address)) {
    943 
     983  IpSb = IP6_SERVICE_FROM_IP6_CONFIG_INSTANCE (Instance);
     984
     985  DataItem = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
     986
     987  if (Data != NULL && DataSize != 0) {
     988    NewAddressCount = DataSize / sizeof (EFI_IP6_CONFIG_MANUAL_ADDRESS);
     989    NewAddress      = (EFI_IP6_CONFIG_MANUAL_ADDRESS *) Data;
     990
     991    for (Index1 = 0; Index1 < NewAddressCount; Index1++, NewAddress++) {
     992
     993      if (NetIp6IsLinkLocalAddr (&NewAddress->Address)    ||
     994          !NetIp6IsValidUnicast (&NewAddress->Address)    ||
     995          (NewAddress->PrefixLength > 128)
     996          ) {
     997        //
     998        // make sure the IPv6 address is unicast and not link-local address &&
     999        // the prefix length is valid.
     1000        //
    9441001        return EFI_INVALID_PARAMETER;
    9451002      }
    946     }
    947   }
    948 
    949   IpSb = IP6_SERVICE_FROM_IP6_CONFIG_INSTANCE (Instance);
    950 
    951   //
    952   // Build the current source address list.
    953   //
    954   InitializeListHead (&CurrentSourceList);
    955   CurrentSourceCount = 0;
    956 
    957   NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
    958     IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);
    959 
    960     NET_LIST_FOR_EACH (Entry2, &IpIf->AddressList) {
    961       CurrentAddrInfo = NET_LIST_USER_STRUCT_S (Entry2, IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);
    962 
    963       Copy            = AllocateCopyPool (sizeof (IP6_ADDRESS_INFO), CurrentAddrInfo);
    964       if (Copy == NULL) {
    965         break;
    966       }
    967 
    968       InsertTailList (&CurrentSourceList, &Copy->Link);
    969       CurrentSourceCount++;
    970     }
    971   }
    972 
    973   //
    974   // Update the value... a long journey starts
    975   //
    976   NewAddress = AllocateCopyPool (DataSize, Data);
    977   if (NewAddress == NULL) {
    978     Ip6RemoveAddr (NULL, &CurrentSourceList, &CurrentSourceCount, NULL, 0);
    979 
    980     return EFI_OUT_OF_RESOURCES;
    981   }
    982 
    983   //
    984   // Store the new data, and init the DataItem status to EFI_NOT_READY because
    985   // we may have an asynchronous configuration process.
    986   //
    987   DataItem = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
    988   if (DataItem->Data.Ptr != NULL) {
    989     FreePool (DataItem->Data.Ptr);
    990   }
    991   DataItem->Data.Ptr = NewAddress;
    992   DataItem->DataSize = DataSize;
    993   DataItem->Status   = EFI_NOT_READY;
    994 
    995   //
    996   // Trigger DAD, it's an asynchronous process.
    997   //
    998   IsUpdated  = FALSE;
    999 
    1000   for (Index1 = 0; Index1 < NewAddressCount; Index1++, NewAddress++) {
    1001     if (Ip6IsOneOfSetAddress (IpSb, &NewAddress->Address, NULL, &CurrentAddrInfo)) {
    1002       ASSERT (CurrentAddrInfo != NULL);
    1003       //
    1004       // Remove this already existing source address from the CurrentSourceList
    1005       // built before.
     1003
     1004      TmpAddress = NewAddress + 1;
     1005      for (Index2 = Index1 + 1; Index2 < NewAddressCount; Index2++, TmpAddress++) {
     1006        //
     1007        // Any two addresses in the array can't be equal.
     1008        //
     1009        if (EFI_IP6_EQUAL (&TmpAddress->Address, &NewAddress->Address)) {
     1010
     1011          return EFI_INVALID_PARAMETER;
     1012        }
     1013      }
     1014    }
     1015
     1016    //
     1017    // Build the current source address list.
     1018    //
     1019    InitializeListHead (&CurrentSourceList);
     1020    CurrentSourceCount = 0;
     1021
     1022    NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
     1023      IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);
     1024
     1025      NET_LIST_FOR_EACH (Entry2, &IpIf->AddressList) {
     1026        CurrentAddrInfo = NET_LIST_USER_STRUCT_S (Entry2, IP6_ADDRESS_INFO, Link, IP6_ADDR_INFO_SIGNATURE);
     1027
     1028        Copy            = AllocateCopyPool (sizeof (IP6_ADDRESS_INFO), CurrentAddrInfo);
     1029        if (Copy == NULL) {
     1030          break;
     1031        }
     1032
     1033        InsertTailList (&CurrentSourceList, &Copy->Link);
     1034        CurrentSourceCount++;
     1035      }
     1036    }
     1037
     1038    //
     1039    // Update the value... a long journey starts
     1040    //
     1041    NewAddress = AllocateCopyPool (DataSize, Data);
     1042    if (NewAddress == NULL) {
     1043      Ip6RemoveAddr (NULL, &CurrentSourceList, &CurrentSourceCount, NULL, 0);
     1044
     1045      return EFI_OUT_OF_RESOURCES;
     1046    }
     1047
     1048    //
     1049    // Store the new data, and init the DataItem status to EFI_NOT_READY because
     1050    // we may have an asynchronous configuration process.
     1051    //
     1052    if (DataItem->Data.Ptr != NULL) {
     1053      FreePool (DataItem->Data.Ptr);
     1054    }
     1055    DataItem->Data.Ptr = NewAddress;
     1056    DataItem->DataSize = DataSize;
     1057    DataItem->Status   = EFI_NOT_READY;
     1058
     1059    //
     1060    // Trigger DAD, it's an asynchronous process.
     1061    //
     1062    IsUpdated  = FALSE;
     1063
     1064    for (Index1 = 0; Index1 < NewAddressCount; Index1++, NewAddress++) {
     1065      if (Ip6IsOneOfSetAddress (IpSb, &NewAddress->Address, NULL, &CurrentAddrInfo)) {
     1066        ASSERT (CurrentAddrInfo != NULL);
     1067        //
     1068        // Remove this already existing source address from the CurrentSourceList
     1069        // built before.
     1070        //
     1071        Ip6RemoveAddr (
     1072          NULL,
     1073          &CurrentSourceList,
     1074          &CurrentSourceCount,
     1075          &CurrentAddrInfo->Address,
     1076          128
     1077          );
     1078
     1079        //
     1080        // If the new address's prefix length is not specified, just use the previous configured
     1081        // prefix length for this address.
     1082        //
     1083        if (NewAddress->PrefixLength == 0) {
     1084          NewAddress->PrefixLength = CurrentAddrInfo->PrefixLength;
     1085        }
     1086
     1087        //
     1088        // This manual address is already in use, see whether prefix length is changed.
     1089        //
     1090        if (NewAddress->PrefixLength != CurrentAddrInfo->PrefixLength) {
     1091          //
     1092          // Remove the on-link prefix table, the route entry will be removed
     1093          // implicitly.
     1094          //
     1095          PrefixEntry = Ip6FindPrefixListEntry (
     1096                          IpSb,
     1097                          TRUE,
     1098                          CurrentAddrInfo->PrefixLength,
     1099                          &CurrentAddrInfo->Address
     1100                          );
     1101          if (PrefixEntry != NULL) {
     1102            Ip6DestroyPrefixListEntry (IpSb, PrefixEntry, TRUE, FALSE);
     1103          }
     1104
     1105          //
     1106          // Save the prefix length.
     1107          //
     1108          CurrentAddrInfo->PrefixLength = NewAddress->PrefixLength;
     1109          IsUpdated = TRUE;
     1110        }
     1111
     1112        //
     1113        // create a new on-link prefix entry.
     1114        //
     1115        PrefixEntry = Ip6FindPrefixListEntry (
     1116                        IpSb,
     1117                        TRUE,
     1118                        NewAddress->PrefixLength,
     1119                        &NewAddress->Address
     1120                        );
     1121        if (PrefixEntry == NULL) {
     1122          Ip6CreatePrefixListEntry (
     1123            IpSb,
     1124            TRUE,
     1125            (UINT32) IP6_INFINIT_LIFETIME,
     1126            (UINT32) IP6_INFINIT_LIFETIME,
     1127            NewAddress->PrefixLength,
     1128            &NewAddress->Address
     1129            );
     1130        }
     1131
     1132        CurrentAddrInfo->IsAnycast = NewAddress->IsAnycast;
     1133        //
     1134        // Artificially mark this address passed DAD be'coz it is already in use.
     1135        //
     1136        Ip6ManualAddrDadCallback (TRUE, &NewAddress->Address, Instance);
     1137      } else {
     1138        //
     1139        // A new address.
     1140        //
     1141        IsUpdated = TRUE;
     1142
     1143        //
     1144        // Set the new address, this will trigger DAD and activate the address if
     1145        // DAD succeeds.
     1146        //
     1147        Ip6SetAddress (
     1148          IpSb->DefaultInterface,
     1149          &NewAddress->Address,
     1150          NewAddress->IsAnycast,
     1151          NewAddress->PrefixLength,
     1152          (UINT32) IP6_INFINIT_LIFETIME,
     1153          (UINT32) IP6_INFINIT_LIFETIME,
     1154          Ip6ManualAddrDadCallback,
     1155          Instance
     1156          );
     1157      }
     1158    }
     1159
     1160    //
     1161    // Check the CurrentSourceList, it now contains those addresses currently in
     1162    // use and will be removed.
     1163    //
     1164    IpIf = IpSb->DefaultInterface;
     1165
     1166    while (!IsListEmpty (&CurrentSourceList)) {
     1167      IsUpdated = TRUE;
     1168
     1169      CurrentAddrInfo = NET_LIST_HEAD (&CurrentSourceList, IP6_ADDRESS_INFO, Link);
     1170
     1171      //
     1172      // This local address is going to be removed, the IP instances that are
     1173      // currently using it will be destroyed.
    10061174      //
    10071175      Ip6RemoveAddr (
    1008         NULL,
    1009         &CurrentSourceList,
    1010         &CurrentSourceCount,
     1176        IpSb,
     1177        &IpIf->AddressList,
     1178        &IpIf->AddressCount,
    10111179        &CurrentAddrInfo->Address,
    10121180        128
     
    10141182
    10151183      //
    1016       // This manual address is already in use, see whether prefix length is changed.
    1017       //
    1018       if (NewAddress->PrefixLength != CurrentAddrInfo->PrefixLength) {
    1019         //
    1020         // Remove the on-link prefix table, the route entry will be removed
    1021         // implicitly.
    1022         //
    1023         PrefixEntry = Ip6FindPrefixListEntry (
    1024                         IpSb,
    1025                         TRUE,
    1026                         CurrentAddrInfo->PrefixLength,
    1027                         &CurrentAddrInfo->Address
    1028                         );
    1029         if (PrefixEntry != NULL) {
    1030           Ip6DestroyPrefixListEntry (IpSb, PrefixEntry, TRUE, FALSE);
    1031         }
    1032 
    1033         //
    1034         // Save the prefix length.
    1035         //
    1036         CurrentAddrInfo->PrefixLength = NewAddress->PrefixLength;
    1037         IsUpdated = TRUE;
    1038       }
    1039 
    1040       //
    1041       // create a new on-link prefix entry.
     1184      // Remove the on-link prefix table, the route entry will be removed
     1185      // implicitly.
    10421186      //
    10431187      PrefixEntry = Ip6FindPrefixListEntry (
    10441188                      IpSb,
    10451189                      TRUE,
    1046                       NewAddress->PrefixLength,
    1047                       &NewAddress->Address
     1190                      CurrentAddrInfo->PrefixLength,
     1191                      &CurrentAddrInfo->Address
    10481192                      );
    1049       if (PrefixEntry == NULL) {
    1050         Ip6CreatePrefixListEntry (
    1051           IpSb,
    1052           TRUE,
    1053           (UINT32) IP6_INFINIT_LIFETIME,
    1054           (UINT32) IP6_INFINIT_LIFETIME,
    1055           NewAddress->PrefixLength,
    1056           &NewAddress->Address
    1057           );
    1058       }
    1059 
    1060       CurrentAddrInfo->IsAnycast = NewAddress->IsAnycast;
    1061       //
    1062       // Artificially mark this address passed DAD be'coz it is already in use.
    1063       //
    1064       Ip6ManualAddrDadCallback (TRUE, &NewAddress->Address, Instance);
     1193      if (PrefixEntry != NULL) {
     1194        Ip6DestroyPrefixListEntry (IpSb, PrefixEntry, TRUE, FALSE);
     1195      }
     1196
     1197      RemoveEntryList (&CurrentAddrInfo->Link);
     1198      FreePool (CurrentAddrInfo);
     1199    }
     1200
     1201    if (IsUpdated) {
     1202      if (DataItem->Status == EFI_NOT_READY) {
     1203        //
     1204        // If DAD is disabled on this interface, the configuration process is
     1205        // actually synchronous, and the data item's status will be changed to
     1206        // the final status before we reach here, just check it.
     1207        //
     1208        Status = EFI_NOT_READY;
     1209      } else {
     1210        Status = EFI_SUCCESS;
     1211      }
    10651212    } else {
    10661213      //
    1067       // A new address.
    1068       //
    1069       IsUpdated = TRUE;
    1070 
    1071       //
    1072       // Set the new address, this will trigger DAD and activate the address if
    1073       // DAD succeeds.
    1074       //
    1075       Ip6SetAddress (
    1076         IpSb->DefaultInterface,
    1077         &NewAddress->Address,
    1078         NewAddress->IsAnycast,
    1079         NewAddress->PrefixLength,
     1214      // No update is taken, reset the status to success and return EFI_ABORTED.
     1215      //
     1216      DataItem->Status = EFI_SUCCESS;
     1217      Status           = EFI_ABORTED;
     1218    }
     1219  } else {
     1220    //
     1221    // DataSize is 0 and Data is NULL, clean up the manual address.
     1222    //
     1223    if (DataItem->Data.Ptr != NULL) {
     1224      FreePool (DataItem->Data.Ptr);
     1225    }
     1226    DataItem->Data.Ptr = NULL;
     1227    DataItem->DataSize = 0;
     1228    DataItem->Status   = EFI_NOT_FOUND;
     1229
     1230    Ip6CleanDefaultRouterList (IpSb);
     1231    Ip6CleanPrefixListTable (IpSb, &IpSb->OnlinkPrefix);
     1232    Ip6CleanPrefixListTable (IpSb, &IpSb->AutonomousPrefix);
     1233    Ip6CleanAssembleTable (&IpSb->Assemble);
     1234
     1235    if (IpSb->LinkLocalOk) {
     1236      Ip6CreatePrefixListEntry (
     1237        IpSb,
     1238        TRUE,
    10801239        (UINT32) IP6_INFINIT_LIFETIME,
    10811240        (UINT32) IP6_INFINIT_LIFETIME,
    1082         Ip6ManualAddrDadCallback,
    1083         Instance
     1241        IP6_LINK_LOCAL_PREFIX_LENGTH,
     1242        &IpSb->LinkLocalAddr
    10841243        );
    10851244    }
    1086   }
    1087 
    1088   //
    1089   // Check the CurrentSourceList, it now contains those addresses currently in
    1090   // use and will be removed.
    1091   //
    1092   IpIf = IpSb->DefaultInterface;
    1093 
    1094   while (!IsListEmpty (&CurrentSourceList)) {
    1095     IsUpdated = TRUE;
    1096 
    1097     CurrentAddrInfo = NET_LIST_HEAD (&CurrentSourceList, IP6_ADDRESS_INFO, Link);
    1098 
    1099     //
    1100     // This local address is going to be removed, the IP instances that are
    1101     // currently using it will be destroyed.
    1102     //
     1245
    11031246    Ip6RemoveAddr (
    11041247      IpSb,
    1105       &IpIf->AddressList,
    1106       &IpIf->AddressCount,
    1107       &CurrentAddrInfo->Address,
    1108       128
     1248      &IpSb->DefaultInterface->AddressList,
     1249      &IpSb->DefaultInterface->AddressCount,
     1250      NULL,
     1251      0
    11091252      );
    11101253
    1111     //
    1112     // Remove the on-link prefix table, the route entry will be removed
    1113     // implicitly.
    1114     //
    1115     PrefixEntry = Ip6FindPrefixListEntry (
    1116                     IpSb,
    1117                     TRUE,
    1118                     CurrentAddrInfo->PrefixLength,
    1119                     &CurrentAddrInfo->Address
    1120                     );
    1121     if (PrefixEntry != NULL) {
    1122       Ip6DestroyPrefixListEntry (IpSb, PrefixEntry, TRUE, FALSE);
    1123     }
    1124 
    1125     RemoveEntryList (&CurrentAddrInfo->Link);
    1126     FreePool (CurrentAddrInfo);
    1127   }
    1128 
    1129   if (IsUpdated) {
    1130     if (DataItem->Status == EFI_NOT_READY) {
    1131       //
    1132       // If DAD is disabled on this interface, the configuration process is
    1133       // actually synchronous, and the data item's status will be changed to
    1134       // the final status before we reach here, just check it.
    1135       //
    1136       Status = EFI_NOT_READY;
    1137     } else {
    1138       Status = EFI_SUCCESS;
    1139     }
    1140   } else {
    1141     //
    1142     // No update is taken, reset the status to success and return EFI_ABORTED.
    1143     //
    1144     DataItem->Status = EFI_SUCCESS;
    1145     Status           = EFI_ABORTED;
     1254    NET_LIST_FOR_EACH (Entry, &IpSb->Interfaces) {
     1255      //
     1256      // Remove all pending delay node and DAD entries for the global addresses.
     1257      //
     1258      IpIf = NET_LIST_USER_STRUCT_S (Entry, IP6_INTERFACE, Link, IP6_INTERFACE_SIGNATURE);
     1259
     1260      NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DelayJoinList) {
     1261        DelayNode = NET_LIST_USER_STRUCT (Entry2, IP6_DELAY_JOIN_LIST, Link);
     1262        if (!NetIp6IsLinkLocalAddr (&DelayNode->AddressInfo->Address)) {
     1263          RemoveEntryList (&DelayNode->Link);
     1264          FreePool (DelayNode);
     1265        }
     1266      }
     1267
     1268      NET_LIST_FOR_EACH_SAFE (Entry2, Next, &IpIf->DupAddrDetectList) {
     1269        DadEntry = NET_LIST_USER_STRUCT_S (Entry2, IP6_DAD_ENTRY, Link, IP6_DAD_ENTRY_SIGNATURE);
     1270
     1271        if (!NetIp6IsLinkLocalAddr (&DadEntry->AddressInfo->Address)) {
     1272          //
     1273          // Fail this DAD entry if the address is not link-local.
     1274          //
     1275          Ip6OnDADFinished (FALSE, IpIf, DadEntry);
     1276        }
     1277      }
     1278    }
    11461279  }
    11471280
     
    11911324  VOID                  *Tmp;
    11921325
    1193   if ((DataSize % sizeof (EFI_IPv6_ADDRESS) != 0) || (DataSize == 0)) {
     1326  OldGateway      = NULL;
     1327  NewGateway      = NULL;
     1328  Item            = NULL;
     1329  DefaultRouter   = NULL;
     1330  Tmp             = NULL;
     1331  OneRemoved      = FALSE;
     1332  OneAdded        = FALSE;
     1333
     1334  if ((DataSize != 0) && (DataSize % sizeof (EFI_IPv6_ADDRESS) != 0)) {
    11941335    return EFI_BAD_BUFFER_SIZE;
    11951336  }
     
    11971338  if (Instance->Policy != Ip6ConfigPolicyManual) {
    11981339    return EFI_WRITE_PROTECTED;
    1199   }
    1200 
    1201   NewGateway      = (EFI_IPv6_ADDRESS *) Data;
    1202   NewGatewayCount = DataSize / sizeof (EFI_IPv6_ADDRESS);
    1203   for (Index1 = 0; Index1 < NewGatewayCount; Index1++) {
    1204 
    1205     if (!NetIp6IsValidUnicast (NewGateway + Index1)) {
    1206 
    1207       return EFI_INVALID_PARAMETER;
    1208     }
    1209 
    1210     for (Index2 = Index1 + 1; Index2 < NewGatewayCount; Index2++) {
    1211       if (EFI_IP6_EQUAL (NewGateway + Index1, NewGateway + Index2)) {
    1212         return EFI_INVALID_PARAMETER;
    1213       }
    1214     }
    12151340  }
    12161341
     
    12191344  OldGateway      = Item->Data.Gateway;
    12201345  OldGatewayCount = Item->DataSize / sizeof (EFI_IPv6_ADDRESS);
    1221   OneRemoved      = FALSE;
    1222   OneAdded        = FALSE;
    1223 
    1224   if (NewGatewayCount != OldGatewayCount) {
    1225     Tmp = AllocatePool (DataSize);
    1226     if (Tmp == NULL) {
    1227       return EFI_OUT_OF_RESOURCES;
     1346
     1347  for (Index1 = 0; Index1 < OldGatewayCount; Index1++) {
     1348    //
     1349    // Remove this default router.
     1350    //
     1351    DefaultRouter = Ip6FindDefaultRouter (IpSb, OldGateway + Index1);
     1352    if (DefaultRouter != NULL) {
     1353      Ip6DestroyDefaultRouter (IpSb, DefaultRouter);
     1354      OneRemoved = TRUE;
     1355    }
     1356  }
     1357
     1358  if (Data != NULL && DataSize != 0) {
     1359    NewGateway      = (EFI_IPv6_ADDRESS *) Data;
     1360    NewGatewayCount = DataSize / sizeof (EFI_IPv6_ADDRESS);
     1361    for (Index1 = 0; Index1 < NewGatewayCount; Index1++) {
     1362
     1363      if (!NetIp6IsValidUnicast (NewGateway + Index1)) {
     1364
     1365        return EFI_INVALID_PARAMETER;
     1366      }
     1367
     1368      for (Index2 = Index1 + 1; Index2 < NewGatewayCount; Index2++) {
     1369        if (EFI_IP6_EQUAL (NewGateway + Index1, NewGateway + Index2)) {
     1370          return EFI_INVALID_PARAMETER;
     1371        }
     1372      }
     1373    }
     1374
     1375    if (NewGatewayCount != OldGatewayCount) {
     1376      Tmp = AllocatePool (DataSize);
     1377      if (Tmp == NULL) {
     1378        return EFI_OUT_OF_RESOURCES;
     1379      }
     1380    } else {
     1381      Tmp = NULL;
     1382    }
     1383
     1384    for (Index1 = 0; Index1 < NewGatewayCount; Index1++) {
     1385
     1386      DefaultRouter = Ip6FindDefaultRouter (IpSb, NewGateway + Index1);
     1387      if (DefaultRouter == NULL) {
     1388        Ip6CreateDefaultRouter (IpSb, NewGateway + Index1, IP6_INF_ROUTER_LIFETIME);
     1389        OneAdded = TRUE;
     1390      }
     1391    }
     1392
     1393    if (!OneRemoved && !OneAdded) {
     1394      Item->Status = EFI_SUCCESS;
     1395      return EFI_ABORTED;
     1396    } else {
     1397
     1398      if (Tmp != NULL) {
     1399        if (Item->Data.Ptr != NULL) {
     1400          FreePool (Item->Data.Ptr);
     1401        }
     1402        Item->Data.Ptr = Tmp;
     1403      }
     1404
     1405      CopyMem (Item->Data.Ptr, Data, DataSize);
     1406      Item->DataSize = DataSize;
     1407      Item->Status   = EFI_SUCCESS;
     1408      return EFI_SUCCESS;
    12281409    }
    12291410  } else {
    1230     Tmp = NULL;
    1231   }
    1232 
    1233   for (Index1 = 0; Index1 < OldGatewayCount; Index1++) {
    1234     //
    1235     // Find the gateways that are no long in the new setting and remove them.
    1236     //
    1237     for (Index2 = 0; Index2 < NewGatewayCount; Index2++) {
    1238       if (EFI_IP6_EQUAL (OldGateway + Index1, NewGateway + Index2)) {
    1239         OneRemoved = TRUE;
    1240         break;
    1241       }
    1242     }
    1243 
    1244     if (Index2 == NewGatewayCount) {
    1245       //
    1246       // Remove this default router.
    1247       //
    1248       DefaultRouter = Ip6FindDefaultRouter (IpSb, OldGateway + Index1);
    1249       if (DefaultRouter != NULL) {
    1250         Ip6DestroyDefaultRouter (IpSb, DefaultRouter);
    1251       }
    1252     }
    1253   }
    1254 
    1255   for (Index1 = 0; Index1 < NewGatewayCount; Index1++) {
    1256 
    1257     DefaultRouter = Ip6FindDefaultRouter (IpSb, NewGateway + Index1);
    1258     if (DefaultRouter == NULL) {
    1259       Ip6CreateDefaultRouter (IpSb, NewGateway + Index1, IP6_INF_ROUTER_LIFETIME);
    1260       OneAdded = TRUE;
    1261     }
    1262   }
    1263 
    1264   if (!OneRemoved && !OneAdded) {
    1265     Item->Status = EFI_SUCCESS;
    1266     return EFI_ABORTED;
    1267   } else {
    1268 
    1269     if (Tmp != NULL) {
    1270       if (Item->Data.Ptr != NULL) {
    1271         FreePool (Item->Data.Ptr);
    1272       }
    1273       Item->Data.Ptr = Tmp;
    1274     }
    1275 
    1276     CopyMem (Item->Data.Ptr, Data, DataSize);
    1277     Item->DataSize = DataSize;
    1278     Item->Status   = EFI_SUCCESS;
    1279     return EFI_SUCCESS;
    1280   }
     1411    //
     1412    // DataSize is 0 and Data is NULL, clean up the Gateway address.
     1413    //
     1414    if (Item->Data.Ptr != NULL) {
     1415      FreePool (Item->Data.Ptr);
     1416    }
     1417    Item->Data.Ptr = NULL;
     1418    Item->DataSize = 0;
     1419    Item->Status   = EFI_NOT_FOUND;
     1420  }
     1421
     1422  return EFI_SUCCESS;
    12811423}
    12821424
     
    13121454  UINTN                 OldIndex;
    13131455  UINTN                 NewIndex;
    1314   UINTN                 Index1;
    13151456  EFI_IPv6_ADDRESS      *OldDns;
    13161457  EFI_IPv6_ADDRESS      *NewDns;
     
    13211462  VOID                  *Tmp;
    13221463
    1323   if ((DataSize % sizeof (EFI_IPv6_ADDRESS) != 0) || (DataSize == 0)) {
     1464  OldDns = NULL;
     1465  NewDns = NULL;
     1466  Item   = NULL;
     1467  Tmp    = NULL;
     1468
     1469  if ((DataSize != 0) && (DataSize % sizeof (EFI_IPv6_ADDRESS) != 0)) {
    13241470    return EFI_BAD_BUFFER_SIZE;
    13251471  }
     
    13291475  }
    13301476
    1331   Item        = &Instance->DataItem[Ip6ConfigDataTypeDnsServer];
    1332   NewDns      = (EFI_IPv6_ADDRESS *) Data;
    1333   OldDns      = Item->Data.DnsServers;
    1334   NewDnsCount = DataSize / sizeof (EFI_IPv6_ADDRESS);
    1335   OldDnsCount = Item->DataSize / sizeof (EFI_IPv6_ADDRESS);
    1336   OneAdded    = FALSE;
    1337 
    1338   if (NewDnsCount != OldDnsCount) {
    1339     Tmp = AllocatePool (DataSize);
    1340     if (Tmp == NULL) {
    1341       return EFI_OUT_OF_RESOURCES;
    1342     }
    1343   } else {
    1344     Tmp = NULL;
    1345   }
    1346 
    1347   for (NewIndex = 0; NewIndex < NewDnsCount; NewIndex++) {
    1348 
    1349     if (!NetIp6IsValidUnicast (NewDns + NewIndex)) {
    1350       //
    1351       // The dns server address must be unicast.
    1352       //
    1353       FreePool (Tmp);
    1354       return EFI_INVALID_PARAMETER;
    1355     }
    1356 
    1357     for (Index1 = NewIndex + 1; Index1 < NewDnsCount; Index1++) {
    1358       if (EFI_IP6_EQUAL (NewDns + NewIndex, NewDns + Index1)) {
    1359         FreePool (Tmp);
     1477  Item = &Instance->DataItem[Ip6ConfigDataTypeDnsServer];
     1478
     1479  if (Data != NULL && DataSize != 0) {
     1480    NewDns      = (EFI_IPv6_ADDRESS *) Data;
     1481    OldDns      = Item->Data.DnsServers;
     1482    NewDnsCount = DataSize / sizeof (EFI_IPv6_ADDRESS);
     1483    OldDnsCount = Item->DataSize / sizeof (EFI_IPv6_ADDRESS);
     1484    OneAdded    = FALSE;
     1485
     1486    if (NewDnsCount != OldDnsCount) {
     1487      Tmp = AllocatePool (DataSize);
     1488      if (Tmp == NULL) {
     1489        return EFI_OUT_OF_RESOURCES;
     1490      }
     1491    } else {
     1492      Tmp = NULL;
     1493    }
     1494
     1495    for (NewIndex = 0; NewIndex < NewDnsCount; NewIndex++) {
     1496
     1497      if (!NetIp6IsValidUnicast (NewDns + NewIndex)) {
     1498        //
     1499        // The dns server address must be unicast.
     1500        //
     1501        if (Tmp != NULL) {
     1502          FreePool (Tmp);
     1503        }
    13601504        return EFI_INVALID_PARAMETER;
    13611505      }
    1362     }
    1363 
    1364     if (OneAdded) {
    1365       //
    1366       // If any address in the new setting is not in the old settings, skip the
    1367       // comparision below.
    1368       //
    1369       continue;
    1370     }
    1371 
    1372     for (OldIndex = 0; OldIndex < OldDnsCount; OldIndex++) {
    1373       if (EFI_IP6_EQUAL (NewDns + NewIndex, OldDns + OldIndex)) {
    1374         //
    1375         // If found break out.
    1376         //
    1377         break;
    1378       }
    1379     }
    1380 
    1381     if (OldIndex == OldDnsCount) {
    1382       OneAdded = TRUE;
    1383     }
    1384   }
    1385 
    1386   if (!OneAdded && (DataSize == Item->DataSize)) {
    1387     //
    1388     // No new item is added and the size is the same.
    1389     //
    1390     Item->Status = EFI_SUCCESS;
    1391     return EFI_ABORTED;
    1392   } else {
    1393     if (Tmp != NULL) {
    1394       if (Item->Data.Ptr != NULL) {
    1395         FreePool (Item->Data.Ptr);
    1396       }
    1397       Item->Data.Ptr = Tmp;
    1398     }
    1399 
    1400     CopyMem (Item->Data.Ptr, Data, DataSize);
    1401     Item->DataSize = DataSize;
    1402     Item->Status   = EFI_SUCCESS;
    1403     return EFI_SUCCESS;
    1404   }
     1506
     1507      if (OneAdded) {
     1508        //
     1509        // If any address in the new setting is not in the old settings, skip the
     1510        // comparision below.
     1511        //
     1512        continue;
     1513      }
     1514
     1515      for (OldIndex = 0; OldIndex < OldDnsCount; OldIndex++) {
     1516        if (EFI_IP6_EQUAL (NewDns + NewIndex, OldDns + OldIndex)) {
     1517          //
     1518          // If found break out.
     1519          //
     1520          break;
     1521        }
     1522      }
     1523
     1524      if (OldIndex == OldDnsCount) {
     1525        OneAdded = TRUE;
     1526      }
     1527    }
     1528
     1529    if (!OneAdded && (DataSize == Item->DataSize)) {
     1530      //
     1531      // No new item is added and the size is the same.
     1532      //
     1533      Item->Status = EFI_SUCCESS;
     1534      return EFI_ABORTED;
     1535    } else {
     1536      if (Tmp != NULL) {
     1537        if (Item->Data.Ptr != NULL) {
     1538          FreePool (Item->Data.Ptr);
     1539        }
     1540        Item->Data.Ptr = Tmp;
     1541      }
     1542
     1543      CopyMem (Item->Data.Ptr, Data, DataSize);
     1544      Item->DataSize = DataSize;
     1545      Item->Status   = EFI_SUCCESS;
     1546    }
     1547  } else  {
     1548    //
     1549    // DataSize is 0 and Data is NULL, clean up the DnsServer address.
     1550    //
     1551    if (Item->Data.Ptr != NULL) {
     1552      FreePool (Item->Data.Ptr);
     1553    }
     1554    Item->Data.Ptr = NULL;
     1555    Item->DataSize = 0;
     1556    Item->Status   = EFI_NOT_FOUND;
     1557  }
     1558
     1559  return EFI_SUCCESS;
    14051560}
    14061561
     
    14191574  )
    14201575{
    1421   IfInfo->Name[0] = L'e';
    1422   IfInfo->Name[1] = L't';
    1423   IfInfo->Name[2] = L'h';
    1424   IfInfo->Name[3] = (CHAR16) (L'0' + IpSb->Ip6ConfigInstance.IfIndex);
    1425   IfInfo->Name[4] = 0;
     1576  UnicodeSPrint (
     1577    IfInfo->Name,
     1578    sizeof (IfInfo->Name),
     1579    L"eth%d",
     1580    IpSb->Ip6ConfigInstance.IfIndex
     1581  );
    14261582
    14271583  IfInfo->IfType        = IpSb->SnpMode.IfType;
     
    14921648    OpCode = NTOHS (OpCode);
    14931649
    1494     if (OpCode == IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS) {
     1650    if (OpCode == DHCP6_OPT_DNS_SERVERS) {
    14951651      CopyMem (&Length, &OptList[Index]->OpLen, sizeof (Length));
    14961652      Length = NTOHS (Length);
     
    15951751      // Decline those duplicates.
    15961752      //
    1597       Instance->Dhcp6->Decline (
    1598                          Instance->Dhcp6,
    1599                          Instance->DeclineAddressCount,
    1600                          Instance->DeclineAddress
    1601                          );
     1753      if (Instance->Dhcp6 != NULL) {
     1754        Instance->Dhcp6->Decline (
     1755                           Instance->Dhcp6,
     1756                           Instance->DeclineAddressCount,
     1757                           Instance->DeclineAddress
     1758                           );
     1759      }
    16021760    }
    16031761
     
    18081966  @retval EFI_INVALID_PARAMETER One or more of the following are TRUE:
    18091967                                - This is NULL.
    1810                                 - Data is NULL.
    1811                                 - One or more fields in Data do not match the requirement of the
    1812                                   data type indicated by DataType.
     1968                                - One or more fields in Data and DataSizedo not match the
     1969                                  requirement of the data type indicated by DataType.
    18131970  @retval EFI_WRITE_PROTECTED   The specified configuration data is read-only or the specified
    18141971                                configuration data cannot be set under the current policy.
     
    18381995  IP6_SERVICE          *IpSb;
    18391996
    1840   if ((This == NULL) || (Data == NULL)) {
     1997  if ((This == NULL) || (Data == NULL && DataSize != 0) || (Data != NULL && DataSize == 0)) {
    18411998    return EFI_INVALID_PARAMETER;
    18421999  }
     
    21912348  DataItem->Data.Ptr = &Instance->Policy;
    21922349  DataItem->DataSize = sizeof (Instance->Policy);
    2193   Instance->Policy   = Ip6ConfigPolicyAutomatic;
     2350  Instance->Policy   = Ip6ConfigPolicyManual;
    21942351  SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_SIZE_FIXED);
    21952352
     
    22022359
    22032360  DataItem           = &Instance->DataItem[Ip6ConfigDataTypeManualAddress];
    2204   DataItem->SetData  = Ip6ConfigSetMaunualAddress;
     2361  DataItem->SetData  = Ip6ConfigSetManualAddress;
    22052362  DataItem->Status   = EFI_NOT_FOUND;
    22062363
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.h

    r58466 r77662  
    22  Definitions for EFI IPv6 Configuartion Protocol implementation.
    33
    4   Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    2222
    2323#define IP6_CONFIG_DEFAULT_DAD_XMITS        1
    24 #define IP6_CONFIG_DHCP6_OPTION_ORO         6
    25 #define IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS 23
    2624
    2725#define DATA_ATTRIB_SIZE_FIXED              0x1
     
    217215
    218216/**
     217  Read the configuration data from variable storage according to the VarName and
     218  gEfiIp6ConfigProtocolGuid. It checks the integrity of variable data. If the
     219  data is corrupted, it clears the variable data to ZERO. Othewise, it outputs the
     220  configuration data to IP6_CONFIG_INSTANCE.
     221
     222  @param[in]      VarName  The pointer to the variable name
     223  @param[in, out] Instance The pointer to the IP6 config instance data.
     224
     225  @retval EFI_NOT_FOUND         The variable can not be found or already corrupted.
     226  @retval EFI_OUT_OF_RESOURCES  Fail to allocate resource to complete the operation.
     227  @retval EFI_SUCCESS           The configuration data was retrieved successfully.
     228
     229**/
     230EFI_STATUS
     231Ip6ConfigReadConfigData (
     232  IN     CHAR16               *VarName,
     233  IN OUT IP6_CONFIG_INSTANCE  *Instance
     234  );
     235
     236/**
    219237  The event process routine when the DHCPv6 server is answered with a reply packet
    220238  for an information request.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Driver.c

    r58466 r77662  
    22  The driver binding and service binding protocol for IP6 driver.
    33
    4   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
     5  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
    56
    67  This program and the accompanying materials
     
    2526};
    2627
     28BOOLEAN  mIpSec2Installed = FALSE;
     29
     30/**
     31   Callback function for IpSec2 Protocol install.
     32
     33   @param[in] Event           Event whose notification function is being invoked
     34   @param[in] Context         Pointer to the notification function's context
     35
     36**/
     37VOID
     38EFIAPI
     39IpSec2InstalledCallback (
     40  IN EFI_EVENT  Event,
     41  IN VOID       *Context
     42  )
     43{
     44  EFI_STATUS    Status;
     45  //
     46  // Test if protocol was even found.
     47  // Notification function will be called at least once.
     48  //
     49  Status = gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **)&mIpSec);
     50  if (Status == EFI_SUCCESS && mIpSec != NULL) {
     51    //
     52    // Close the event so it does not get called again.
     53    //
     54    gBS->CloseEvent (Event);
     55
     56    mIpSec2Installed = TRUE;
     57  }
     58}
     59
    2760/**
    2861  This is the declaration of an EFI image entry point. This entry point is
     
    4780  )
    4881{
     82  VOID            *Registration;
     83
     84  EfiCreateProtocolNotifyEvent (
     85    &gEfiIpSec2ProtocolGuid,
     86    TPL_CALLBACK,
     87    IpSec2InstalledCallback,
     88    NULL,
     89    &Registration
     90    );
     91
    4992  return EfiLibInstallDriverBindingComponentName2 (
    5093           ImageHandle,
     
    112155  EFI_IPv6_ADDRESS          AllNodes;
    113156  IP6_NEIGHBOR_ENTRY        *NeighborCache;
     157
     158  IpSb->State     = IP6_SERVICE_DESTROY;
     159
     160  if (IpSb->Timer != NULL) {
     161    gBS->SetTimer (IpSb->Timer, TimerCancel, 0);
     162    gBS->CloseEvent (IpSb->Timer);
     163
     164    IpSb->Timer = NULL;
     165  }
     166
     167  if (IpSb->FasterTimer != NULL) {
     168    gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0);
     169    gBS->CloseEvent (IpSb->FasterTimer);
     170
     171    IpSb->FasterTimer = NULL;
     172  }
    114173
    115174  Ip6ConfigCleanInstance (&IpSb->Ip6ConfigInstance);
     
    178237  }
    179238
    180   if (IpSb->Timer != NULL) {
    181     gBS->SetTimer (IpSb->Timer, TimerCancel, 0);
    182     gBS->CloseEvent (IpSb->Timer);
    183 
    184     IpSb->Timer = NULL;
    185   }
    186 
    187   if (IpSb->FasterTimer != NULL) {
    188     gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0);
    189     gBS->CloseEvent (IpSb->FasterTimer);
    190 
    191     IpSb->FasterTimer = NULL;
    192   }
    193239  //
    194240  // Free the Neighbor Discovery resources
     
    226272  EFI_MANAGED_NETWORK_COMPLETION_TOKEN  *MnpToken;
    227273  EFI_MANAGED_NETWORK_CONFIG_DATA       *Config;
    228   IP6_CONFIG_DATA_ITEM                  *DataItem;
    229274
    230275  ASSERT (Service != NULL);
     
    440485  }
    441486
    442   //
    443   // If there is any manual address, set it.
    444   //
    445   DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];
    446   if (DataItem->Data.Ptr != NULL) {
    447     DataItem->SetData (
    448                 &IpSb->Ip6ConfigInstance,
    449                 DataItem->DataSize,
    450                 DataItem->Data.Ptr
    451                 );
    452   }
    453 
    454   //
    455   // If there is any gateway address, set it.
    456   //
    457   DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];
    458   if (DataItem->Data.Ptr != NULL) {
    459     DataItem->SetData (
    460                 &IpSb->Ip6ConfigInstance,
    461                 DataItem->DataSize,
    462                 DataItem->Data.Ptr
    463                 );
    464   }
    465 
    466487  InsertHeadList (&IpSb->Interfaces, &IpSb->DefaultInterface->Link);
    467488
     
    499520  IP6_SERVICE               *IpSb;
    500521  EFI_STATUS                Status;
     522  EFI_IP6_CONFIG_PROTOCOL   *Ip6Cfg;
     523  IP6_CONFIG_DATA_ITEM      *DataItem;
     524
     525  IpSb     = NULL;
     526  Ip6Cfg   = NULL;
     527  DataItem = NULL;
    501528
    502529  //
     
    524551  ASSERT (IpSb != NULL);
    525552
     553  Ip6Cfg  = &IpSb->Ip6ConfigInstance.Ip6Config;
     554
    526555  //
    527556  // Install the Ip6ServiceBinding Protocol onto ControlerHandle
     
    532561                  &IpSb->ServiceBinding,
    533562                  &gEfiIp6ConfigProtocolGuid,
    534                   &IpSb->Ip6ConfigInstance.Ip6Config,
     563                  Ip6Cfg,
    535564                  NULL
    536565                  );
    537 
    538   if (!EFI_ERROR (Status)) {
    539     //
    540     // ready to go: start the receiving and timer
    541     //
    542     Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
    543     if (EFI_ERROR (Status)) {
     566  if (EFI_ERROR (Status)) {
     567    goto ON_ERROR;
     568  }
     569
     570  //
     571  // Read the config data from NV variable again.
     572  // The default data can be changed by other drivers.
     573  //
     574  Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);
     575  if (EFI_ERROR (Status)) {
     576    goto ON_ERROR;
     577  }
     578
     579  //
     580  // If there is any default manual address, set it.
     581  //
     582  DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];
     583  if (DataItem->Data.Ptr != NULL) {
     584    Status = Ip6Cfg->SetData (
     585                       Ip6Cfg,
     586                       Ip6ConfigDataTypeManualAddress,
     587                       DataItem->DataSize,
     588                       DataItem->Data.Ptr
     589                       );
     590    if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
    544591      goto ON_ERROR;
    545592    }
    546 
    547     //
    548     // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.
    549     //
    550     Status = gBS->SetTimer (
    551                     IpSb->FasterTimer,
    552                     TimerPeriodic,
    553                     TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
    554                     );
    555     if (EFI_ERROR (Status)) {
     593  }
     594
     595  //
     596  // If there is any default gateway address, set it.
     597  //
     598  DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];
     599  if (DataItem->Data.Ptr != NULL) {
     600    Status = Ip6Cfg->SetData (
     601                       Ip6Cfg,
     602                       Ip6ConfigDataTypeGateway,
     603                       DataItem->DataSize,
     604                       DataItem->Data.Ptr
     605                       );
     606    if (EFI_ERROR(Status)) {
    556607      goto ON_ERROR;
    557608    }
    558 
    559     //
    560     // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.
    561     //
    562     Status = gBS->SetTimer (
    563                     IpSb->Timer,
    564                     TimerPeriodic,
    565                     TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
    566                     );
    567     if (EFI_ERROR (Status)) {
    568       goto ON_ERROR;
    569     }
    570 
    571     //
    572     // Initialize the IP6 ID
    573     //
    574     mIp6Id = NET_RANDOM (NetRandomInitSeed ());
    575 
    576     return EFI_SUCCESS;
    577   }
     609  }
     610
     611  //
     612  // ready to go: start the receiving and timer
     613  //
     614  Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
     615  if (EFI_ERROR (Status)) {
     616    goto ON_ERROR;
     617  }
     618
     619  //
     620  // The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.
     621  //
     622  Status = gBS->SetTimer (
     623                  IpSb->FasterTimer,
     624                  TimerPeriodic,
     625                  TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
     626                  );
     627  if (EFI_ERROR (Status)) {
     628    goto ON_ERROR;
     629  }
     630
     631  //
     632  // The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.
     633  //
     634  Status = gBS->SetTimer (
     635                  IpSb->Timer,
     636                  TimerPeriodic,
     637                  TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
     638                  );
     639  if (EFI_ERROR (Status)) {
     640    goto ON_ERROR;
     641  }
     642
     643  //
     644  // Initialize the IP6 ID
     645  //
     646  mIp6Id = NET_RANDOM (NetRandomInitSeed ());
     647
     648  return EFI_SUCCESS;
    578649
    579650ON_ERROR:
     
    698769  } else if (IsListEmpty (&IpSb->Children)) {
    699770    State           = IpSb->State;
    700     IpSb->State     = IP6_SERVICE_DESTROY;
    701 
    702771    Status = Ip6CleanService (IpSb);
    703772    if (EFI_ERROR (Status)) {
     
    734803
    735804  @retval EFI_SUCCES             The child handle was created with the I/O services.
    736   @retval EFI_OUT_OF_RESOURCES   There are not enough resources availabe to create
     805  @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to create
    737806                                 the child.
    738807  @retval other                  The child handle was not created.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Driver.h

    r58459 r77662  
    22  The driver binding and service binding protocol for IP6 driver.
    33
    4   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    142142
    143143//
    144 // Function ptototypes for the ServiceBinding Prococol
     144// Function prototypes for the ServiceBinding Protocol
    145145//
    146146
     
    155155
    156156  @retval EFI_SUCCES             The child handle was created with the I/O services.
    157   @retval EFI_OUT_OF_RESOURCES   There are not enough resources availabe to create
     157  @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to create
    158158                                 the child.
    159159  @retval other                  The child handle was not created.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Dxe.inf

    r58466 r77662  
    88#  the EFI IPv6 network stack.
    99#
    10 #  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
     10#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    1111#
    1212#  This program and the accompanying materials
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Dxe.uni

    r58464 r77662  
    1 // /** @file
     1// /** @file
    22// Basic IPv6 packet I/O Service.
    33//
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6DxeExtra.uni

    r58464 r77662  
    1 // /** @file
     1// /** @file
    22// Ip6Dxe Localized Strings and Content
    33//
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6DxeStrings.uni

    r58466 r77662  
    1 /** @file
     1/** @file
    22  String definitions for IP6 configuration.
    33
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Icmp.c

    r48674 r77662  
    22  The ICMPv6 handle routines to process the ICMPv6 control messages.
    33
    4   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
     5  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
    56
    67  This program and the accompanying materials
     
    473474  UINT8                     Value;
    474475
    475   ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_NUM));
     476  ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_MAX));
    476477
    477478  if (PrefixLength == 0) {
     
    480481  }
    481482
    482   if (PrefixLength == IP6_PREFIX_NUM - 1) {
     483  if (PrefixLength >= IP6_PREFIX_MAX) {
    483484    return ;
    484485  }
     
    488489  Value = Prefix->Addr[Byte];
    489490
    490   if ((Byte > 0) && (Byte < 16)) {
     491  if (Byte > 0) {
    491492    ZeroMem (Prefix->Addr + Byte, 16 - Byte);
    492493  }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Impl.c

    r58459 r77662  
    22  Implementation of EFI_IP6_PROTOCOL protocol interfaces.
    33
    4   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
     4  (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
     5  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    56
    67  This program and the accompanying materials
     
    842843  IP6_SERVICE               *IpSb;
    843844
    844   if ((This == NULL) || (PrefixLength >= IP6_PREFIX_NUM)) {
     845  if ((This == NULL) || (PrefixLength > IP6_PREFIX_MAX)) {
    845846    return EFI_INVALID_PARAMETER;
    846847  }
     
    17621763{
    17631764  IP6_PROTOCOL              *IpInstance;
    1764   IP6_SERVICE               *IpSb;
    17651765  EFI_STATUS                Status;
    17661766  EFI_TPL                   OldTpl;
     
    17711771
    17721772  IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This);
    1773   IpSb       = IpInstance->Service;
    17741773
    17751774  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Impl.h

    r58459 r77662  
    22  Implementation of EFI_IP6_PROTOCOL protocol interfaces and type definitions.
    33
    4   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
     5  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
    56
    67  This program and the accompanying materials
     
    1819
    1920#include <Uefi.h>
     21
     22#include <IndustryStandard/Dhcp.h>
    2023
    2124#include <Protocol/ServiceBinding.h>
     
    9093
    9194extern EFI_IPSEC2_PROTOCOL *mIpSec;
     95extern BOOLEAN             mIpSec2Installed;
    9296
    9397//
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Input.c

    r58466 r77662  
    22  IP6 internal functions to process the incoming packets.
    33
    4   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
     5  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
    56
    67  This program and the accompanying materials
     
    526527
    527528  Status        = EFI_SUCCESS;
     529
     530  if (!mIpSec2Installed) {
     531    goto ON_EXIT;
     532  }
     533  ASSERT (mIpSec != NULL);
     534
    528535  Packet        = *Netbuf;
    529536  RecycleEvent  = NULL;
     
    535542  FragmentCount = Packet->BlockOpNum;
    536543  ZeroMem (&ZeroHead, sizeof (EFI_IP6_HEADER));
    537 
    538   if (mIpSec == NULL) {
    539     gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **) &mIpSec);
    540 
    541     //
    542     // Check whether the ipsec protocol is available.
    543     //
    544     if (mIpSec == NULL) {
    545       goto ON_EXIT;
    546     }
    547   }
    548544
    549545  //
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Nd.c

    r58466 r77662  
    22  Implementation of Neighbor Discovery support routines.
    33
    4   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    199199  IP6_PREFIX_LIST_ENTRY     *TmpPrefixEntry;
    200200
    201   if (Prefix == NULL || PreferredLifetime > ValidLifetime || PrefixLength >= IP6_PREFIX_NUM) {
     201  if (Prefix == NULL || PreferredLifetime > ValidLifetime || PrefixLength > IP6_PREFIX_MAX) {
    202202    return NULL;
    203203  }
     
    854854        //
    855855        Oro         = (EFI_DHCP6_PACKET_OPTION *) OptBuf;
    856         Oro->OpCode = HTONS (IP6_CONFIG_DHCP6_OPTION_ORO);
     856        Oro->OpCode = HTONS (DHCP6_OPT_ORO);
    857857        Oro->OpLen  = HTONS (2);
    858         *((UINT16 *) &Oro->Data[0]) = HTONS (IP6_CONFIG_DHCP6_OPTION_DNS_SERVERS);
     858        *((UINT16 *) &Oro->Data[0]) = HTONS (DHCP6_OPT_DNS_SERVERS);
    859859
    860860        InfoReqReXmit.Irt = 4;
     
    982982  NET_CHECK_SIGNATURE (IpIf, IP6_INTERFACE_SIGNATURE);
    983983  ASSERT (AddressInfo != NULL);
     984
     985  //
     986  // Do nothing if we have already started DAD on the address.
     987  //
     988  if (Ip6FindDADEntry (IpIf->Service, &AddressInfo->Address, NULL) != NULL) {
     989    return EFI_SUCCESS;
     990  }
    984991
    985992  Status   = EFI_SUCCESS;
     
    15781585    DupAddrDetect = Ip6FindDADEntry (IpSb, &Target, &IpIf);
    15791586    if (DupAddrDetect != NULL) {
    1580       if (DupAddrDetect->Transmit == 0) {
    1581         //
    1582         // The NS is from another node to performing DAD on the same address since
    1583         // we haven't send out any NS yet. Fail DAD for the tentative address.
    1584         //
    1585         Ip6OnDADFinished (FALSE, IpIf, DupAddrDetect);
    1586         Status = EFI_ICMP_ERROR;
    1587         goto Exit;
    1588       }
    1589 
    15901587      //
    15911588      // Check the MAC address of the incoming packet.
     
    28642861          Flag = FALSE;
    28652862          if ((DupAddrDetect->Receive == 0) ||
    2866               (DupAddrDetect->Transmit == DupAddrDetect->Receive)) {
     2863              (DupAddrDetect->Transmit <= DupAddrDetect->Receive)) {
    28672864            Flag = TRUE;
    28682865          }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Option.c

    r48674 r77662  
    1919  Validate the IP6 option format for both the packets we received
    2020  and that we will transmit. It will compute the ICMPv6 error message fields
    21   if the option is malformated.
     21  if the option is malformatted.
    2222
    2323  @param[in]  IpSb              The IP6 service data.
     
    3030
    3131  @retval TRUE     The option is properly formatted.
    32   @retval FALSE    The option is malformated.
     32  @retval FALSE    The option is malformatted.
    3333
    3434**/
     
    127127
    128128  @retval TRUE     The option is properly formatted.
    129   @retval FALSE    The option is malformated.
     129  @retval FALSE    The option is malformatted.
    130130
    131131**/
     
    232232  Validate the IP6 extension header format for both the packets we received
    233233  and that we will transmit. It will compute the ICMPv6 error message fields
    234   if the option is mal-formated.
     234  if the option is mal-formatted.
    235235
    236236  @param[in]  IpSb          The IP6 service instance. This is an optional parameter.
     
    253253                            This is an optional parameter that may be NULL.
    254254
    255   @retval     TRUE          The option is properly formated.
    256   @retval     FALSE         The option is malformated.
     255  @retval     TRUE          The option is properly formatted.
     256  @retval     FALSE         The option is malformatted.
    257257
    258258**/
     
    437437      //
    438438      // RFC2460, ICMP Parameter Problem message with code 0 should be sent
    439       // if the length of a fragment is not a multiple of 8 octects and the M
     439      // if the length of a fragment is not a multiple of 8 octets and the M
    440440      // flag of that fragment is 1, pointing to the Payload length field of the
    441441      // fragment packet.
     
    607607  @param[in]  FragmentOffset   The fragment offset of the data following the header.
    608608  @param[out] UpdatedExtHdrs   The updated ExtHdrs with Fragment header inserted.
    609                                It's caller's responsiblity to free this buffer.
     609                               It's caller's responsibility to free this buffer.
    610610
    611611  @retval EFI_OUT_OF_RESOURCES Failed to finish the operation due to lake of
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Option.h

    r48674 r77662  
    5252  Validate the IP6 extension header format for both the packets we received
    5353  and that we will transmit. It will compute the ICMPv6 error message fields
    54   if the option is mal-formated.
     54  if the option is mal-formatted.
    5555
    5656  @param[in]  IpSb          The IP6 service instance. This is an optional parameter.
     
    7373                            This is an optional parameter that may be NULL.
    7474
    75   @retval     TRUE          The option is properly formated.
    76   @retval     FALSE         The option is malformated.
     75  @retval     TRUE          The option is properly formatted.
     76  @retval     FALSE         The option is malformatted.
    7777
    7878**/
     
    123123  @param[in]  FragmentOffset   The fragment offset of the data following the header.
    124124  @param[out] UpdatedExtHdrs   The updated ExtHdrs with Fragment header inserted.
    125                                It's caller's responsiblity to free this buffer.
     125                               It's caller's responsibility to free this buffer.
    126126
    127127  @retval EFI_OUT_OF_RESOURCES Failed to finish the operation due to lake of
     
    180180
    181181  @retval TRUE     The option is properly formatted.
    182   @retval FALSE    The option is malformated.
     182  @retval FALSE    The option is malformatted.
    183183
    184184**/
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Output.c

    r58459 r77662  
    22  The internal functions and routines to transmit the IP6 packet.
    33
    4   Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    2424  @param[in]       IpSb             Points to an IP6 service binding instance.
    2525  @param[out]      SourceList       The list entry head of all source addresses.
    26                                     It is the caller's responsiblity to free the
     26                                    It is the caller's responsibility to free the
    2727                                    resources.
    2828  @param[out]      SourceCount      The number of source addresses.
     
    9292
    9393/**
    94   Caculate how many bits are the same between two IPv6 addresses.
     94  Calculate how many bits are the same between two IPv6 addresses.
    9595
    9696  @param[in]       AddressA         Points to an IPv6 address.
     
    365365  @param[in]  HeadLen          The length of the unfragmented part of the IP6 header.
    366366
    367   @retval EFI_BAD_BUFFER_SIZE  There is no enought room in the head space of
     367  @retval EFI_BAD_BUFFER_SIZE  There is no enough room in the head space of
    368368                               Packet.
    369369  @retval EFI_SUCCESS          The operation performed successfully.
     
    727727
    728728      //
    729       // Send out multicast neighbor solicitation for address resolution immediatly.
     729      // Send out multicast neighbor solicitation for address resolution immediately.
    730730      //
    731731      Ip6CreateSNMulticastAddr (&NeighborCache->Neighbor, &Destination);
     
    810810  // OK, selected the source and route, fragment the packet then send
    811811  // them. Tag each fragment other than the first one as spawn from it.
    812   // Each extension header is an integar multiple of 8 octets long, in
     812  // Each extension header is an integer multiple of 8 octets long, in
    813813  // order to retain 8-octet alignment for subsequent headers.
    814814  //
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Ip6Dxe/Ip6Route.c

    r48674 r77662  
    22  The functions and routines to handle the route caches and route table.
    33
    4   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
     4  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
    55
    66  This program and the accompanying materials
     
    136136  RtEntry = NULL;
    137137
    138   for (Index = IP6_PREFIX_NUM - 1; Index >= 0; Index--) {
     138  for (Index = IP6_PREFIX_MAX; Index >= 0; Index--) {
    139139    NET_LIST_FOR_EACH (Entry, &RtTable->RouteArea[Index]) {
    140140      RtEntry = NET_LIST_USER_STRUCT (Entry, IP6_ROUTE_ENTRY, Link);
     
    301301  Count = 0;
    302302
    303   for (Index = IP6_PREFIX_NUM - 1; Index >= 0; Index--) {
     303  for (Index = IP6_PREFIX_MAX; Index >= 0; Index--) {
    304304
    305305    NET_LIST_FOR_EACH (Entry, &(RouteTable->RouteArea[Index])) {
     
    347347  RtTable->TotalNum = 0;
    348348
    349   for (Index = 0; Index < IP6_PREFIX_NUM; Index++) {
     349  for (Index = 0; Index <= IP6_PREFIX_MAX; Index++) {
    350350    InitializeListHead (&RtTable->RouteArea[Index]);
    351351  }
     
    386386  // Free all the route table entry and its route cache.
    387387  //
    388   for (Index = 0; Index < IP6_PREFIX_NUM; Index++) {
     388  for (Index = 0; Index <= IP6_PREFIX_MAX; Index++) {
    389389    NET_LIST_FOR_EACH_SAFE (Entry, Next, &RtTable->RouteArea[Index]) {
    390390      RtEntry = NET_LIST_USER_STRUCT (Entry, IP6_ROUTE_ENTRY, Link);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette