History log of /openbsd-current/usr.sbin/ospf6d/rde_spf.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.29 08-Mar-2023 guenther

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.28 05-Apr-2020 denis

Handle connected routes as ospfd(8) does.

OK remi@


# 1.27 29-Mar-2020 denis

Rework of rde_asext_get()/rde_asext_put().
Also change get_net_link() and get_rtr_link() to work like ospfd(8)
couterpart.

OK remi@


# 1.26 22-Dec-2019 denis

Rename and move calc_nexthop_clear()/calc_nexthop_add()

OK claudio@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.25 05-Dec-2015 mmcc

strings.h -> string.h to prevent an implicit declaration warning.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.24 18-Sep-2012 bluhm

The if (!better && !equal) check is redundant as the same condition
is checked a few lines below again. Fewer checks make the code
more readable.
ok stsp@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 01-Jul-2010 bluhm

Fix all white space bugs in ospf6d at once. No binary change.
ok claudio@


Revision tags: OPENBSD_4_7_BASE
# 1.22 01-Mar-2010 claudio

Add routing calculation code for AS-ext LSA and Inter-Area LSA but the
latter are not realy tested. AS-ext LSA are now correctly added to the
RIB. "looks like you know what you're doing" stsp@


# 1.21 22-Feb-2010 stsp

Treat multiple Router-LSAs originated by the same router as an
aggregate, as mandated by RFC5340.

OK claudio@


# 1.20 22-Dec-2009 claudio

Crap. Remove debug code that I did not plan to commit.


# 1.19 22-Dec-2009 claudio

Holy inconsitancy Batman! While it is impossible to use embeded scope ids
in almost all sockaddr_in6 addresses it is required for the nexthop and
sin6_scope_id is actually ignored there.
This needs to be fixed but my quota of IPv6 insanity is already used for today.
Workaround for now. My simple testsetup is now actually able to install
the first ospf6d learned routes in the kernel. Weeee!


# 1.18 22-Dec-2009 claudio

Link local addressing strikes again. Include ifindex in all nexthop
definitions so that we have a chance to build a correct nexthop.
Insane that a struct in6_addr is unable to fully specify an IPv6 address.
kroute.c still needs fixing but now the rib is starting to make sense.


# 1.17 22-Dec-2009 claudio

Use correct interface id. iface_id is our ifindex, nbr_iface_id is the
interface id of the remote side. Found the hard way.


# 1.16 22-Dec-2009 claudio

Give calc_nexthop_lladdr() a chance to find the correct link local address.
We need to pass our ifindex so that we can find the Link-LSA that has the
link local address stored for that router. Don't we all like IPv6 link local
addresses and their insanity.


# 1.15 28-Jul-2009 claudio

Install interface addresses of other routers (LA bit set or 128 prefixlen)
as router type and not as a network.
From stsp@


Revision tags: OPENBSD_4_6_BASE
# 1.14 09-Apr-2009 stsp

Update rt_calc() for OSPFv3. The Routing Information Base is being
populated. Intra-area routes only for now.

"I see no obvious issues. Should go in so you can move forward" claudio@


# 1.13 29-Mar-2009 stsp

Update spf_calc() for OSPFv3.

This implements the first stage of the shortest path tree calculation
(Dijkstra calculation) as outlined in rfc5340, with the exception that
we do not yet treat multiple router LSAs originated by a single router
as an agregate. For now, we only use the Router LSA with the lowest link
state ID.

For each destination, show the calculated set of nexthops in the debug log.
We can stop doing this once spf tree calculation has been shown to be stable.

"A lot of debug code but yes why not. commit it." claudio@


# 1.12 29-Mar-2009 stsp

Update calc_nexthop() for OSPFv3, using helper functions added in
last commit. Next hop IP addresses and outgoing interfaces can now
be correctly determined, paving the way for SPF tree calculation.
Arguments have changed, so update callers, too.

ok claudio@


