#
# $XORP: xorp/ospf/TODO,v 1.68 2006/03/10 03:33:28 atanu Exp $
#

TODO
~~~~

1) None of the packet decode routines check the type field in the header
against their own type field. Could probably put the approriate check
in the standard header decode code.

2) I don't think that the LSA routines check their own type field either.

7) Can an interface a peer in our code have more than one subnet
associated with it?

16) A data description packet carries a number of LSA headers. There
is a count in the packet of the number of LSA header. We don't store
this information as its unnecessary. Need to verify that we actually
write this information out when encoding a packet. Should perhaps also
check it on input rather than just stepping over it.

17) When decoding a link state update packet if an LSA is not
decodable either due to being an unknown type or some other problem
the whole packet is discarded. Only the bad LSA should be dropped. See
section 13 of the RFC.

19) The delayed ACKs are not delayed. The peer should probably hold a
delayed ack list that is transmitted ocassionally.

26) send_lsa() has not been tested.

27) update_router_linksV2(), the DR_other case looks bogus.

28) An LSA can be looked up by type,id and advertising router
(find_lsa()). In an exception to this Network-LSAs can be looked up by
id only (find_network_lsa()). The two lookups are currently linear
scans of the database. Add a map for each lookup type to speed up
lookup.

29) In xrl_target.cc calls are made directly to the peer_manager,
equivalent calls exist in the ospf class and should be used in
preference.

30) It is a requirement that LSAs should not be originated more
frequently than MinLSInterval (5 seconds). It is also a requirement
that an LSA is not accepted if it arrives more frequently than
MinLSArrival (1 second). Generated LSAs are added to the delay queue
in the area_router. If an LSA arrives more frequently than 1 second it
is ignored. When as part of the database exchange process an LSA is
requested it is returned immediately (not delayed by 5 seconds). As
soon as routers become adjacent a new Router-LSA is generated. This
Router-LSA is ignored because in the regression tests it typically
arrives before 1 second. The retransmission of the Router-LSA
eventually fixes the problem. We should probably delay the sending of
the Router-LSA somehow after an adjacency is formed. Adding a
timestamp to LSAs could be used to stop this problem or the delay
queue could be prodded when a self originated LSA is requested. We
could also perhaps be a little more permissive about the first LSA
that violates the 1 second rule.

This problem has been partially fixes by firing the delay timer when a
self originating LSA is requested in a link state request packet.

31) AS-External-Lsa.
It is possible that when addresses are being read in with copy_in that
network byte order issues are not being correctly handled. 

32) The IP checksum is consistently mis-used through the code. To fix
this problem the checksum is returned byte-swapped. Fix the code to
deal with the checksum correctly.

34) When the code was originally written the interface manager was not
hooked into the code. Which meant that the prefix length and MTU had
to be passed in from the config file. These values are still passed in
but ignored. Starting from the XRLs go through and remove the passing
of the prefix length and MTU.

36) There is a queue to which route adds and deletes are added. The
queue does not handle replace or discard routes. Plus policy tags
should be passed in somehow.

37) The original design did not leave MaxAge LSAs in the
database. When an LSA reached MaxAge it was removed from the database
and existed only in retransmission lists. If an LSA was received which
seemed to be from a previous incarnation of OSPF it had its age set to
MaxAge and was fired out, also not being added to the database.  If
while a MaxAge LSA is on the retransmission only, either a new LSA
such as a Network-LSA is generated or an updated LSA arrives a second
LSA can be created with the same <Type,ID,ADV> tuple. Two LSAs can
exist on the retransmission list. Leaving the a MaxAge LSA in the
database solves both problems but doesn't deal with when to purge the
LSA. The indicator that an LSA can be purged is when its NACK list
becomes empty.

Currently the MaxAge LSAs are purged in valid_entry_database() this
method is called to build the list of LSAs during database exchange.

Remove the purge code from valid_entry_database() make it and
subsequent() const again. When a MaxAge LSA is removed from the
retransmission list and the NACK list becomes empty have it callback
to the area code from the peer code to remove the LSA from the
database. One possible implementation is to actually put a callback in
the LSA itself that the peer code invokes.

