- DPathNode->Ipv6.IpAddressOrigin = 0;\r
- DPathNode->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;\r
- ZeroMem (&DPathNode->Ipv6.GatewayIpAddress, sizeof (EFI_IPv6_ADDRESS));\r
+\r
+ //\r
+ // Add a judgement here to support previous versions of IPv6_DEVICE_PATH.\r
+ // In previous versions of IPv6_DEVICE_PATH, IpAddressOrigin, PrefixLength\r
+ // and GatewayIpAddress do not exist.\r
+ // In new version of IPv6_DEVICE_PATH, structure length is 60, while in \r
+ // old versions, the length is 43.\r
+ //\r
+\r
+ PathLen = DevicePathNodeLength (&DPathNode->Ipv6);\r
+ \r
+ if (PathLen == IP6_NODE_LEN_NEW_VERSIONS ) { \r
+\r
+ DPathNode->Ipv6.IpAddressOrigin = 0;\r
+ DPathNode->Ipv6.PrefixLength = IP6_PREFIX_LENGTH;\r
+ ZeroMem (&DPathNode->Ipv6.GatewayIpAddress, sizeof (EFI_IPv6_ADDRESS));\r
+ }\r
+ else if (PathLen == IP6_NODE_LEN_OLD_VERSIONS) { \r
+\r
+ //\r
+ // StaticIPAddress is a field in old versions of IPv6_DEVICE_PATH, while ignored in new \r
+ // version. Set StaticIPAddress through its' offset in old IPv6_DEVICE_PATH.\r
+ //\r
+ *((UINT8 *)(&DPathNode->Ipv6) + IP6_OLD_IPADDRESS_OFFSET) = \r
+ (BOOLEAN) (!Session->ConfigData->SessionConfigData.InitiatorInfoFromDhcp);\r
+ }\r
+ \r