# 1.11 29-Mar-2009 stsp

As a first step towards SPF tree calculation, prepare for proper
next-hop calculation.

In OSPFv3, next-hop IP addresses are always link-local.
The kernel will want to know which interface the link-local
address belongs to, so we need an ifindex in struct v_nexthop
in addition to the IP address.

Because we cannot determine a link-local next hop IP address
for transit networks, only the outgoing interface will be recorded.

Update calc_nexthop_add() according to the above.

Also add new helpers calc_nexthop_lladdr() and calc_nexthop_transit_nbr(),
to figure out link-local addresses of nexthop neighbours.

ok claudio@


# 1.10 29-Mar-2009 stsp

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@


# 1.9 29-Mar-2009 stsp

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@


# 1.8 29-Mar-2009 stsp

Because get_rtr_link() forgot to increment the buffer offset
it was always returning the first link in the LSA, no matter
which link was requested. Fix this bug. Also, decrease the
number of local variables while here, and convert the idx argument
to unsigned int. Adjust one caller to pass an unsigned int,
other callers will be handled in follow-up commits.

ok claudio@


# 1.7 10-Mar-2009 stsp

The linked() function had an identity crisis and referred to itself
as "spf_calc" in fatal error messages.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.6 11-Feb-2008 norby

Correct the output of several error and debug messages.


# 1.5 27-Nov-2007 claudio

Make lsa_find() find link local LSA by passing the interface instead of the
area as lookup point. Additionally make lsa_dump or actually the code around
it pass all LSA to ospf6ctl. The rde_spf.c are not final.


# 1.4 16-Oct-2007 claudio

Oups, unbreak there were some LINK_TYPE_STUB_NET left in the code.


# 1.3 16-Oct-2007 norby

Make ospf6d(8) not throw up on Router LSAs.

Initial step towards actually storing real LSAs.

ok claudio@


# 1.2 16-Oct-2007 claudio

First step at making kroute IPv6 aware. This resulted in many additional
changes -- some are so hairy that I left them out for later by commenting out
larger blocks of code (just grep for XXX if you like to help).
Get it in early so that we can work on.
OK norby@


# 1.1 08-Oct-2007 norby

Welcome ospf6d

The new ospf6d daemon will support OSPFv3, basically OSPF for IPv6 networks.

It is heavily based on ospfd(8), it is more or less a copy and paste of it.
Currently some unneeded stuff has been removed and the trasition from
IPv4 to IPv6 has begun.

ospf6d is not very usefull at the moment, it is being imported to allow more
people to work on it concurrently.

Not yet connected to the builds.

ok claudio@ dlg@


# 1.28 05-Apr-2020 denis

Handle connected routes as ospfd(8) does.

OK remi@


# 1.27 29-Mar-2020 denis

Rework of rde_asext_get()/rde_asext_put().
Also change get_net_link() and get_rtr_link() to work like ospfd(8)
couterpart.

OK remi@


# 1.26 22-Dec-2019 denis

Rename and move calc_nexthop_clear()/calc_nexthop_add()

OK claudio@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.25 05-Dec-2015 mmcc

strings.h -> string.h to prevent an implicit declaration warning.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.24 18-Sep-2012 bluhm

The if (!better && !equal) check is redundant as the same condition
is checked a few lines below again. Fewer checks make the code
more readable.
ok stsp@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 01-Jul-2010 bluhm

Fix all white space bugs in ospf6d at once. No binary change.
ok claudio@


Revision tags: OPENBSD_4_7_BASE
# 1.22 01-Mar-2010 claudio

Add routing calculation code for AS-ext LSA and Inter-Area LSA but the
latter are not realy tested. AS-ext LSA are now correctly added to the
RIB. "looks like you know what you're doing" stsp@


# 1.21 22-Feb-2010 stsp

Treat multiple Router-LSAs originated by the same router as an
aggregate, as mandated by RFC5340.

OK claudio@


