diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2009-03-29 19:28:11 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2009-03-29 19:28:11 +0000 |
commit | 68e74bdf6908f3b8e20436865afa98df9fe89f9f (patch) | |
tree | d3b7fbcd2beaa1696a1b8ae4fdb800c6b08d0a6a /usr.sbin/ospf6d | |
parent | da4d40d6c22707b68be6a4b9db6be84251be45e9 (diff) |
Change get_net_link()'s idx argument to unsigned, and make it
use less local variables. Makes it consistent with get_rtr_link().
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/rde.h | 4 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde_spf.c | 19 |
2 files changed, 10 insertions, 13 deletions
diff --git a/usr.sbin/ospf6d/rde.h b/usr.sbin/ospf6d/rde.h index fa26b649198..d3ef2ef43ff 100644 --- a/usr.sbin/ospf6d/rde.h +++ b/usr.sbin/ospf6d/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.15 2009/03/29 19:25:49 stsp Exp $ */ +/* $OpenBSD: rde.h,v 1.16 2009/03/29 19:28:10 stsp Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -179,7 +179,7 @@ void rt_clear(void); void rt_dump(struct in_addr, pid_t, u_int8_t); struct lsa_rtr_link *get_rtr_link(struct vertex *, unsigned int); -struct lsa_net_link *get_net_link(struct vertex *, int); +struct lsa_net_link *get_net_link(struct vertex *, unsigned 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 0d46ab4751d..755adb77c14 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.8 2009/03/29 19:25:49 stsp Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.9 2009/03/29 19:28:10 stsp Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -1011,25 +1011,22 @@ get_rtr_link(struct vertex *v, unsigned int idx) /* network LSA links */ struct lsa_net_link * -get_net_link(struct vertex *v, int idx) +get_net_link(struct vertex *v, unsigned int idx) { struct lsa_net_link *net_link = NULL; char *buf = (char *)v->lsa; - u_int16_t i, off, nlinks; + unsigned int i; if (v->type != LSA_TYPE_NETWORK) fatalx("get_net_link: invalid LSA type"); - off = sizeof(v->lsa->hdr) + sizeof(u_int32_t); - - /* nlinks validated earlier by lsa_check() */ - nlinks = lsa_num_links(v); - for (i = 0; i < nlinks; i++) { - net_link = (struct lsa_net_link *)(buf + off); + /* number of links validated earlier by lsa_check() */ + net_link = (struct lsa_net_link *)(buf + sizeof(v->lsa->hdr) + + sizeof(struct lsa_net)); + for (i = 0; i < lsa_num_links(v); i++) { if (i == idx) return (net_link); - - off += sizeof(struct lsa_net_link); + net_link++; } return (NULL); |