2004-05-03 Paul Jakma <paul@dishone.st>

* ripd.c: (rip_rte_process) fix typo in merge of previous patch
          and run function through indent.
This commit is contained in:
paul 2004-05-03 20:00:17 +00:00
parent c53174045b
commit a87552cdf2
2 changed files with 166 additions and 162 deletions

View File

@ -1,7 +1,12 @@
2004-05-03 Paul Jakma <paul@dishone.st>
* ripd.c: (rip_rte_process) fix typo in merge of previous patch
and run function through indent.
2004-03-19 Jean-Yves Simon <lethalwp@tiscali.be> 2004-03-19 Jean-Yves Simon <lethalwp@tiscali.be>
* ripd.c: make ripd also check on administrative distance of his * ripd.c: (rip_rte_process) make ripd also check on
own links to update routes. administrative distance of his own links to update routes.
2004-03-18 sowmini.varadhan@sun.com 2004-03-18 sowmini.varadhan@sun.com

View File

@ -382,7 +382,6 @@ rip_nexthop_check (struct in_addr *addr)
void void
rip_rte_process (struct rte *rte, struct sockaddr_in *from, rip_rte_process (struct rte *rte, struct sockaddr_in *from,
struct interface *ifp) struct interface *ifp)
{ {
int ret; int ret;
struct prefix_ipv4 p; struct prefix_ipv4 p;
@ -418,16 +417,16 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
memset (&newinfo, 0, sizeof (newinfo)); memset (&newinfo, 0, sizeof (newinfo));
newinfo.type = ZEBRA_ROUTE_RIP; newinfo.type = ZEBRA_ROUTE_RIP;
newinfo.sub_type = RIP_ROUTE_RTE; newinfo.sub_type = RIP_ROUTE_RTE;
newinfo.nexthop= rte->nexthop; newinfo.nexthop = rte->nexthop;
newinfo.from = from->sin_addr; newinfo.from = from->sin_addr;
newinfo.ifindex= ifp->ifindex; newinfo.ifindex = ifp->ifindex;
newinfo.metric = rte->metric; newinfo.metric = rte->metric;
newinfo.metric_out = rte->metric; /* XXX */ newinfo.metric_out = rte->metric; /* XXX */
newinfo.tag = ntohs(rte->tag); /* XXX */ newinfo.tag = ntohs (rte->tag); /* XXX */
/* The object should be of the type of rip_info */ /* The object should be of the type of rip_info */
ret = route_map_apply (ri->routemap[RIP_FILTER_IN], ret = route_map_apply (ri->routemap[RIP_FILTER_IN],
(struct prefix *)&p, RMAP_RIP, &newinfo); (struct prefix *) &p, RMAP_RIP, &newinfo);
if (ret == RMAP_DENYMATCH) if (ret == RMAP_DENYMATCH)
{ {
@ -439,7 +438,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
/* Get back the object */ /* Get back the object */
rte->nexthop = newinfo.nexthop_out; rte->nexthop = newinfo.nexthop_out;
rte->tag = htons(newinfo.tag_out); /* XXX */ rte->tag = htons (newinfo.tag_out); /* XXX */
rte->metric = newinfo.metric_out; /* XXX: the routemap uses the metric_out field */ rte->metric = newinfo.metric_out; /* XXX: the routemap uses the metric_out field */
} }
@ -452,7 +451,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
/* If offset-list does not modify the metric use interface's /* If offset-list does not modify the metric use interface's
metric. */ metric. */
if (! ret) if (!ret)
rte->metric += ifp->metric; rte->metric += ifp->metric;
if (rte->metric > RIP_METRIC_INFINITY) if (rte->metric > RIP_METRIC_INFINITY)
@ -493,7 +492,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
return; return;
} }
if (! rinfo) if (!rinfo)
{ {
/* Now, check to see whether there is already an explicit route /* Now, check to see whether there is already an explicit route
for the destination prefix. If there is no such route, add for the destination prefix. If there is no such route, add
@ -563,9 +562,9 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
/* Fill in a minimaly temporary rip_info structure, for a future /* Fill in a minimaly temporary rip_info structure, for a future
rip_distance_apply() use) */ rip_distance_apply() use) */
memset (&rinfo,0,sizeof(rinfotmp)); memset (&rinfotmp, 0, sizeof (rinfotmp));
IPV4_ADDR_COPY (&rinfotmp.from, &from->sin_addr); IPV4_ADDR_COPY (&rinfotmp.from, &from->sin_addr);
rinfotmp.rp=rinfo->rp; rinfotmp.rp = rinfo->rp;
/* Next, compare the metrics. If the datagram is from the same /* Next, compare the metrics. If the datagram is from the same
@ -574,13 +573,13 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
one, or if the tag has been changed; or if there is a route one, or if the tag has been changed; or if there is a route
with a lower administrave distance; or an update of the with a lower administrave distance; or an update of the
distance on the actual route; do the following actions: */ distance on the actual route; do the following actions: */
if (( same && rinfo->metric != rte->metric ) if ((same && rinfo->metric != rte->metric)
|| ( rte->metric < rinfo->metric ) || (rte->metric < rinfo->metric)
|| ( (same) || ((same)
&& (rinfo->metric == rte->metric) && (rinfo->metric == rte->metric)
&& ntohs(rte->tag) != rinfo->tag ) && ntohs (rte->tag) != rinfo->tag)
|| ( rinfo->distance > rip_distance_apply (&rinfotmp) ) || (rinfo->distance > rip_distance_apply (&rinfotmp))
|| ( (rinfo->distance != rip_distance_apply (rinfo)) && same )) || ((rinfo->distance != rip_distance_apply (rinfo)) && same))
{ {
/* - Adopt the route from the datagram. That is, put the /* - Adopt the route from the datagram. That is, put the
new metric in, and adjust the next hop address (if new metric in, and adjust the next hop address (if
@ -606,7 +605,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
RIP_TIMER_OFF (rinfo->t_garbage_collect); RIP_TIMER_OFF (rinfo->t_garbage_collect);
if (! IPV4_ADDR_SAME (&rinfo->nexthop, nexthop)) if (!IPV4_ADDR_SAME (&rinfo->nexthop, nexthop))
IPV4_ADDR_COPY (&rinfo->nexthop, nexthop); IPV4_ADDR_COPY (&rinfo->nexthop, nexthop);
rip_zebra_ipv4_add (&p, nexthop, rinfo->metric, rip_zebra_ipv4_add (&p, nexthop, rinfo->metric,
@ -622,7 +621,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
rinfo->distance); rinfo->distance);
rinfo->flags |= RIP_RTF_FIB; rinfo->flags |= RIP_RTF_FIB;
if (! IPV4_ADDR_SAME (&rinfo->nexthop, nexthop)) if (!IPV4_ADDR_SAME (&rinfo->nexthop, nexthop))
IPV4_ADDR_COPY (&rinfo->nexthop, nexthop); IPV4_ADDR_COPY (&rinfo->nexthop, nexthop);
} }
@ -650,7 +649,7 @@ rip_rte_process (struct rte *rte, struct sockaddr_in *from,
/* - The metric for the route is set to 16 /* - The metric for the route is set to 16
(infinity). This causes the route to be removed (infinity). This causes the route to be removed
from service.*/ from service. */
rip_zebra_ipv4_delete (&p, &rinfo->nexthop, oldmetric); rip_zebra_ipv4_delete (&p, &rinfo->nexthop, oldmetric);
rinfo->flags &= ~RIP_RTF_FIB; rinfo->flags &= ~RIP_RTF_FIB;