# 1.20 22-Dec-2009 claudio

Crap. Remove debug code that I did not plan to commit.


# 1.19 22-Dec-2009 claudio

Holy inconsitancy Batman! While it is impossible to use embeded scope ids
in almost all sockaddr_in6 addresses it is required for the nexthop and
sin6_scope_id is actually ignored there.
This needs to be fixed but my quota of IPv6 insanity is already used for today.
Workaround for now. My simple testsetup is now actually able to install
the first ospf6d learned routes in the kernel. Weeee!


# 1.18 22-Dec-2009 claudio

Link local addressing strikes again. Include ifindex in all nexthop
definitions so that we have a chance to build a correct nexthop.
Insane that a struct in6_addr is unable to fully specify an IPv6 address.
kroute.c still needs fixing but now the rib is starting to make sense.


# 1.17 22-Dec-2009 claudio

Use correct interface id. iface_id is our ifindex, nbr_iface_id is the
interface id of the remote side. Found the hard way.


# 1.16 22-Dec-2009 claudio

Give calc_nexthop_lladdr() a chance to find the correct link local address.
We need to pass our ifindex so that we can find the Link-LSA that has the
link local address stored for that router. Don't we all like IPv6 link local
addresses and their insanity.


# 1.15 28-Jul-2009 claudio

Install interface addresses of other routers (LA bit set or 128 prefixlen)
as router type and not as a network.
From stsp@


Revision tags: OPENBSD_4_6_BASE
# 1.14 09-Apr-2009 stsp

Update rt_calc() for OSPFv3. The Routing Information Base is being
populated. Intra-area routes only for now.

"I see no obvious issues. Should go in so you can move forward" claudio@


# 1.13 29-Mar-2009 stsp

Update spf_calc() for OSPFv3.

This implements the first stage of the shortest path tree calculation
(Dijkstra calculation) as outlined in rfc5340, with the exception that
we do not yet treat multiple router LSAs originated by a single router
as an agregate. For now, we only use the Router LSA with the lowest link
state ID.

For each destination, show the calculated set of nexthops in the debug log.
We can stop doing this once spf tree calculation has been shown to be stable.

"A lot of debug code but yes why not. commit it." claudio@


# 1.12 29-Mar-2009 stsp

Update calc_nexthop() for OSPFv3, using helper functions added in
last commit. Next hop IP addresses and outgoing interfaces can now
be correctly determined, paving the way for SPF tree calculation.
Arguments have changed, so update callers, too.

ok claudio@


# 1.11 29-Mar-2009 stsp

As a first step towards SPF tree calculation, prepare for proper
next-hop calculation.

In OSPFv3, next-hop IP addresses are always link-local.
The kernel will want to know which interface the link-local
address belongs to, so we need an ifindex in struct v_nexthop
in addition to the IP address.

Because we cannot determine a link-local next hop IP address
for transit networks, only the outgoing interface will be recorded.

Update calc_nexthop_add() according to the above.

Also add new helpers calc_nexthop_lladdr() and calc_nexthop_transit_nbr(),
to figure out link-local addresses of nexthop neighbours.

ok claudio@


# 1.10 29-Mar-2009 stsp

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@


# 1.9 29-Mar-2009 stsp

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@


# 1.8 29-Mar-2009 stsp

Because get_rtr_link() forgot to increment the buffer offset
it was always returning the first link in the LSA, no matter
which link was requested. Fix this bug. Also, decrease the
number of local variables while here, and convert the idx argument
to unsigned int. Adjust one caller to pass an unsigned int,
other callers will be handled in follow-up commits.

ok claudio@


# 1.7 10-Mar-2009 stsp

The linked() function had an identity crisis and referred to itself
as "spf_calc" in fatal error messages.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.6 11-Feb-2008 norby

Correct the output of several error and debug messages.


# 1.5 27-Nov-2007 claudio

Make lsa_find() find link local LSA by passing the interface instead of the
area as lookup point. Additionally make lsa_dump or actually the code around
it pass all LSA to ospf6ctl. The rde_spf.c are not final.


# 1.4 16-Oct-2007 claudio

Oups, unbreak there were some LINK_TYPE_STUB_NET left in the code.


# 1.3 16-Oct-2007 norby

Make ospf6d(8) not throw up on Router LSAs.

Initial step towards actually storing real LSAs.

ok claudio@


# 1.2 16-Oct-2007 claudio

First step at making kroute IPv6 aware. This resulted in many additional
changes -- some are so hairy that I left them out for later by commenting out
larger blocks of code (just grep for XXX if you like to help).
Get it in early so that we can work on.
OK norby@


# 1.1 08-Oct-2007 norby

Welcome ospf6d

The new ospf6d daemon will support OSPFv3, basically OSPF for IPv6 networks.

It is heavily based on ospfd(8), it is more or less a copy and paste of it.
Currently some unneeded stuff has been removed and the trasition from
IPv4 to IPv6 has begun.

ospf6d is not very usefull at the moment, it is being imported to allow more
people to work on it concurrently.

Not yet connected to the builds.

ok claudio@ dlg@


# 1.27 29-Mar-2020 denis

Rework of rde_asext_get()/rde_asext_put().
Also change get_net_link() and get_rtr_link() to work like ospfd(8)
couterpart.

OK remi@


# 1.26 22-Dec-2019 denis

Rename and move calc_nexthop_clear()/calc_nexthop_add()

OK claudio@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.25 05-Dec-2015 mmcc

strings.h -> string.h to prevent an implicit declaration warning.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.24 18-Sep-2012 bluhm

The if (!better && !equal) check is redundant as the same condition
is checked a few lines below again. Fewer checks make the code
more readable.
ok stsp@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 01-Jul-2010 bluhm

Fix all white space bugs in ospf6d at once. No binary change.
ok claudio@


Revision tags: OPENBSD_4_7_BASE
# 1.22 01-Mar-2010 claudio

Add routing calculation code for AS-ext LSA and Inter-Area LSA but the
latter are not realy tested. AS-ext LSA are now correctly added to the
RIB. "looks like you know what you're doing" stsp@


# 1.21 22-Feb-2010 stsp

Treat multiple Router-LSAs originated by the same router as an
aggregate, as mandated by RFC5340.

OK claudio@


# 1.20 22-Dec-2009 claudio

Crap. Remove debug code that I did not plan to commit.


# 1.19 22-Dec-2009 claudio

Holy inconsitancy Batman! While it is impossible to use embeded scope ids
in almost all sockaddr_in6 addresses it is required for the nexthop and
sin6_scope_id is actually ignored there.
This needs to be fixed but my quota of IPv6 insanity is already used for today.
Workaround for now. My simple testsetup is now actually able to install
the first ospf6d learned routes in the kernel. Weeee!


# 1.18 22-Dec-2009 claudio

Link local addressing strikes again. Include ifindex in all nexthop
definitions so that we have a chance to build a correct nexthop.
Insane that a struct in6_addr is unable to fully specify an IPv6 address.
kroute.c still needs fixing but now the rib is starting to make sense.


# 1.17 22-Dec-2009 claudio

Use correct interface id. iface_id is our ifindex, nbr_iface_id is the
interface id of the remote side. Found the hard way.


# 1.16 22-Dec-2009 claudio

Give calc_nexthop_lladdr() a chance to find the correct link local address.
We need to pass our ifindex so that we can find the Link-LSA that has the
link local address stored for that router. Don't we all like IPv6 link local
addresses and their insanity.


# 1.15 28-Jul-2009 claudio

Install interface addresses of other routers (LA bit set or 128 prefixlen)
as router type and not as a network.
From stsp@


Revision tags: OPENBSD_4_6_BASE
# 1.14 09-Apr-2009 stsp

