[Olsr-cvs] olsrd-current/src/win32 kernel_routes.c,1.20,1.21
Bernd Petrovitsch
(spam-protected)
Wed Sep 5 18:11:13 CEST 2007
- Previous message: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.23,1.24
- Next message: [Olsr-cvs] olsrd-current/src hna_set.c, 1.20, 1.21 hna_set.h, 1.14, 1.15 ipc_frontend.c, 1.33, 1.34 kernel_routes.h, 1.8, 1.9 lq_avl.c, 1.11, 1.12 lq_avl.h, 1.9, 1.10 lq_list.c, 1.5, 1.6 lq_list.h, 1.5, 1.6 lq_route.c, 1.48, 1.49 lq_route.h, 1.4, 1.5 main.c, 1.96, 1.97 net_olsr.c, 1.28, 1.29 net_olsr.h, 1.10, 1.11 olsr.c, 1.56, 1.57 olsr_types.h, 1.8, 1.9 process_routes.c, 1.34, 1.35 process_routes.h, 1.10, 1.11 routing_table.c, 1.28, 1.29 routing_table.h, 1.18, 1.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/olsrd/olsrd-current/src/win32
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18959/src/win32
Modified Files:
kernel_routes.c
Log Message:
* applied rt-refactoring-6.diff from Hannes Gredler <(spam-protected)>
Index: kernel_routes.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** kernel_routes.c 25 Apr 2007 22:22:15 -0000 1.20
--- kernel_routes.c 5 Sep 2007 16:11:11 -0000 1.21
***************
*** 53,82 ****
char *StrError(unsigned int ErrNo);
! int olsr_ioctl_add_route(struct rt_entry *Dest)
{
MIB_IPFORWARDROW Row;
unsigned long Res;
- char Str1[16], Str2[16], Str3[16];
-
- inet_ntop(AF_INET, &Dest->rt_dst.v4, Str1, 16);
- inet_ntop(AF_INET, &Dest->rt_mask.v4, Str2, 16);
- inet_ntop(AF_INET, &Dest->rt_router.v4, Str3, 16);
! OLSR_PRINTF(1, "Adding IPv4 route with metric %d to %s/%s via %s and I/F 0x%x.\n",
! Dest->rt_metric + Dest->rt_if->int_metric, Str1, Str2, Str3, Dest->rt_if->if_index);
memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
! Row.dwForwardDest = Dest->rt_dst.v4;
! Row.dwForwardMask = Dest->rt_mask.v4;
Row.dwForwardPolicy = 0;
! Row.dwForwardNextHop = Dest->rt_router.v4;
! Row.dwForwardIfIndex = Dest->rt_if->if_index;
// MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
! Row.dwForwardType = (Dest->rt_dst.v4 == Dest->rt_router.v4) ? 3 : 4;
Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
Row.dwForwardAge = INFINITE;
Row.dwForwardNextHopAS = 0;
! Row.dwForwardMetric1 = Dest->rt_metric + Dest->rt_if->int_metric;
Row.dwForwardMetric2 = -1;
Row.dwForwardMetric3 = -1;
--- 53,90 ----
char *StrError(unsigned int ErrNo);
! /**
! *Insert a route in the kernel routing table
! *
! *@param destination the route to add
! *
! *@return negative on error
! */
! int olsr_ioctl_add_route(struct rt_entry *rt)
{
MIB_IPFORWARDROW Row;
+ union olsr_ip_addr mask;
unsigned long Res;
! OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rt_to_string(rt));
memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
! Row.dwForwardDest = rt->rt_dst.prefix.v4;
!
! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) {
! return -1;
! } else {
! Row.dwForwardMask = mask.v4;
! }
!
Row.dwForwardPolicy = 0;
! Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4;
! Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iface->if_index;
// MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
! Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_best->rtp_nexthop.gateway.v4) ? 3 : 4;
Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
Row.dwForwardAge = INFINITE;
Row.dwForwardNextHopAS = 0;
! Row.dwForwardMetric1 = RT_METRIC_DEFAULT;
Row.dwForwardMetric2 = -1;
Row.dwForwardMetric3 = -1;
***************
*** 105,111 ****
}
! if(olsr_cnf->open_ipc)
! ipc_route_send_rtentry(&Dest->rt_dst, &Dest->rt_router, Dest->rt_metric,
! 1, Dest->rt_if->int_name);
return 0;
--- 113,124 ----
}
! /*
! * Send IPC route update message
! */
! if(olsr_cnf->open_ipc) {
! ipc_route_send_rtentry(&rt->rt_dst.prefix, &rt->rt_best->rtp_nexthop.gateway,
! rt->rt_best->rtp_metric.hops, 1,
! rt->rt_best->rtp_nexthop.iface->int_name);
! }
return 0;
***************
*** 114,148 ****
// XXX - to be implemented
! int olsr_ioctl_add_route6(struct rt_entry *Dest __attribute__((unused)))
{
return 0;
}
! int olsr_ioctl_del_route(struct rt_entry *Dest)
{
MIB_IPFORWARDROW Row;
unsigned long Res;
- char Str1[16], Str2[16], Str3[16];
! inet_ntop(AF_INET, &Dest->rt_dst.v4, Str1, 16);
! inet_ntop(AF_INET, &Dest->rt_mask.v4, Str2, 16);
! inet_ntop(AF_INET, &Dest->rt_router.v4, Str3, 16);
!
! OLSR_PRINTF(1, "Deleting IPv4 route with metric %d to %s/%s via %s and I/F 0x%x.\n",
! Dest->rt_metric + Dest->rt_if->int_metric, Str1, Str2, Str3, Dest->rt_if->if_index);
memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
! Row.dwForwardDest = Dest->rt_dst.v4;
! Row.dwForwardMask = Dest->rt_mask.v4;
Row.dwForwardPolicy = 0;
! Row.dwForwardNextHop = Dest->rt_router.v4;
! Row.dwForwardIfIndex = Dest->rt_if->if_index;
// MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
! Row.dwForwardType = (Dest->rt_dst.v4 == Dest->rt_router.v4) ? 3 : 4;
Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
Row.dwForwardAge = INFINITE;
Row.dwForwardNextHopAS = 0;
! Row.dwForwardMetric1 = Dest->rt_metric + Dest->rt_if->int_metric;
Row.dwForwardMetric2 = -1;
Row.dwForwardMetric3 = -1;
--- 127,169 ----
// XXX - to be implemented
! int olsr_ioctl_add_route6(struct rt_entry *rt __attribute__((unused)))
{
return 0;
}
! /**
! *Remove a route from the kernel
! *
! *@param destination the route to remove
! *
! *@return negative on error
! */
! int olsr_ioctl_del_route(struct rt_entry *rt)
{
MIB_IPFORWARDROW Row;
+ union olsr_ip_addr mask;
unsigned long Res;
! OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt));
memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
! Row.dwForwardDest = rt->rt_dst.prefix.v4;
!
! if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) {
! return -1;
! } else {
! Row.dwForwardMask = mask.v4;
! }
!
Row.dwForwardPolicy = 0;
! Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4;
! Row.dwForwardIfIndex = rt->rt_nexthop.iface->if_index;
// MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
! Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_nexthop.gateway.v4) ? 3 : 4;
Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
Row.dwForwardAge = INFINITE;
Row.dwForwardNextHopAS = 0;
! Row.dwForwardMetric1 = RT_METRIC_DEFAULT;
Row.dwForwardMetric2 = -1;
Row.dwForwardMetric3 = -1;
***************
*** 163,168 ****
}
! if(olsr_cnf->open_ipc)
! ipc_route_send_rtentry(&Dest->rt_dst, NULL, Dest->rt_metric, 0, NULL);
return 0;
--- 184,193 ----
}
! /*
! * Send IPC route update message
! */
! if(olsr_cnf->open_ipc) {
! ipc_route_send_rtentry(&rt->rt_dst.prefix, NULL, 0 , 0, NULL);
! }
return 0;
***************
*** 171,175 ****
// XXX - to be implemented
! int olsr_ioctl_del_route6(struct rt_entry *Dest __attribute__((unused)))
{
return 0;
--- 196,200 ----
// XXX - to be implemented
! int olsr_ioctl_del_route6(struct rt_entry *rt __attribute__((unused)))
{
return 0;
- Previous message: [Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.23,1.24
- Next message: [Olsr-cvs] olsrd-current/src hna_set.c, 1.20, 1.21 hna_set.h, 1.14, 1.15 ipc_frontend.c, 1.33, 1.34 kernel_routes.h, 1.8, 1.9 lq_avl.c, 1.11, 1.12 lq_avl.h, 1.9, 1.10 lq_list.c, 1.5, 1.6 lq_list.h, 1.5, 1.6 lq_route.c, 1.48, 1.49 lq_route.h, 1.4, 1.5 main.c, 1.96, 1.97 net_olsr.c, 1.28, 1.29 net_olsr.h, 1.10, 1.11 olsr.c, 1.56, 1.57 olsr_types.h, 1.8, 1.9 process_routes.c, 1.34, 1.35 process_routes.h, 1.10, 1.11 routing_table.c, 1.28, 1.29 routing_table.h, 1.18, 1.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Olsr-cvs
mailing list