IcmpSendEcho2 fails with fails with WSA_QOS_ADMISSION_FAILURE and ERROR_NOACCESS

后端 未结 1 1392
北恋
北恋 2021-01-19 10:57

I have an application that pings a bunch of servers. It runs great for days, but suddenly will have many failures of one of two types:

WSA_QOS_ADMISSION_FAILURE (11

1条回答
  •  梦毁少年i
    2021-01-19 11:27

    It turns out that the error code 11010 is actually not WSA_QOS_ADMISSION_FAILURE from WinSock (which is not involved here), but a completely different value from the IP stack's ICMP_ECHO_REPLY structure with much more meaningful meaning:

    IP_REQ_TIMED_OUT   (11010)   The request timed out

    You are supposed to call GetIpErrorString() first and only "if the function fails, use FormatMessage to obtain the message string for the returned error".


    Unfortunately, that does not help with that other value, 998.

    One clue might be the page "Mapping NT Status Error Codes to Win32 Error Codes", which says that the NT status conditions which map (or mapped when it was last updated, in 2005) to the Win32 code 998 (ERROR_NOACCESS) are more broad:

    STATUS_DATATYPE_MISALIGNMENT            ERROR_NOACCESS
    STATUS_ACCESS_VIOLATION                 ERROR_NOACCESS
    STATUS_DATATYPE_MISALIGNMENT_ERROR      ERROR_NOACCESS
    

    It seems likely that whenever something fails during the IOCTL call (which sends the ICMP echo request to the kernel to be really handled), the underlying exception is swallowed if possible and only this generic Win32 code is sent back.

    Therefore it might be that you are really passing some not entirely correct data to the function (like unaligned buffer on the stack, that might explain why it happens sporadically), or even hint at some bug inside the ICMP stack. I'm afraid that only some hardcore kernel debugging could reveal the real cause.

    0 讨论(0)
提交回复
热议问题