Update rt_calc() for OSPFv3. The Routing Information Base is being
populated. Intra-area routes only for now.

"I see no obvious issues. Should go in so you can move forward" claudio@


# 1.13 29-Mar-2009 stsp

Update spf_calc() for OSPFv3.

This implements the first stage of the shortest path tree calculation
(Dijkstra calculation) as outlined in rfc5340, with the exception that
we do not yet treat multiple router LSAs originated by a single router
as an agregate. For now, we only use the Router LSA with the lowest link
state ID.

For each destination, show the calculated set of nexthops in the debug log.
We can stop doing this once spf tree calculation has been shown to be stable.

"A lot of debug code but yes why not. commit it." claudio@


# 1.12 29-Mar-2009 stsp

Update calc_nexthop() for OSPFv3, using helper functions added in
last commit. Next hop IP addresses and outgoing interfaces can now
be correctly determined, paving the way for SPF tree calculation.
Arguments have changed, so update callers, too.

ok claudio@


# 1.11 29-Mar-2009 stsp

As a first step towards SPF tree calculation, prepare for proper
next-hop calculation.

In OSPFv3, next-hop IP addresses are always link-local.
The kernel will want to know which interface the link-local
address belongs to, so we need an ifindex in struct v_nexthop
in addition to the IP address.

Because we cannot determine a link-local next hop IP address
for transit networks, only the outgoing interface will be recorded.

Update calc_nexthop_add() according to the above.

Also add new helpers calc_nexthop_lladdr() and calc_nexthop_transit_nbr(),
to figure out link-local addresses of nexthop neighbours.

ok claudio@


# 1.10 29-Mar-2009 stsp

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@


# 1.9 29-Mar-2009 stsp

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@


# 1.8 29-Mar-2009 stsp

Because get_rtr_link() forgot to increment the buffer offset
it was always returning the first link in the LSA, no matter
which link was requested. Fix this bug. Also, decrease the
number of local variables while here, and convert the idx argument
to unsigned int. Adjust one caller to pass an unsigned int,
other callers will be handled in follow-up commits.

ok claudio@


# 1.7 10-Mar-2009 stsp

The linked() function had an identity crisis and referred to itself
as "spf_calc" in fatal error messages.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.6 11-Feb-2008 norby

Correct the output of several error and debug messages.


# 1.5 27-Nov-2007 claudio

Make lsa_find() find link local LSA by passing the interface instead of the
area as lookup point. Additionally make lsa_dump or actually the code around
it pass all LSA to ospf6ctl. The rde_spf.c are not final.


# 1.4 16-Oct-2007 claudio

Oups, unbreak there were some LINK_TYPE_STUB_NET left in the code.


# 1.3 16-Oct-2007 norby

Make ospf6d(8) not throw up on Router LSAs.

Initial step towards actually storing real LSAs.

ok claudio@


# 1.2 16-Oct-2007 claudio

First step at making kroute IPv6 aware. This resulted in many additional
changes -- some are so hairy that I left them out for later by commenting out
larger blocks of code (just grep for XXX if you like to help).
Get it in early so that we can work on.
OK norby@


# 1.1 08-Oct-2007 norby

Welcome ospf6d

The new ospf6d daemon will support OSPFv3, basically OSPF for IPv6 networks.

It is heavily based on ospfd(8), it is more or less a copy and paste of it.
Currently some unneeded stuff has been removed and the trasition from
IPv4 to IPv6 has begun.

ospf6d is not very usefull at the moment, it is being imported to allow more
people to work on it concurrently.

Not yet connected to the builds.

ok claudio@ dlg@


# 1.26 22-Dec-2019 denis

Rename and move calc_nexthop_clear()/calc_nexthop_add()

OK claudio@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.25 05-Dec-2015 mmcc

strings.h -> string.h to prevent an implicit declaration warning.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.24 18-Sep-2012 bluhm

