[Olsr-cvs] olsrd-current/src interfaces.c, 1.33, 1.34 interfaces.h, 1.41, 1.42 ipc_frontend.c, 1.34, 1.35 lq_route.c, 1.49, 1.50 process_routes.c, 1.35, 1.36 routing_table.c, 1.29, 1.30 routing_table.h, 1.19, 1.20
Bernd Petrovitsch
(spam-protected)
Wed Sep 5 18:17:38 CEST 2007
Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21820/src
Modified Files:
interfaces.c interfaces.h ipc_frontend.c lq_route.c
process_routes.c routing_table.c routing_table.h
Log Message:
* applied 102-olsrd-rt-refactoring-fixes.patch from Sven-Ola Tuecke <(spam-protected)>
Index: lq_route.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** lq_route.c 5 Sep 2007 16:11:10 -0000 1.49
--- lq_route.c 5 Sep 2007 16:17:36 -0000 1.50
***************
*** 605,609 ****
/* add a route to the main address of the destination node */
olsr_insert_routing_table(&vert->addr, max_host_plen, &vert->addr,
! &link->neighbor_iface_addr, inter,
vert->hops, vert->path_etx);
--- 605,609 ----
/* add a route to the main address of the destination node */
olsr_insert_routing_table(&vert->addr, max_host_plen, &vert->addr,
! &link->neighbor_iface_addr, inter->if_index,
vert->hops, vert->path_etx);
***************
*** 614,618 ****
olsr_insert_routing_table(&mid_walker->alias, max_host_plen, &vert->addr,
! &link->neighbor_iface_addr, inter,
vert->hops, vert->path_etx);
}
--- 614,618 ----
olsr_insert_routing_table(&mid_walker->alias, max_host_plen, &vert->addr,
! &link->neighbor_iface_addr, inter->if_index,
vert->hops, vert->path_etx);
}
***************
*** 634,638 ****
if (vert->path_etx != INFINITE_ETX)
olsr_insert_routing_table(&hna->A_network_addr, plen, &vert->addr,
! &link->neighbor_iface_addr, inter,
vert->hops, vert->path_etx);
}
--- 634,638 ----
if (vert->path_etx != INFINITE_ETX)
olsr_insert_routing_table(&hna->A_network_addr, plen, &vert->addr,
! &link->neighbor_iface_addr, inter->if_index,
vert->hops, vert->path_etx);
}
Index: interfaces.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** interfaces.c 2 Aug 2007 21:51:40 -0000 1.33
--- interfaces.c 5 Sep 2007 16:17:36 -0000 1.34
***************
*** 311,314 ****
--- 311,357 ----
/**
+ *Find the interface with a given interface index.
+ *
+ *@param iif_index of the interface to find.
+ *
+ *@return return the interface struct representing the interface
+ *that matched the iif_index.
+ */
+ struct interface *
+ if_ifwithindex(int if_index)
+ {
+ struct interface *ifp = ifnet;
+ while (ifp)
+ {
+ if (ifp->if_index == if_index)
+ return ifp;
+ ifp = ifp->int_next;
+ }
+ return NULL;
+ }
+
+
+ /**
+ *Get an interface name for a given interface index
+ *
+ *@param iif_index of the interface to find.
+ *
+ *@return "" or interface name.
+ */
+ char *
+ if_ifwithindex_name(int if_index)
+ {
+ struct interface *ifp = ifnet;
+ while (ifp)
+ {
+ if (ifp->if_index == if_index)
+ return ifp->int_name;
+ ifp = ifp->int_next;
+ }
+ return "void";
+ }
+
+
+ /**
*Create a new interf_name struct using a given
*name and insert it into the interface list.
Index: interfaces.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** interfaces.h 2 Aug 2007 21:51:40 -0000 1.41
--- interfaces.h 5 Sep 2007 16:17:36 -0000 1.42
***************
*** 212,215 ****
--- 212,221 ----
if_ifwithname(const char *);
+ struct interface *
+ if_ifwithindex(int if_index);
+
+ char *
+ if_ifwithindex_name(int if_index);
+
struct olsr_if *
queue_if(char *, int);
Index: routing_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** routing_table.c 5 Sep 2007 16:11:11 -0000 1.29
--- routing_table.c 5 Sep 2007 16:17:36 -0000 1.30
***************
*** 189,193 ****
static void
olsr_update_routing_entry(struct rt_path *rtp, union olsr_ip_addr *gateway,
! struct interface *iface, int metric, float etx)
{
--- 189,193 ----
static void
olsr_update_routing_entry(struct rt_path *rtp, union olsr_ip_addr *gateway,
! int iif_index, int metric, float etx)
{
***************
*** 198,202 ****
/* interface */
! rtp->rtp_nexthop.iface = iface;
/* etx */
--- 198,202 ----
/* interface */
! rtp->rtp_nexthop.iif_index = iif_index;
/* etx */
***************
*** 226,229 ****
--- 226,232 ----
memset(rt, 0, sizeof(struct rt_entry));
+
+ /* Mark this entry as fresh (see process_routes.c:512) */
+ rt->rt_nexthop.iif_index = -1;
/* set key and backpointer prior to tree insertion */
***************
*** 280,284 ****
{
if ((!COMP_IP(&nh1->gateway, &nh2->gateway)) ||
! (nh1->iface != nh2->iface)) {
return OLSR_TRUE;
}
--- 283,287 ----
{
if ((!COMP_IP(&nh1->gateway, &nh2->gateway)) ||
! (nh1->iif_index != nh2->iif_index)) {
return OLSR_TRUE;
}
***************
*** 401,405 ****
union olsr_ip_addr *originator,
union olsr_ip_addr *gateway,
! struct interface *iface,
int metric,
float etx)
--- 404,408 ----
union olsr_ip_addr *originator,
union olsr_ip_addr *gateway,
! int iif_index,
int metric,
float etx)
***************
*** 457,461 ****
/* update the version field and relevant parameters */
! olsr_update_routing_entry(rtp, gateway, iface, metric, etx);
return rtp;
--- 460,464 ----
/* update the version field and relevant parameters */
! olsr_update_routing_entry(rtp, gateway, iif_index, metric, etx);
return rtp;
***************
*** 564,568 ****
&link->neighbor->neighbor_main_addr,
&link->neighbor_iface_addr,
! iface, 1, etx);
/* this is the nexthop route that all routes will be tracking */
--- 567,571 ----
&link->neighbor->neighbor_main_addr,
&link->neighbor_iface_addr,
! iface->if_index, 1, etx);
/* this is the nexthop route that all routes will be tracking */
***************
*** 570,574 ****
&link->neighbor->neighbor_main_addr,
&link->neighbor_iface_addr,
! iface, 1, etx);
}
}
--- 573,577 ----
&link->neighbor->neighbor_main_addr,
&link->neighbor_iface_addr,
! iface->if_index, 1, etx);
}
}
***************
*** 618,622 ****
&tmp_hna->A_gateway_addr,
&rt->rt_best->rtp_nexthop.gateway,
! rt->rt_best->rtp_nexthop.iface,
rt->rt_best->rtp_metric.hops,
rt->rt_best->rtp_metric.etx);
--- 621,625 ----
&tmp_hna->A_gateway_addr,
&rt->rt_best->rtp_nexthop.gateway,
! rt->rt_best->rtp_nexthop.iif_index,
rt->rt_best->rtp_metric.hops,
rt->rt_best->rtp_metric.etx);
***************
*** 669,673 ****
rtp->rtp_metric.hops,
olsr_ip_to_string(&rtp->rtp_nexthop.gateway),
! rtp->rtp_nexthop.iface->int_name,
rtp->rtp_version);
--- 672,676 ----
rtp->rtp_metric.hops,
olsr_ip_to_string(&rtp->rtp_nexthop.gateway),
! if_ifwithindex_name(rt->rt_nexthop.iif_index),
rtp->rtp_version);
Index: ipc_frontend.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** ipc_frontend.c 5 Sep 2007 16:11:10 -0000 1.34
--- ipc_frontend.c 5 Sep 2007 16:17:36 -0000 1.35
***************
*** 339,343 ****
{
struct rt_entry *rt;
- struct interface *ifn;
struct ipcmsg packet;
char *tmp;
--- 339,342 ----
***************
*** 349,354 ****
OLSR_FOR_ALL_RT_ENTRIES(rt) {
- ifn = rt->rt_nexthop.iface;
-
memset(&packet, 0, sizeof(struct ipcmsg));
packet.size = htons(IPC_PACK_SIZE);
--- 348,351 ----
***************
*** 362,369 ****
COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway);
! if(ifn)
! memcpy(&packet.device[0], ifn->int_name, 4);
! else
! memset(&packet.device[0], 0, 4);
tmp = (char *) &packet;
--- 359,363 ----
COPY_IP(&packet.gateway_addr, &rt->rt_nexthop.gateway);
! memcpy(&packet.device[0], if_ifwithindex_name(rt->rt_nexthop.iif_index), 4);
tmp = (char *) &packet;
Index: process_routes.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** process_routes.c 5 Sep 2007 16:11:11 -0000 1.35
--- process_routes.c 5 Sep 2007 16:17:36 -0000 1.36
***************
*** 508,514 ****
if (olsr_nh_change(&rt->rt_best->rtp_nexthop, &rt->rt_nexthop)) {
! if (!rt->rt_nexthop.iface) {
! /* fresh routes do have NULL pointers in the nexthop fields. */
olsr_enqueue_rt(&add_kernel_list, rt);
} else {
--- 508,514 ----
if (olsr_nh_change(&rt->rt_best->rtp_nexthop, &rt->rt_nexthop)) {
! if (0 > rt->rt_nexthop.iif_index) {
! /* fresh routes do have an interface index of -1. */
olsr_enqueue_rt(&add_kernel_list, rt);
} else {
Index: routing_table.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** routing_table.h 5 Sep 2007 16:11:11 -0000 1.19
--- routing_table.h 5 Sep 2007 16:17:36 -0000 1.20
***************
*** 66,70 ****
/* a nexthop is a pointer to a gateway router plus an interface */
! struct rt_nexthop
{
union olsr_ip_addr gateway; /* gateway router */
--- 66,70 ----
/* a nexthop is a pointer to a gateway router plus an interface */
! struct rt_nexthop_soll_weg
{
union olsr_ip_addr gateway; /* gateway router */
***************
*** 72,75 ****
--- 72,81 ----
};
+ struct rt_nexthop
+ {
+ union olsr_ip_addr gateway; /* gateway router */
+ int iif_index; /* outgoung interface index */
+ };
+
/*
* Every prefix in our RIB needs a route entry that contains
***************
*** 169,173 ****
union olsr_ip_addr *,
union olsr_ip_addr *,
! struct interface *, int, float);
struct rt_entry *
--- 175,179 ----
union olsr_ip_addr *,
union olsr_ip_addr *,
! int, int, float);
struct rt_entry *
More information about the Olsr-cvs
mailing list