diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2007-10-16 12:05:53 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2007-10-16 12:05:53 +0000 |
commit | c93bdde023fd7cec6281f07300d05bfe92b7c888 (patch) | |
tree | 8bc389ceb0cf1efcc461fb6952b482771ba88a1d /usr.sbin/ospf6d | |
parent | d20466bc45a7f5f50f9d059f77420fbaa5298f27 (diff) |
In OSPFv3 the LSA type is a 16 bit value, furthermore it uses different
values than the v2 counterpart.
Change to u_int16_t and define new LSA types.
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/lsack.c | 9 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6.h | 14 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.c | 9 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde.h | 6 | ||||
-rw-r--r-- | usr.sbin/ospf6d/rde_lsdb.c | 24 |
5 files changed, 35 insertions, 27 deletions
diff --git a/usr.sbin/ospf6d/lsack.c b/usr.sbin/ospf6d/lsack.c index 781dfcfeac6..d6f1dfafe92 100644 --- a/usr.sbin/ospf6d/lsack.c +++ b/usr.sbin/ospf6d/lsack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lsack.c,v 1.2 2007/10/10 14:09:25 claudio Exp $ */ +/* $OpenBSD: lsack.c,v 1.3 2007/10/16 12:05:52 norby Exp $ */ /* * Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org> @@ -122,10 +122,12 @@ lsa_hdr_check(struct nbr *nbr, struct lsa_hdr *lsa_hdr) /* invalid type */ switch (lsa_hdr->type) { + case LSA_TYPE_LINK: case LSA_TYPE_ROUTER: case LSA_TYPE_NETWORK: - case LSA_TYPE_SUM_NETWORK: - case LSA_TYPE_SUM_ROUTER: + case LSA_TYPE_INTER_A_PREFIX: + case LSA_TYPE_INTER_A_ROUTER: + case LSA_TYPE_INTRA_A_PREFIX: case LSA_TYPE_EXTERNAL: break; default: @@ -168,7 +170,6 @@ ls_ack_list_add(struct iface *iface, struct lsa_hdr *lsa) ((iface->mtu - PACKET_HDR) / sizeof(struct lsa_hdr))) { start_ls_ack_tx_timer_now(iface); } - } void diff --git a/usr.sbin/ospf6d/ospf6.h b/usr.sbin/ospf6d/ospf6.h index 0865624d386..e6a326b0e08 100644 --- a/usr.sbin/ospf6d/ospf6.h +++ b/usr.sbin/ospf6d/ospf6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6.h,v 1.2 2007/10/09 06:12:04 claudio Exp $ */ +/* $OpenBSD: ospf6.h,v 1.3 2007/10/16 12:05:52 norby Exp $ */ /* * Copyright (c) 2004, 2005, 2007 Esben Norby <norby@openbsd.org> @@ -161,11 +161,13 @@ struct ls_upd_hdr { u_int32_t num_lsa; }; -#define LSA_TYPE_ROUTER 1 -#define LSA_TYPE_NETWORK 2 -#define LSA_TYPE_SUM_NETWORK 3 -#define LSA_TYPE_SUM_ROUTER 4 -#define LSA_TYPE_EXTERNAL 5 +#define LSA_TYPE_LINK 0x0008 +#define LSA_TYPE_ROUTER 0x2001 +#define LSA_TYPE_NETWORK 0x2002 +#define LSA_TYPE_INTER_A_PREFIX 0x2003 +#define LSA_TYPE_INTER_A_ROUTER 0x2004 +#define LSA_TYPE_INTRA_A_PREFIX 0x2009 +#define LSA_TYPE_EXTERNAL 0x4005 #define LINK_TYPE_POINTTOPOINT 1 #define LINK_TYPE_TRANSIT_NET 2 diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c index 0164e7defd9..b4b8a0b501f 100644 --- a/usr.sbin/ospf6d/rde.c +++ b/usr.sbin/ospf6d/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.4 2007/10/16 08:41:56 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.5 2007/10/16 12:05:52 norby Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -1049,7 +1049,7 @@ rde_summary_update(struct rt_node *rte, struct area *area) { struct vertex *v = NULL; //XXX struct lsa *lsa; - u_int8_t type = 0; + u_int16_t type = 0; /* first check if we actually need to announce this route */ if (!(rte->d_type == DT_NET || rte->flags & OSPF_RTR_E)) @@ -1071,11 +1071,10 @@ rde_summary_update(struct rt_node *rte, struct area *area) /* TODO intra-area stuff -- condense LSA ??? */ if (rte->d_type == DT_NET) { - type = LSA_TYPE_SUM_NETWORK; + type = LSA_TYPE_INTER_A_PREFIX; } else if (rte->d_type == DT_RTR) { - type = LSA_TYPE_SUM_ROUTER; + type = LSA_TYPE_INTER_A_ROUTER; } else - fatalx("rde_summary_update: unknown route type"); #if 0 /* XXX a lot todo */ /* update lsa but only if it was changed */ diff --git a/usr.sbin/ospf6d/rde.h b/usr.sbin/ospf6d/rde.h index d5e71816b81..d1a1f745a58 100644 --- a/usr.sbin/ospf6d/rde.h +++ b/usr.sbin/ospf6d/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.2 2007/10/16 08:41:56 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.3 2007/10/16 12:05:52 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -47,7 +47,7 @@ struct vertex { u_int32_t peerid; /* neighbor unique imsg ID */ u_int32_t ls_id; u_int32_t adv_rtr; - u_int8_t type; + u_int16_t type; u_int8_t flooded; u_int8_t deleted; u_int8_t self; @@ -128,7 +128,7 @@ int lsa_self(struct rde_nbr *, struct lsa *, struct vertex *); int lsa_add(struct rde_nbr *, struct lsa *); void lsa_del(struct rde_nbr *, struct lsa_hdr *); void lsa_age(struct vertex *); -struct vertex *lsa_find(struct area *, u_int8_t, u_int32_t, u_int32_t); +struct vertex *lsa_find(struct area *, u_int16_t, u_int32_t, u_int32_t); struct vertex *lsa_find_net(struct area *area, u_int32_t); u_int16_t lsa_num_links(struct vertex *); void lsa_snap(struct area *, u_int32_t); diff --git a/usr.sbin/ospf6d/rde_lsdb.c b/usr.sbin/ospf6d/rde_lsdb.c index 70c23652f16..92193453768 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.1 2007/10/08 10:44:51 norby Exp $ */ +/* $OpenBSD: rde_lsdb.c,v 1.2 2007/10/16 12:05:52 norby Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -185,7 +185,10 @@ lsa_check(struct rde_nbr *nbr, struct lsa *lsa, u_int16_t len) return (0); } - switch (lsa->hdr.type) { + switch (ntohs(lsa->hdr.type)) { + case LSA_TYPE_LINK: + /* XXX */ + break; case LSA_TYPE_ROUTER: if (!lsa_router_check(lsa, len)) return (0); @@ -197,8 +200,8 @@ lsa_check(struct rde_nbr *nbr, struct lsa *lsa, u_int16_t len) return (0); } break; - case LSA_TYPE_SUM_NETWORK: - case LSA_TYPE_SUM_ROUTER: + case LSA_TYPE_INTER_A_PREFIX: + case LSA_TYPE_INTER_A_ROUTER: if ((len % sizeof(u_int32_t)) || len < sizeof(lsa->hdr) + sizeof(lsa->data.sum)) { log_warnx("lsa_check: bad LSA summary packet"); @@ -210,6 +213,9 @@ lsa_check(struct rde_nbr *nbr, struct lsa *lsa, u_int16_t len) return (0); } break; + case LSA_TYPE_INTRA_A_PREFIX: + /* XXX */ + break; case LSA_TYPE_EXTERNAL: if ((len % (3 * sizeof(u_int32_t))) || len < sizeof(lsa->hdr) + sizeof(lsa->data.asext)) { @@ -436,7 +442,7 @@ lsa_age(struct vertex *v) } struct vertex * -lsa_find(struct area *area, u_int8_t type, u_int32_t ls_id, u_int32_t adv_rtr) +lsa_find(struct area *area, u_int16_t type, u_int32_t ls_id, u_int32_t adv_rtr) { struct vertex key; struct vertex *v; @@ -555,11 +561,11 @@ lsa_dump(struct lsa_tree *tree, int imsg_type, pid_t pid) break; continue; case IMSG_CTL_SHOW_DB_SUM: - if (v->type == LSA_TYPE_SUM_NETWORK) + if (v->type == LSA_TYPE_INTER_A_PREFIX) break; continue; case IMSG_CTL_SHOW_DB_ASBR: - if (v->type == LSA_TYPE_SUM_ROUTER) + if (v->type == LSA_TYPE_INTER_A_ROUTER) break; continue; default: @@ -700,8 +706,8 @@ lsa_remove_invalid_sums(struct area *area) /* XXX speed me up */ for (v = RB_MIN(lsa_tree, tree); v != NULL; v = nv) { nv = RB_NEXT(lsa_tree, tree, v); - if ((v->lsa->hdr.type == LSA_TYPE_SUM_NETWORK || - v->lsa->hdr.type == LSA_TYPE_SUM_ROUTER) && + if ((v->lsa->hdr.type == LSA_TYPE_INTER_A_PREFIX || + v->lsa->hdr.type == LSA_TYPE_INTER_A_ROUTER) && v->self && v->cost == LS_INFINITY && v->deleted == 0) { /* |