summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2009-03-29 19:34:23 +0000
committerstsp <stsp@openbsd.org>2009-03-29 19:34:23 +0000
commitca30c715d1f61f6311b286d856f86ca5da9b10bd (patch)
tree0ce7256d71cda461447e3611fd8cc39692efbdd0
parentChange get_net_link()'s idx argument to unsigned, and make it (diff)
downloadwireguard-openbsd-ca30c715d1f61f6311b286d856f86ca5da9b10bd.tar.xz
wireguard-openbsd-ca30c715d1f61f6311b286d856f86ca5da9b10bd.zip
Update linked() for OSPFv3.
A router vertex w has a point-to-point link back to a router vertex v if v's router ID occurs as neighbour ID in one of the point-to-point links described in w's router LSA. A router vertex w has a link back to a network vertex v if the router ID of v's advertising router (i.e. DR) occurs as neighbour ID in one of the transit links described in w's router LSA, and v's interface ID to the network matches the neighbour interface ID of that transit link. A network vertex w has a link back to a router vertex v if v's router ID occurs in the list of attached routers in w's network LSA. Also, get_rtr_link() and get_net_link() take an unsigned int now. "commit it" claudio@
-rw-r--r--usr.sbin/ospf6d/rde_spf.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/ospf6d/rde_spf.c b/usr.sbin/ospf6d/rde_spf.c
index 755adb77c14..2640bc093db 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.9 2009/03/29 19:28:10 stsp Exp $ */
+/* $OpenBSD: rde_spf.c,v 1.10 2009/03/29 19:34:23 stsp Exp $ */
/*
* Copyright (c) 2005 Esben Norby <norby@openbsd.org>
@@ -1038,7 +1038,7 @@ linked(struct vertex *w, struct vertex *v)
{
struct lsa_rtr_link *rtr_link = NULL;
struct lsa_net_link *net_link = NULL;
- int i;
+ unsigned int i;
switch (w->type) {
case LSA_TYPE_ROUTER:
@@ -1046,18 +1046,16 @@ 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))
+ rtr_link->nbr_rtr_id == htonl(v->adv_rtr))
return (1);
break;
-#endif
case LSA_TYPE_NETWORK:
-#if 0
- if (rtr_link->id == htonl(v->ls_id))
+ if (rtr_link->type == LINK_TYPE_TRANSIT_NET &&
+ rtr_link->nbr_rtr_id == htonl(v->adv_rtr) &&
+ rtr_link->nbr_iface_id == htonl(v->ls_id))
return (1);
break;
-#endif
default:
fatalx("linked: invalid type");
}
@@ -1068,7 +1066,7 @@ linked(struct vertex *w, struct vertex *v)
net_link = get_net_link(w, i);
switch (v->type) {
case LSA_TYPE_ROUTER:
- if (net_link->att_rtr == htonl(v->ls_id))
+ if (net_link->att_rtr == htonl(v->adv_rtr))
return (1);
break;
default: