summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ospf6d/rde.h4
-rw-r--r--usr.sbin/ospf6d/rde_spf.c19
2 files changed, 11 insertions, 12 deletions
diff --git a/usr.sbin/ospf6d/rde.h b/usr.sbin/ospf6d/rde.h
index 1e42020c72b..fa26b649198 100644
--- a/usr.sbin/ospf6d/rde.h
+++ b/usr.sbin/ospf6d/rde.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.h,v 1.14 2009/03/29 19:18:20 stsp Exp $ */
+/* $OpenBSD: rde.h,v 1.15 2009/03/29 19:25:49 stsp Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -178,7 +178,7 @@ int rt_remove(struct rt_node *);
void rt_clear(void);
void rt_dump(struct in_addr, pid_t, u_int8_t);
-struct lsa_rtr_link *get_rtr_link(struct vertex *, int);
+struct lsa_rtr_link *get_rtr_link(struct vertex *, unsigned int);
struct lsa_net_link *get_net_link(struct vertex *, int);
RB_PROTOTYPE(lsa_tree, vertex, entry, lsa_compare)
diff --git a/usr.sbin/ospf6d/rde_spf.c b/usr.sbin/ospf6d/rde_spf.c
index 35ad84c6960..0d46ab4751d 100644
--- a/usr.sbin/ospf6d/rde_spf.c
+++ b/usr.sbin/ospf6d/rde_spf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_spf.c,v 1.7 2009/03/10 17:37:45 stsp Exp $ */
+/* $OpenBSD: rde_spf.c,v 1.8 2009/03/29 19:25:49 stsp Exp $ */
/*
* Copyright (c) 2005 Esben Norby <norby@openbsd.org>
@@ -56,7 +56,7 @@ spf_calc(struct area *area)
struct lsa_rtr_link *rtr_link = NULL;
struct lsa_net_link *net_link;
u_int32_t d;
- int i;
+ unsigned int i;
struct in_addr addr;
/* clear SPF tree */
@@ -988,23 +988,22 @@ rt_lookup(enum dst_type type, struct in6_addr *addr)
/* router LSA links */
struct lsa_rtr_link *
-get_rtr_link(struct vertex *v, int idx)
+get_rtr_link(struct vertex *v, unsigned int idx)
{
struct lsa_rtr_link *rtr_link = NULL;
char *buf = (char *)v->lsa;
- u_int16_t i, off, nlinks;
+ unsigned int i;
if (v->type != LSA_TYPE_ROUTER)
fatalx("get_rtr_link: invalid LSA type");
- off = sizeof(v->lsa->hdr) + sizeof(struct lsa_rtr);
-
- /* nlinks validated earlier by lsa_check() */
- nlinks = lsa_num_links(v);
- for (i = 0; i < nlinks; i++) {
- rtr_link = (struct lsa_rtr_link *)(buf + off);
+ /* number of links validated earlier by lsa_check() */
+ rtr_link = (struct lsa_rtr_link *)(buf + sizeof(v->lsa->hdr) +
+ sizeof(struct lsa_rtr));
+ for (i = 0; i < lsa_num_links(v); i++) {
if (i == idx)
return (rtr_link);
+ rtr_link++;
}
return (NULL);