The OSPF6_INTERFACE_LOOPBACK interface state wasn't entered anywhere,
even if the interface was OSPF6_IFTYPE_LOOPBACK. Fix.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
There's a delay in FreeBSD between issuing a command to leave a
multicast group and an actual leave. If we execute "no router ospf6" and
"router ospf6" fast enough, we can end up in a situation when OS
performs the leave later than it performs the join and the interface
remains without a multicast group.
Instead of counting on a one second delay, we must wait until the
interface actually leaves the group.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Adding the "clear ipv6 ospf6 command" . It resets
the ospfv3 datastructures and clears the database
as well as route tables. It resets the neighborship
by restarting the interface state machine.
If the user wants to change the router-id, this
command updates the router-id to the latest static
router-id and starts the neighbor formation with
the new router-id.
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Problem Statement:
=================
When show ipv6 ospf6 neighbor is executed each neighbor gets
displayed twice.
frr# show ipv6 ospf6 neighbor
Neighbor ID Pri DeadTime State/IfState Duration I/F[State]
1.1.1.1 1 00:00:39 Full/DR 00:00:10 ens192[BDR]
1.1.1.1 1 00:00:39 Full/DR 00:00:10 ens192[BDR]
RCA:
====
Since ospf6_interface gets added twice to if_list we see multiple
display output.
Fix:
====
add ospf6_interface to if_list only when newly area gets attached
to the interface. If its already added no need to add it again.
Risk:
=====
Low
Tests Executed:
===============
Have tested the defect scenario.
frr# show ipv6 ospf6 neighbor
Neighbor ID Pri DeadTime State/IfState Duration I/F[State]
1.1.1.1 1 00:00:35 Full/DR 00:36:04 ens192[BDR]
frr#
Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
allow amount of work done by read and write threads in a single
invocation to be tuned to between 1 and 100 packets (default 20)
Signed-off-by: Pat Ruddy <pat@voltanet.io>
Add per interface fifo and per instance write list as a precursor
to implementing fairer sharing of the ospf6 oscket resources.
Signed-off-by: Pat Ruddy <pat@voltanet.io>
The logging in ospf6 is very verbose. If you turn on logging on a scaled
system you get too many logs. The problem is that there are some errors
that occur that are hidden behind the debug flags, and to see these errors
we currently need to turn on the debug logging. This change converts these
error logs to warnings and removes the debug flags.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Some wires got crossed during a couple merges using/changing
this function.
Update it to its new name.
Signed-off-by: Stephen Worley <sworley@nvidia.com>
Currently the interface area is configured from the router node using
"interface IFNAME area ID" command. There are multiple problems with
this command:
- it is not in line with all other interface-related commands - other
parameters are configured from the interface node using "ipv6 ospf6"
prefix
- it is not in line with OSPFv2 - area is configured from the interface
node using "ip ospf area" command
- most importantly, it doesn't work correctly when the interface is in
a different VRF - instead of configuring the interface, it creates a
new fake interface and configuring it instead
To fix all the problems, this commit adds a new command to the interface
configuration node - "ipv6 ospf6 area ID". The purpose of the command is
completely the same, but it works correctly in a multi-VRF environment.
The old command is preserved for the backward compatibility, but the
warning is added that it is deprecated because it doesn't work correctly
with VRFs.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
The following is implemented.
1. Configuring area as NSSA.
2. Generating Type 7 LSA.
3. Conversion of Type 7 to Type 5 ( Default Behavior).
4. NSSA ABR selection.
Reviewed-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Co-authored-by: Kaushik <kaushiknath.null@gmail.com>
Co-authored-by: Soman K.S <somanks@gmail.com>
Signed-off-by: Kaushik <kaushiknath.null@gmail.com>
OSPF6 instance may not exist when processing interface state change.
Do not execute processing steps that require an instance if an area is
not configured for an interface.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
The code had no limits on addresses configured on an interface running
ospf6d. The code would crash when more than 100 addresses were added.
This change limits the number of interface address to 100 if mtu is set
to the default value. If the mtu is set to a jumbo packet size or larger
we will support 200 interface addresses.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
As per the ospfv3 conformance test 24.3
SETUP: Configure DIface-0 with priority set to <hprty>.
ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0.
DUT: Exchange all the <OSPF-DD> packets, during adjacency establish- ment.
ANVL: Verify that the received <OSPF-DD> packets contain: • one header of Link-LSA, originated by DUT.
ANVL: Send <OSPF-LSR> packet from neighbor Rtr-0-A to DIface-0 con- taining:
• One Request Tuple for Link-LSA originated by DUT.
ANVL: Listen (for upto 2 * <RxmtInterval> seconds) on DIface-0. DUT: Send <OSPF-LSU> packet.
ANVL: Verify that the received <OSPF-LSU> packet contains:
• •
one Link-LSA, originated by DUT, contains: Rtr Pri field set to <hprty>.
----------
When interface priority is changed Link LSAs should be tranmitted
with the priority set.
When the link priorty chanages, the drbdr algorithm is called, which
can change the state of the interface. But if the state does not
changes then LINK LSAs are not transmitted.
This PR fixes this issue. If the state is changed, then LINK LSAs
will anyways be tranmitted. But in case the state is not changed,
even in that case Link LSAs are tranmitted.
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Same as other commits -- convert most DEFINE_MTYPE into the _STATIC
variant, and move the remaining non-static ones to appropriate places.
Signed-off-by: David Lamparter <equinox@diac24.net>
Back when I put this together in 2015, ISO C11 was still reasonably new
and we couldn't require it just yet. Without ISO C11, there is no
"good" way (only bad hacks) to require a semicolon after a macro that
ends with a function definition. And if you added one anyway, you'd get
"spurious semicolon" warnings on some compilers...
With C11, `_Static_assert()` at the end of a macro will make it so that
the semicolon is properly required, consumed, and not warned about.
Consistently requiring semicolons after "file-level" macros matches
Linux kernel coding style and helps some editors against mis-syntax'ing
these macros.
Signed-off-by: David Lamparter <equinox@diac24.net>
This bug was first reported in PR#7717. When removing an interface
from the area, the interface prefix is still shown
r1# sh ipv6 ospf6 interface prefix
*N IA 2013:12::/64 ::1 r1-r2-eth0 00:00:12
r1# conf t
r1(config)# router ospf6
r1(config-ospf6)# no interface r1-r2-eth0 area 0.0.0.0
r1(config-ospf6)# exit
r1# sh ipv6 ospf6 interface prefix
*N IA 2013:12::/64 ::1 r1-r2-eth0 00:00:22
This fix will check if the interface is disabled so the
prefix is not shown
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
ospf6 keeps a flag to remember whether the cost for an interface
was manually added via config or computed automatically, but if
the configured value matches the auto-computed one we were not
setting this flag, meaning that the config would not show up in
the config.
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Modify code to add JSON format output in show command
"show ipv6 ospf6 interface prefix" with proper formating
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Modify code to add JSON format output in show command
"show ipv6 ospf6 route [<intra-area|inter-area|external-1|
external-2|X:X::X:X|X:X::X:X/M|detail|summary>]"
with proper formating
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
When removing ospfv3 from an interface that has been previously
put into wait state, there is a possible use after free of the
oi because the wait_timer could have been started for the interface.
This is because the wait_timer was not tracked by the interface
and we just created a thread for it without storing the thread
pointer.
Issue: #7932
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Modify code to add JSON format output in show command
"show ipv6 ospf6 interface" with proper formating
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
Modify code to add JSON format output in show command
"show ipv6 ospf6 interface traffic" with proper formating
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
1. All the changes are related to handle ospf6 with different vrf.
2. The dependancy of global ospf6 is removed.
Co-authored-by: Kaushik <kaushik@niralnetworks.com>
Signed-off-by: harios_niral <hari@niralnetworks.com>
The code pattern:
for (ALL_LSDB(lsdb, lsa)) {
remove_lsa(lsa)
}
has a use after free in ALL_LSDB, since we ask for the next pointer,
after it has been freed.
Modify the code such that we grab the next pointer before we can
possibly free it.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
ospf6_network.h needs ospf6_top.h to be included
first.
This makes newer versions of gcc much much happier.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
1. Removed the VRF_DEFAULT dependency from ospf6d.
2. The dependency on show command still exist
will be fixed when the ospf6 master is available.
Co-authored-by: Harios <hari@niralnetworks.com>
Signed-off-by: Kaushik <kaushik@niralnetworks.com>
Remove mid-string line breaks, cf. workflow doc:
.. [#tool_style_conflicts] For example, lines over 80 characters are allowed
for text strings to make it possible to search the code for them: please
see `Linux kernel style (breaking long lines and strings)
<https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.
Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```
Signed-off-by: David Lamparter <equinox@diac24.net>
And again for the name. Why on earth would we centralize this, just so
people can forget to update it?
Signed-off-by: David Lamparter <equinox@diac24.net>
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.
Signed-off-by: David Lamparter <equinox@diac24.net>
There is really no reason to not put this in the cmd_node.
And while we're add it, rename from pointless ".func" to ".config_write".
[v2: fix forgotten ldpd config_write]
Signed-off-by: David Lamparter <equinox@diac24.net>
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.
Signed-off-by: David Lamparter <equinox@diac24.net>
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.
This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff
Create 4 new callback functions that will be controlled by
lib/if.c
create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.
At this point this is just boilerplate setup for future commits.
There is no new functionality.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
If the interface doesn't exist in system, we'll default to broadcast and
then later not change that when the interface comes up. Explicitly
track whether the user configured the type and properly auto-set it if
they didn't.
Fixes: #3930Fixes: #4873
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
If the user configured an interface to be in a particular mode, we need
to be consistent about that. No looking at if_is_pointopoint() or
if_is_broadcast().
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
We can't skip reading interface state if there's no area yet, we'll be
missing information later when the interface is configured.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
there are some events where the list of interfaces per area should be
reviewed due to an interface is being removed. This fix avoids having
some memory leak.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Avoid a IPv6 multicast group join race by delaying the group install
before processing all event queue.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
When using the timer to set the socket multicast options, keep track
of the thread pointer. If we lose the thread reference we might have
situations where multicast is enabled when it should be disabled and
vice versa.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
There is no need to check for failure of a ALLOC call
as that any failure to do so will result in a assert
happening. So we can safely remove all of this code.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t
Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
RFC 2328 (14.1) Premature aging of LSAs from
routing domain :
When ospf6d is going away (router going down),
send MAXAGEd self originated LSAs to all
neighbors in routing domain to trigger
Premature aging to remove from resepective LSDBs.
Neighbor Router Reboot:
Upon receiving Self-originate MAXAGEd LSA, simply
discard, Current copy could be non maxaged latest.
For neighbor advertised LSA's (current copy in LSDB)
is set to MAXAGE but received new LSA with Non-MAXAGE
(with current age), discard the current MAXAGE LSA,
Send latest copy of LSA to neighbors and update the
LSDB with new LSA.
When a neighbor transition to FULL, trigger AS-External
LSAs update from external LSDB to new neighbor.
Testing:
R1 ---- DUT --- R5
| \
R2 R3
|
R4
Area 1: R5 and DUT
Area 0: DUT, R1, R2, R3
Area 2: R2 R4
Add IPv6 static routes at R5
Redistribute kernel routes at R5,
Validate routes at R4, redistributed via backbone
to area 2.
Stop n start frr.service at R5 and validated
MAXAGE LSAs then recent age LSAs in Database at DUT-R4.
Validated external routes installed DUT to R4.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Fixes: #1420
Signed-off-by: Juergen Kammer <j.kammer@eurodata.de>
If the ipv6 ospf6 cost on an interface is changed, no recalculation of routes happens, though the interface structure is updated with the new value. The new cost will be used later, when LSA hooks are called for any other reason.
Diagnosis:
The DEFUN for the config command sets oi->cost and calls ospf6_interface_recalculate_cost(oi) whenever there is a change in the supplied value. ospf6_interface_recalculate_cost then gets the new cost for the interface by calling ospf6_interface_get_cost(oi), which returns oi->cost if a cost is manually set (i.e. we get the value we just set). ospf6_interface_recalculate_cost only calls the LSA hooks if there is a change - which obviously never happens if we compare the new value with itself.
This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.
The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).
This is a big patch but the interesting bits are all in lib/if.[ch].
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Convert the list_delete(struct list *) function to use
struct list **. This is to allow the list pointer to be nulled.
I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.
Let's make the api explicit in it setting the list pointer
to null.
Cynical Prediction: This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Using the previously-added vty_frame() support, this gets rid of all the
pointless empty "interface XYZ" blocks that get added for any interface
that shows up in the system (e.g. dummys, tunnels, etc.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This reverts commit c14777c6bf.
clang 5 is not widely available enough for people to indent with. This
is particularly problematic when rebasing/adjusting branches.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.