If MAX_AGE_IN_DATABASE in database is not defined then a check is now
made for the duplicate LSA in the retransmission list.

It might be appropriate to leave MaxAge LSAs on the retransmission list.

If this fix works then do away with MAX_AGE_IN_DATABASE.

40) When the adding of routes is more robust change the XLOG_ERROR to
an XLOG_FATAL in route_command_done().

44) The packet header encode and decode routines should use AUTH_* consts
not hard coded numbers.

47) During shutdown the method PeerManager<A>::virtual_link_endpoint
gets called. The vlink database has knowledge of a peer that has been
removed and a warning is printed. Modify the code to remove peerids
from the vlink database when a peer is removed.

48) If the user disables an address that OSPF is using via the xorpsh
then the interface/peer is taken down. Part of the interface down
process involves leaving multicast groups. When leaving a multicast
group in IPv4 the interface address is used as the key to the
kernel. Disabling an address via the xorpsh removes the address from
the kernel the subsequent attempt to leave the multicast group fails
generating an error. OSPF in the IPv4 case should check if the address
(key) is still enabled before attempting to leave a group.

49) When a policy is modified OSPF receives a push_routes call. All
routes that are sent to the RIB are re-filtered, the import policies.

The routes that are introduced to OSPF via an export policy are
currently not re-filtered. A method External<A>::push_routes() exists
but currently does nothing. If the "then" part of an export policy is
changed such as setting the nexthop, or the ebit or the tag. The route
is currently pushed through the system again so the filter can be
re-run. Currently no functionality seems to be lost by not
implementing this method, as the routes are always pushed through the
system anyway. For completeness the method should be implemented for
the day that a policy change does not force all routes back through
the system.

In order to implement the push_routes the network, nexthop, metric and
possibly policytags must be saved in a separate list, Or the
AS-External-LSA could be augmented to hold the original values.

50) When computing transit area routes, routes can only be installed
if a backbone or inter area route exists. If a better route is found
the cost and nexthop of the original route are overriden. Thus when
the orignal route is withdrawn the lower cost route will be
automatically withdrawn. To make sure the transit route will be
re-applied *temporarily* whenever a routing computation happens on the
backbone all other areas also have routing computations run. The
recomputation should only occur if the other areas are actually
transit areas. Even better the internal routing entry code could be
taught about this type of transit derived route.
  
Possible issues
~~~~~~~~~~~~~~~

1) Received hello packets are demultiplex on the source address of the
packet or on the router ID, depending on the linktype that the packet
arrived on. If a packet is being demultipled on the source address and
the router ID changes is this likely to be a problem?

2) In the OSPFv2 case when generating router links the state backup is
treated the same as DR_other, which generates links. Previously the
backup state generated no links. In the OSPFv3 case in state backup we
generate no links. Its not clear what the correct behaviour should be.

3) All LSAs carried in Link State Update Packets now have
InfTransDelay added to them. InfTransDelay is being added to self
originated LSAs as well is this correct?

4) The Network-LSAs are not explicitly stored in the area router. It
*may* improve performance to store a reference to any Network-LSAs in
the PeerState data structure.

5) The set_maxage() method on an LSA sets the age to MaxAge. It does
not however manipulate the origination time. Therefore any subsequent
erroneous calls to update_age() may revive an LSA. It may be safer to
hold a separate flag in an LSA to stop the age being updated once it
has been set to MaxAge.

Done
~~~~

3) The Network Mask field in OSPFv2 hello packets currently we seem to
be setting an index not a mask, check the spec to see what we should
be doing.

[This field is a mask and the code treats it as an opaque
quantity. The test code treats it as a mask]

4) The LsaDecoder should have a method that can be used to check if LS
types are valid. This method should be used by data_description_received.

[DONE]

5) Are external-LSAs allowed in NSSAs?

[NO]

13) Provide a mechanism to set the interface prefix length. Checkout
get_interface_prefix_length().