The if (!better && !equal) check is redundant as the same condition
is checked a few lines below again. Fewer checks make the code
more readable.
ok stsp@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 01-Jul-2010 bluhm

Fix all white space bugs in ospf6d at once. No binary change.
ok claudio@


Revision tags: OPENBSD_4_7_BASE
# 1.22 01-Mar-2010 claudio

Add routing calculation code for AS-ext LSA and Inter-Area LSA but the
latter are not realy tested. AS-ext LSA are now correctly added to the
RIB. "looks like you know what you're doing" stsp@


# 1.21 22-Feb-2010 stsp

Treat multiple Router-LSAs originated by the same router as an
aggregate, as mandated by RFC5340.

OK claudio@


# 1.20 22-Dec-2009 claudio

Crap. Remove debug code that I did not plan to commit.


# 1.19 22-Dec-2009 claudio

Holy inconsitancy Batman! While it is impossible to use embeded scope ids
in almost all sockaddr_in6 addresses it is required for the nexthop and
sin6_scope_id is actually ignored there.
This needs to be fixed but my quota of IPv6 insanity is already used for today.
Workaround for now. My simple testsetup is now actually able to install
the first ospf6d learned routes in the kernel. Weeee!


# 1.18 22-Dec-2009 claudio

Link local addressing strikes again. Include ifindex in all nexthop
definitions so that we have a chance to build a correct nexthop.
Insane that a struct in6_addr is unable to fully specify an IPv6 address.
kroute.c still needs fixing but now the rib is starting to make sense.


# 1.17 22-Dec-2009 claudio

Use correct interface id. iface_id is our ifindex, nbr_iface_id is the
interface id of the remote side. Found the hard way.


# 1.16 22-Dec-2009 claudio

Give calc_nexthop_lladdr() a chance to find the correct link local address.
We need to pass our ifindex so that we can find the Link-LSA that has the
link local address stored for that router. Don't we all like IPv6 link local
addresses and their insanity.


# 1.15 28-Jul-2009 claudio

Install interface addresses of other routers (LA bit set or 128 prefixlen)
as router type and not as a network.
From stsp@


Revision tags: OPENBSD_4_6_BASE
# 1.14 09-Apr-2009 stsp

Update rt_calc() for OSPFv3. The Routing Information Base is being
populated. Intra-area routes only for now.

"I see no obvious issues. Should go in so you can move forward" claudio@


# 1.13 29-Mar-2009 stsp

Update spf_calc() for OSPFv3.

This implements the first stage of the shortest path tree calculation
(Dijkstra calculation) as outlined in rfc5340, with the exception that
we do not yet treat multiple router LSAs originated by a single router
as an agregate. For now, we only use the Router LSA with the lowest link
state ID.

For each destination, show the calculated set of nexthops in the debug log.
We can stop doing this once spf tree calculation has been shown to be stable.

"A lot of debug code but yes why not. commit it." claudio@


# 1.12 29-Mar-2009 stsp

Update calc_nexthop() for OSPFv3, using helper functions added in
last commit. Next hop IP addresses and outgoing interfaces can now
be correctly determined, paving the way for SPF tree calculation.
Arguments have changed, so update callers, too.

ok claudio@


# 1.11 29-Mar-2009 stsp

As a first step towards SPF tree calculation, prepare for proper
next-hop calculation.

In OSPFv3, next-hop IP addresses are always link-local.
The kernel will want to know which interface the link-local
address belongs to, so we need an ifindex in struct v_nexthop
in addition to the IP address.

Because we cannot determine a link-local next hop IP address
for transit networks, only the outgoing interface will be recorded.

Update calc_nexthop_add() according to the above.

Also add new helpers calc_nexthop_lladdr() and calc_nexthop_transit_nbr(),
to figure out link-local addresses of nexthop neighbours.

ok claudio@


# 1.10 29-Mar-2009 stsp

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@


# 1.9 29-Mar-2009 stsp

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@


# 1.8 29-Mar-2009 stsp

