\r
IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);\r
\r
+ //\r
+ // Check whether the StationAddress/SubnetMask pair is valid.\r
+ //\r
+ if (!Ip4StationAddressValid (StationAddress, SubnetMask)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
{\r
UINTN OldIndex;\r
UINTN NewIndex;\r
- UINTN Index1;\r
EFI_IPv4_ADDRESS *OldDns;\r
EFI_IPv4_ADDRESS *NewDns;\r
UINTN OldDnsCount;\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- for (Index1 = NewIndex + 1; Index1 < NewDnsCount; Index1++) {\r
- if (EFI_IP4_EQUAL (NewDns + NewIndex, NewDns + Index1)) {\r
- if (Tmp != NULL) {\r
- FreePool (Tmp);\r
- }\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- }\r
-\r
if (OneAdded) {\r
//\r
// If any address in the new setting is not in the old settings, skip the\r
StationAddress = EFI_NTOHL (NewAddress.Address);\r
SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);\r
\r
- if (NetGetMaskLength (SubnetMask) == IP4_MASK_NUM) {\r
+ //\r
+ // Check whether the StationAddress/SubnetMask pair is valid.\r
+ //\r
+ if (!Ip4StationAddressValid (StationAddress, SubnetMask)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
OUT EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo\r
)\r
{\r
- IfInfo->Name[0] = L'e';\r
- IfInfo->Name[1] = L't';\r
- IfInfo->Name[2] = L'h';\r
- IfInfo->Name[3] = (CHAR16) (L'0' + IpSb->Ip4Config2Instance.IfIndex);\r
- IfInfo->Name[4] = 0;\r
+ UnicodeSPrint (\r
+ IfInfo->Name,\r
+ EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE,\r
+ L"eth%d",\r
+ IpSb->Ip4Config2Instance.IfIndex\r
+ );\r
\r
IfInfo->IfType = IpSb->SnpMode.IfType;\r
IfInfo->HwAddressSize = IpSb->SnpMode.HwAddressSize;\r