diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2007-10-16 13:01:08 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2007-10-16 13:01:08 +0000 |
commit | f5f4be7c8c10a10b137f7028ceebfacd147deb87 (patch) | |
tree | eb9859dba92b029da6ee32c211ea262b43a37f36 | |
parent | 1a4a5449526a0ad2695abde5ab2e09d8fc19258e (diff) |
Make ospf6d(8) not throw up on Router LSAs.
Initial step towards actually storing real LSAs.
ok claudio@
-rw-r--r-- | usr.sbin/ospf6d/lsack.c | 4 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6.h | 9 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde_lsdb.c | 11 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde_spf.c | 15 |
4 files changed, 22 insertions, 17 deletions
diff --git a/usr.sbin/ospf6d/lsack.c b/usr.sbin/ospf6d/lsack.c index d6f1dfafe92..0561c73ffc2 100644 --- a/usr.sbin/ospf6d/lsack.c +++ b/usr.sbin/ospf6d/lsack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsack.c,v 1.3 2007/10/16 12:05:52 norby Exp $ */ +/* $OpenBSD: lsack.c,v 1.4 2007/10/16 13:01:07 norby Exp $ */ /* * Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org> @@ -121,7 +121,7 @@ lsa_hdr_check(struct nbr *nbr, struct lsa_hdr *lsa_hdr) } /* invalid type */ - switch (lsa_hdr->type) { + switch (ntohs(lsa_hdr->type)) { case LSA_TYPE_LINK: case LSA_TYPE_ROUTER: case LSA_TYPE_NETWORK: diff --git a/usr.sbin/ospf6d/ospf6.h b/usr.sbin/ospf6d/ospf6.h index e6a326b0e08..fbde1916fef 100644 --- a/usr.sbin/ospf6d/ospf6.h +++ b/usr.sbin/ospf6d/ospf6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6.h,v 1.3 2007/10/16 12:05:52 norby Exp $ */ +/* $OpenBSD: ospf6.h,v 1.4 2007/10/16 13:01:07 norby Exp $ */ /* * Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org> @@ -189,11 +189,12 @@ struct lsa_rtr { }; struct lsa_rtr_link { - u_int32_t id; - u_int32_t data; u_int8_t type; - u_int8_t num_tos; + u_int8_t dummy; u_int16_t metric; + u_int32_t iface_id; + u_int32_t nbr_iface_id; + u_int32_t nbr_rtr_id; }; struct lsa_net { diff --git a/usr.sbin/ospf6d/rde_lsdb.c b/usr.sbin/ospf6d/rde_lsdb.c index 92193453768..540572be6fb 100644 --- a/usr.sbin/ospf6d/rde_lsdb.c +++ b/usr.sbin/ospf6d/rde_lsdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_lsdb.c,v 1.2 2007/10/16 12:05:52 norby Exp $ */ +/* $OpenBSD: rde_lsdb.c,v 1.3 2007/10/16 13:01:07 norby Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -265,15 +265,12 @@ lsa_router_check(struct lsa *lsa, u_int16_t len) return (0); } - nlinks = ntohs(lsa->data.rtr.nlinks); + nlinks = (len - off) / 16; /* XXX way to go ? */ + for (i = 0; i < nlinks; i++) { rtr_link = (struct lsa_rtr_link *)(buf + off); off += sizeof(struct lsa_rtr_link); - if (off > len) { - log_warnx("lsa_check: invalid LSA router packet"); - return (0); - } - off += rtr_link->num_tos * sizeof(u_int32_t); + if (off > len) { log_warnx("lsa_check: invalid LSA router packet"); return (0); diff --git a/usr.sbin/ospf6d/rde_spf.c b/usr.sbin/ospf6d/rde_spf.c index 6302b27929b..e5c46f1e018 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.2 2007/10/16 08:41:56 claudio Exp $ */ +/* $OpenBSD: rde_spf.c,v 1.3 2007/10/16 13:01:07 norby Exp $ */ /* * Copyright (c) 2005 Esben Norby <norby@openbsd.org> @@ -87,13 +87,17 @@ spf_calc(struct area *area) case LINK_TYPE_POINTTOPOINT: case LINK_TYPE_VIRTUAL: /* find router LSA */ +#if 0 w = lsa_find(area, LSA_TYPE_ROUTER, rtr_link->id, rtr_link->id); break; +#endif case LINK_TYPE_TRANSIT_NET: /* find network LSA */ +#if 0 w = lsa_find_net(area, rtr_link->id); break; +#endif default: fatalx("spf_calc: invalid link type"); } @@ -394,6 +398,7 @@ calc_nexthop_add(struct vertex *dst, struct vertex *parent, u_int32_t nexthop) void calc_nexthop(struct vertex *dst, struct vertex *parent) { +#if 0 struct lsa_rtr_link *rtr_link = NULL; struct v_nexthop *vn; int i; @@ -468,6 +473,7 @@ calc_nexthop(struct vertex *dst, struct vertex *parent) /* case 3 */ TAILQ_FOREACH(vn, &parent->nexthop, entry) calc_nexthop_add(dst, parent, 0 /* XXX vn->nexthop.s_addr */); +#endif } /* candidate list */ @@ -1006,9 +1012,6 @@ get_rtr_link(struct vertex *v, int idx) rtr_link = (struct lsa_rtr_link *)(buf + off); if (i == idx) return (rtr_link); - - off += sizeof(struct lsa_rtr_link) + - rtr_link->num_tos * sizeof(u_int32_t); } return (NULL); @@ -1054,14 +1057,18 @@ linked(struct vertex *w, struct vertex *v) rtr_link = get_rtr_link(w, i); switch (v->type) { case LSA_TYPE_ROUTER: +#if 0 if (rtr_link->type == LINK_TYPE_POINTTOPOINT && rtr_link->id == htonl(v->ls_id)) return (1); break; +#endif case LSA_TYPE_NETWORK: +#if 0 if (rtr_link->id == htonl(v->ls_id)) return (1); break; +#endif default: fatalx("spf_calc: invalid type"); } |