如何判断 MIB_IPFORWARDROW 结构中的*哪个*成员无效?
调用 CreateIpForwardEntry 返回 ERROR_INVALID_PARAMETER。 PSDK 文档将此错误描述为:
pRoute参数为NULL, SetIpForwardEntry 无法读取 从 pRoute 指向的内存中, 或该组织的成员之一 MIB_IPFORWARDROW 结构无效。
我确信 pRoute 不为 NULL,并且不涉及对 SetIpForwardEntry 的调用,这使得错误的唯一原因是“MIB_IPFORWARDROW 结构的成员之一无效”。
我如何知道 MIB_IPFORWARDROW 的哪些成员无效?
为了进一步澄清我的问题:我确切地知道每个成员都有什么价值(我记录了它们)。但此时此刻,我还无法判断哪一个是错误的。它们对我来说都是有效的。很高兴知道为什么其中一位成员无效。但为此我首先需要知道哪一个是无效的。
例如,在一个测试用例(产生上述错误)中,我有:
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
知道为什么 CreateIpForwardEntry() 不同意接受上述参数吗?
更新:下面提供的提示非常有帮助,但并没有真正提供如何告诉 MIB_IPFORWARDROW 结构中的哪个成员无效的方法。我确实纠正了提到的两个成员,但问题仍然存在:
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
知道为什么 CreateIpForwardEntry() 不同意接受上述参数吗?
提示、想法、见解将不胜感激。
谢谢。
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 however, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 IP 路由一无所知,但MIB_IPFORWARDROW 文档未将 0 列为 dwForwardType 的有效值。此外,CreateIpForwardEntry 的文档指出 dwForwardProto 必须为 3 (MIB_IPPROTO_NETMGMT) 。
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).