[DONE]

14) Provide a mechanism to set the interface cost. Checkout
get_interface_cost().

[DONE]

15) I think the age needs to have the link cost added to it as well as
updating the time.

[Done. When marshaling a link state update packet InfTransDelay is
added to the age field of each LSA that is being carried].

8) Constructor for the AreaRouter should take all the information to
fill in the Router LSA.

[Wrong]

20) Virtual links are currently handled incorrectly. Peers/interfaces
are typed (BROADCAST, NBMA, PointToMultiPoint, PointToPoint, and
VirtualLink). A Virtual Link should be an attribute of the Neighbour
structure any type of interface can also have neighbours of virtual
links (except PointToPoint). A simple way of handling the problem
would be have the neighbour hold its own copy of the linktype which
could include VirtualLink. Never allow peer to be created with a
linktype of Virtual link.

[DONE]

10) Section 3.3 Classification of routers. Add an OSPF enumeration for the
four classifications. Note that the classifications are
overlapping. Add four predicate methods to the peer manager that will
return the status of the router. For example if the router is only
configured with one area internal_router_p will return true.

[DONE]

9) Figure out under what conditions the E-bit should be set.

[When the router is an AS boundary router]

23) In peer.cc "_peer.schedule_event("BackupSeen")" is an event that
is not understood by process_scheduled_events().

[DONE]

24) Move is_DR(), is_BDR(), is_DR_or_BDR() and possibly
is_neighbour_DR_or_BDR() to the Peer from the Neighbour class.

[DONE]

33) The sequence number reaching OspfTypes:: MaxSequenceNumber is not
dealt with gracefully. If will take 680 years for this condition to be
hit.

[DONE]

12) Point 2 Point and Point 2 Multipoint.
When coding this we will need to be told neigbour addresses. When we
are told them just create the neighbour structures and we should be
done. Need to be careful that we don't destroy the neighbour
structures when the timers expire.

[DONE]

18) The peer manager has a method that tests an address against
interface addresses. At the moment it checks against configured
interfaces. When the fea client interface watcher is linked in we
should get this information from the FEA.

[DONE]

21) When the support for Virtual links is added make sure the RFC 2328
secction 8.2, receiving protocol packets covers the virtual link
backbone checks.

[DONE]

22) Perform authentication.

[DONE]

25) A neighbour should only be listed in a hello packet if a hello
packet has been seen from it in the last RouterDeadInterval seconds.

[DONE]

35) OSPF is seeing its own multicast packets. When this happens an
error message is printed. Until this is fixed in the FEA the code has
a new trace variable trace._input_errors_that_happen that is set to false.
As soon as its fixed remove this trace variable.

[DONE]

38) The debug IO subsytem should store all the routes which are sent
to it. Thus allowing the regression tests to check the table at the
end of a run.

[DONE]

42) An entry point "PeerManager<A>::refresh_router_lsas()" exists that
is used to cause all area to send out a new Router-LSA. This entry
points exist so that flag transitions between area border, AS boundary
and virtual link endpoint can be immediately distributed in the form a
a new Router-LSA. When support for virtual links are added this hook
should be called.

[DONE]

45) The cryptographic authentication does not support configuring the
Key ID (currently defaults to 1) or timer values for smooth key
transitions.

[DONE]

46) Replace class Subsystem with class ServiceBase.

[DONE]

39) The code that processes AS-External-LSAs will need to be
re-examined when multiple areas are fully supported.

[DONE]

41) While adding support for multiple areas created an abstract class
Subsystem that includes start() and shutdown() methods. It should be
possible to enhance this class to allow clean shutdown. Both total
shutdown and the removal of a single area. That is withdraw all
announced LSAs before shutting down. The peer manager currently calls
shutdown on the an area then proceeds to delete the area. It might be
cleaner to wait for the area to signal that shutdown is complete,
either by polling running() or by waiting for the shutdown_complete().

[Switched to using ServiceBase that already existed]

43) Changing the type of an area currently has no effect. The only way
to change an area type is to save and reload the config.

[DONE]

