From 3cf888f5f90526fa0d613c2a1486e0c1f416bd67 Mon Sep 17 00:00:00 2001 From: tye Date: Tue, 27 Oct 2009 02:45:43 +0000 Subject: Fix the EBC build problem in DxeIpIoLib of r9374. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9375 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 110 +++++++++++++++++++-------- 1 file changed, 80 insertions(+), 30 deletions(-) (limited to 'MdeModulePkg/Library/DxeIpIoLib') diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index e18537fd5f..5aaef6d743 100644 --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c @@ -61,29 +61,29 @@ EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData = { }; ICMP_ERROR_INFO mIcmpErrMap[10] = { - { EFI_NETWORK_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_UNREACH_NET - { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_UNREACH_HOST - { EFI_PROTOCOL_UNREACHABLE, TRUE, TRUE }, // ICMP_ERR_UNREACH_PROTOCOL - { EFI_PORT_UNREACHABLE, TRUE, TRUE }, // ICMP_ERR_UNREACH_PORT - { EFI_ICMP_ERROR, TRUE, TRUE }, // ICMP_ERR_MSGSIZE - { EFI_ICMP_ERROR, FALSE, TRUE }, // ICMP_ERR_UNREACH_SRCFAIL - { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_TIMXCEED_INTRANS - { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_TIMEXCEED_REASS - { EFI_ICMP_ERROR, FALSE, FALSE }, // ICMP_ERR_QUENCH - { EFI_ICMP_ERROR, FALSE, TRUE } // ICMP_ERR_PARAMPROB + {FALSE, TRUE }, // ICMP_ERR_UNREACH_NET + {FALSE, TRUE }, // ICMP_ERR_UNREACH_HOST + {TRUE, TRUE }, // ICMP_ERR_UNREACH_PROTOCOL + {TRUE, TRUE }, // ICMP_ERR_UNREACH_PORT + {TRUE, TRUE }, // ICMP_ERR_MSGSIZE + {FALSE, TRUE }, // ICMP_ERR_UNREACH_SRCFAIL + {FALSE, TRUE }, // ICMP_ERR_TIMXCEED_INTRANS + {FALSE, TRUE }, // ICMP_ERR_TIMEXCEED_REASS + {FALSE, FALSE}, // ICMP_ERR_QUENCH + {FALSE, TRUE } // ICMP_ERR_PARAMPROB }; ICMP_ERROR_INFO mIcmp6ErrMap[10] = { - { EFI_NETWORK_UNREACHABLE, FALSE, TRUE }, // ICMP6_ERR_UNREACH_NET - { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP6_ERR_UNREACH_HOST - { EFI_PROTOCOL_UNREACHABLE, TRUE, TRUE }, // ICMP6_ERR_UNREACH_PROTOCOL - { EFI_PORT_UNREACHABLE, TRUE, TRUE }, // ICMP6_ERR_UNREACH_PORT - { EFI_ICMP_ERROR, TRUE, TRUE }, // ICMP6_ERR_PACKAGE_TOOBIG - { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP6_ERR_TIMXCEED_HOPLIMIT - { EFI_HOST_UNREACHABLE, FALSE, TRUE }, // ICMP_ERR_TIMEXCEED_REASS - { EFI_ICMP_ERROR, FALSE, TRUE }, // ICMP_ERR_PARAMPROB_HEADER - { EFI_ICMP_ERROR, FALSE, TRUE }, // ICMP_ERR_PARAMPROB_NEXHEADER - { EFI_ICMP_ERROR, FALSE, TRUE } // ICMP_ERR_PARAMPROB_IPV6OPTION + {FALSE, TRUE}, // ICMP6_ERR_UNREACH_NET + {FALSE, TRUE}, // ICMP6_ERR_UNREACH_HOST + {TRUE, TRUE}, // ICMP6_ERR_UNREACH_PROTOCOL + {TRUE, TRUE}, // ICMP6_ERR_UNREACH_PORT + {TRUE, TRUE}, // ICMP6_ERR_PACKAGE_TOOBIG + {FALSE, TRUE}, // ICMP6_ERR_TIMXCEED_HOPLIMIT + {FALSE, TRUE}, // ICMP6_ERR_TIMXCEED_REASS + {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_HEADER + {FALSE, TRUE}, // ICMP6_ERR_PARAMPROB_NEXHEADER + {FALSE, TRUE} // ICMP6_ERR_PARAMPROB_IPV6OPTION }; @@ -2027,18 +2027,43 @@ IpIoGetIcmpErrStatus ( OUT BOOLEAN *Notify OPTIONAL ) { - if (IpVersion == IP_VERSION_4 ){ - ASSERT ((IcmpError >= ICMP_ERR_UNREACH_NET) && (IcmpError <= ICMP_ERR_PARAMPROB)); + if (IpVersion == IP_VERSION_4 ) { + ASSERT ((IcmpError >= ICMP_ERR_UNREACH_NET) && (IcmpError <= ICMP_ERR_PARAMPROB)); - if (IsHard != NULL) { - *IsHard = mIcmpErrMap[IcmpError].IsHard; - } + if (IsHard != NULL) { + *IsHard = mIcmpErrMap[IcmpError].IsHard; + } - if (Notify != NULL) { - *Notify = mIcmpErrMap[IcmpError].Notify; - } + if (Notify != NULL) { + *Notify = mIcmpErrMap[IcmpError].Notify; + } + + switch (IcmpError) { + case ICMP_ERR_UNREACH_NET: + return EFI_NETWORK_UNREACHABLE; + + case ICMP_ERR_TIMXCEED_INTRANS: + case ICMP_ERR_TIMXCEED_REASS: + case ICMP_ERR_UNREACH_HOST: + return EFI_HOST_UNREACHABLE; + + case ICMP_ERR_UNREACH_PROTOCOL: + return EFI_PROTOCOL_UNREACHABLE; + + case ICMP_ERR_UNREACH_PORT: + return EFI_PORT_UNREACHABLE; + + case ICMP_ERR_MSGSIZE: + case ICMP_ERR_UNREACH_SRCFAIL: + case ICMP_ERR_QUENCH: + case ICMP_ERR_PARAMPROB: + return EFI_ICMP_ERROR; + + default: + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } - return mIcmpErrMap[IcmpError].Error; } else if (IpVersion == IP_VERSION_6) { ASSERT ((IcmpError >= ICMP6_ERR_UNREACH_NET) && (IcmpError <= ICMP6_ERR_PARAMPROB_IPV6OPTION)); @@ -2050,7 +2075,32 @@ IpIoGetIcmpErrStatus ( if (Notify != NULL) { *Notify = mIcmp6ErrMap[IcmpError].Notify; } - return mIcmp6ErrMap[IcmpError].Error; + + switch (IcmpError) { + case ICMP6_ERR_UNREACH_NET: + return EFI_NETWORK_UNREACHABLE; + + case ICMP6_ERR_UNREACH_HOST: + case ICMP6_ERR_TIMXCEED_HOPLIMIT: + case ICMP6_ERR_TIMXCEED_REASS: + return EFI_HOST_UNREACHABLE; + + case ICMP6_ERR_UNREACH_PROTOCOL: + return EFI_PROTOCOL_UNREACHABLE; + + case ICMP6_ERR_UNREACH_PORT: + return EFI_PORT_UNREACHABLE; + + case ICMP6_ERR_PACKAGE_TOOBIG: + case ICMP6_ERR_PARAMPROB_HEADER: + case ICMP6_ERR_PARAMPROB_NEXHEADER: + case ICMP6_ERR_PARAMPROB_IPV6OPTION: + return EFI_ICMP_ERROR; + + default: + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } } else { // -- cgit v1.2.3