Because get_rtr_link() forgot to increment the buffer offset
it was always returning the first link in the LSA, no matter
which link was requested. Fix this bug. Also, decrease the
number of local variables while here, and convert the idx argument
to unsigned int. Adjust one caller to pass an unsigned int,
other callers will be handled in follow-up commits.

ok claudio@


# 1.7 10-Mar-2009 stsp

The linked() function had an identity crisis and referred to itself
as "spf_calc" in fatal error messages.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.6 11-Feb-2008 norby

Correct the output of several error and debug messages.


# 1.5 27-Nov-2007 claudio

Make lsa_find() find link local LSA by passing the interface instead of the
area as lookup point. Additionally make lsa_dump or actually the code around
it pass all LSA to ospf6ctl. The rde_spf.c are not final.


# 1.4 16-Oct-2007 claudio

Oups, unbreak there were some LINK_TYPE_STUB_NET left in the code.


# 1.3 16-Oct-2007 norby

Make ospf6d(8) not throw up on Router LSAs.

Initial step towards actually storing real LSAs.

ok claudio@


# 1.2 16-Oct-2007 claudio

First step at making kroute IPv6 aware. This resulted in many additional
changes -- some are so hairy that I left them out for later by commenting out
larger blocks of code (just grep for XXX if you like to help).
Get it in early so that we can work on.
OK norby@


# 1.1 08-Oct-2007 norby

Welcome ospf6d

The new ospf6d daemon will support OSPFv3, basically OSPF for IPv6 networks.

It is heavily based on ospfd(8), it is more or less a copy and paste of it.
Currently some unneeded stuff has been removed and the trasition from
IPv4 to IPv6 has begun.

ospf6d is not very usefull at the moment, it is being imported to allow more
people to work on it concurrently.

Not yet connected to the builds.

ok claudio@ dlg@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.25 05-Dec-2015 mmcc

strings.h -> string.h to prevent an implicit declaration warning.


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.24 18-Sep-2012 bluhm

The if (!better && !equal) check is redundant as the same condition
is checked a few lines below again. Fewer checks make the code
more readable.
ok stsp@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 01-Jul-2010 bluhm

Fix all white space bugs in ospf6d at once. No binary change.
ok claudio@


Revision tags: OPENBSD_4_7_BASE
# 1.22 01-Mar-2010 claudio

Add routing calculation code for AS-ext LSA and Inter-Area LSA but the
latter are not realy tested. AS-ext LSA are now correctly added to the
RIB. "looks like you know what you're doing" stsp@


# 1.21 22-Feb-2010 stsp

Treat multiple Router-LSAs originated by the same router as an
aggregate, as mandated by RFC5340.

OK claudio@


# 1.20 22-Dec-2009 claudio

Crap. Remove debug code that I did not plan to commit.


# 1.19 22-Dec-2009 claudio

Holy inconsitancy Batman! While it is impossible to use embeded scope ids
in almost all sockaddr_in6 addresses it is required for the nexthop and
sin6_scope_id is actually ignored there.
This needs to be fixed but my quota of IPv6 insanity is already used for today.
Workaround for now. My simple testsetup is now actually able to install
the first ospf6d learned routes in the kernel. Weeee!


# 1.18 22-Dec-2009 claudio

Link local addressing strikes again. Include ifindex in all nexthop
definitions so that we have a chance to build a correct nexthop.
Insane that a struct in6_addr is unable to fully specify an IPv6 address.
kroute.c still needs fixing but now the rib is starting to make sense.


# 1.17 22-Dec-2009 claudio

Use correct interface id. iface_id is our ifindex, nbr_iface_id is the
interface id of the remote side. Found the hard way.


# 1.16 22-Dec-2009 claudio

Give calc_nexthop_lladdr() a chance to find the correct link local address.
We need to pass our ifindex so that we can find the Link-LSA that has the
link local address stored for that router. Don't we all like IPv6 link local
addresses and their insanity.


