Hello All,
I am working on Intermediate Driver. I am not able to add a route
to kernel routing table. Following is the code. What can be reason ? I hope
at driver level we have "write" access to kernel routing table. The return
value to function call CreateIpForwardEntry is 50. Please send me suggestions.
// Nandan: Fill in the structure
NdisZeroMemory(&row, sizeof(row));
row.dwForwardDest = destIp;
row.dwForwardNextHop = gatewayIp;
row.dwForwardMask = 0xFFFFFFFF; // Nandan: 255.255.255.255
//row.dwForwardIfIndex = pAdapterBinding->ulInterfaceIndex;
row.dwForwardType = MIB_IPROUTE_TYPE_DIRECT;
row.dwForwardProto = MIB_IPPROTO_RIP;
row.dwForwardAge = 0;
row.dwForwardMetric1 = 30;
// Nandan: Create a new route entry for the destination
status = CreateIpForwardEntry(&row);
if(status == NO_ERROR)
{
// Nandan: Don't know outcome yet
DBGPRINT(("InsertKernelRouteEntry: Bingo ... added the route to %s with
first hop %s\n",my_inet_ntoa(destIp) , my_inet_ntoa(gatewayIp)));
return status;
}
else
{
// Nandan: Don't know outcome yet
DBGPRINT(("InsertKernelRouteEntry: Adding the route to %s with first hop
%s .. FAILED. %d\n",my_inet_ntoa(destIp) , my_inet_ntoa(gatewayIp) , status));
}
if(status == STATUS_PENDING)
{
// Nandan: Don't know outcome yet
}
else
if(status == STATUS_SUCCESS)
{
DBGPRINT(("CRESQ: Route Added Successfully\n"));
}
else
if(status == STATUS_INVALID_PARAMETER)
{
DBGPRINT(("CRESQ: Invalid Parameter in InsertKernelRouteEntry\n"));
}
else
{
DBGPRINT(("CRESQ: Error adding new route to kernel routing table!\n"));
}