开发者

How to tell *which* member in MIB_IPFORWARDROW structure is invalid?

开发者 https://www.devze.com 2023-01-20 05:30 出处:网络
A call CreateIpForwardEntry returns ERROR_INVALID_PARAMETER. The PSDK documentation describes this error as:

A call CreateIpForwardEntry returns ERROR_INVALID_PARAMETER. The PSDK documentation describes this error as:

The pRoute parameter is NULL, SetIpForwardEntry is unable to read from the memory pointed to by pRoute, or one of the members of the MIB_IPFORWARDROW structure is invalid.

I know for certain that pRoute is not NULL and that no call to SetIpForwardEntry is involved, which leaves the only cause for the error as "one of the members of the MIB_IPFORWARDROW structure is invalid."

How do I know which of the members of MIB_IPFORWARDROW is invalid?

To further clarify my question: I know exactly what value each of these members has (I log them). At this point howev开发者_如何学JAVAer, I can't tell which one is incorrect. They all look valid to me. It would be nice to know why one of the members is invalid. But for that I first need to know which of them is invalid.

For example, in one of the test cases (which produce the aforementioned error) I have:

dwForwardDest = 199.239.136.200
dwForwardMask = 255.255.255.255
dwForwardPolicy = 0
dwForwardNextHop = 127.0.0.1
dwForwardIfIndex = 1
dwForwardType = 0
dwForwardProto = 0X2
dwForwardAge = 0
dwForwardNextHopAS = 0
dwForwardMetric1 =  1
dwForwardMetric2 =  -1
dwForwardMetric3 = -1
dwForwardMetric4 = -1
dwForwardMetric5 = 0

Any idea why CreateIpForwardEntry() wouldn't agree to accept the above parameters?

Update: The tips provided below were very helpful but didn't really provide a method how to tell which member in MIB_IPFORWARDROW structure is invalid. I did correct the two members mentioned, but the problem persists:

Dest = 199.239.136.200
Mask = 255.255.255.255
Policy = 0
NextHop = 127.0.0.1
IfIndex = 1
Type = 0X3
Proto = 0X3
Age = 0
NextHopAS = 0
Metric1 = 1
Metric2 = -1
Metric3 = -1
Metric4 = -1
Metric5 = -1

Any idea why CreateIpForwardEntry() wouldn't agree to accept the above parameters?

Tips, ideas, insights would be greatly appreciated.

Thanks.


I don't know anything about IP routing, but the documentation for MIB_IPFORWARDROW doesn't list 0 as a valid value for dwForwardType. Also, the documentation for CreateIpForwardEntry indicates that dwForwardProto must be 3 (MIB_IPPROTO_NETMGMT).

0

精彩评论

暂无评论...
验证码 换一张
取 消