# 1.15 28-Jul-2009 claudio

Install interface addresses of other routers (LA bit set or 128 prefixlen)
as router type and not as a network.
From stsp@


Revision tags: OPENBSD_4_6_BASE
# 1.14 09-Apr-2009 stsp

Update rt_calc() for OSPFv3. The Routing Information Base is being
populated. Intra-area routes only for now.

"I see no obvious issues. Should go in so you can move forward" claudio@


# 1.13 29-Mar-2009 stsp

Update spf_calc() for OSPFv3.

This implements the first stage of the shortest path tree calculation
(Dijkstra calculation) as outlined in rfc5340, with the exception that
we do not yet treat multiple router LSAs originated by a single router
as an agregate. For now, we only use the Router LSA with the lowest link
state ID.

For each destination, show the calculated set of nexthops in the debug log.
We can stop doing this once spf tree calculation has been shown to be stable.

"A lot of debug code but yes why not. commit it." claudio@


# 1.12 29-Mar-2009 stsp

Update calc_nexthop() for OSPFv3, using helper functions added in
last commit. Next hop IP addresses and outgoing interfaces can now
be correctly determined, paving the way for SPF tree calculation.
Arguments have changed, so update callers, too.

ok claudio@


# 1.11 29-Mar-2009 stsp

As a first step towards SPF tree calculation, prepare for proper
next-hop calculation.

In OSPFv3, next-hop IP addresses are always link-local.
The kernel will want to know which interface the link-local
address belongs to, so we need an ifindex in struct v_nexthop
in addition to the IP address.

Because we cannot determine a link-local next hop IP address
for transit networks, only the outgoing interface will be recorded.

Update calc_nexthop_add() according to the above.

Also add new helpers calc_nexthop_lladdr() and calc_nexthop_transit_nbr(),
to figure out link-local addresses of nexthop neighbours.

ok claudio@


# 1.10 29-Mar-2009 stsp

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@


# 1.9 29-Mar-2009 stsp

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@


# 1.8 29-Mar-2009 stsp

Because get_rtr_link() forgot to increment the buffer offset
it was always returning the first link in the LSA, no matter
which link was requested. Fix this bug. Also, decrease the
number of local variables while here, and convert the idx argument
to unsigned int. Adjust one caller to pass an unsigned int,
other callers will be handled in follow-up commits.

ok claudio@


# 1.7 10-Mar-2009 stsp

The linked() function had an identity crisis and referred to itself
as "spf_calc" in fatal error messages.


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE
# 1.6 11-Feb-2008 norby

Correct the output of several error and debug messages.


# 1.5 27-Nov-2007 claudio

Make lsa_find() find link local LSA by passing the interface instead of the
area as lookup point. Additionally make lsa_dump or actually the code around
it pass all LSA to ospf6ctl. The rde_spf.c are not final.


# 1.4 16-Oct-2007 claudio

Oups, unbreak there were some LINK_TYPE_STUB_NET left in the code.


# 1.3 16-Oct-2007 norby

Make ospf6d(8) not throw up on Router LSAs.

Initial step towards actually storing real LSAs.

ok claudio@


# 1.2 16-Oct-2007 claudio

First step at making kroute IPv6 aware. This resulted in many additional
changes -- some are so hairy that I left them out for later by commenting out
larger blocks of code (just grep for XXX if you like to help).
Get it in early so that we can work on.
OK norby@


# 1.1 08-Oct-2007 norby

Welcome ospf6d

The new ospf6d daemon will support OSPFv3, basically OSPF for IPv6 networks.

It is heavily based on ospfd(8), it is more or less a copy and paste of it.
Currently some unneeded stuff has been removed and the trasition from
IPv4 to IPv6 has begun.

ospf6d is not very usefull at the moment, it is being imported to allow more
people to work on it concurrently.

Not yet connected to the builds.

ok claudio@ dlg@