Commit Graph

94 Commits

Author SHA1 Message Date
Rafael Zalamena
4f785c075e ospf6d: missing NSSA areas handling
Patch provided by Soman K.S. with small alterations.

Signed-off-by: Soman K.S <somanks@gmail.com>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-04 07:23:10 -03:00
Igor Ryzhov
c9ac777a7e ospf6d: fix debug message config write
Fix the following issues:
- if "send" is combined with "recv-hdr", only "send" is shown
- if "recv" is combined with "send-hdr", only "recv" is shown
- if both "send-hdr" and "recv-hdr" are enabled, "; header only" is shown

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-26 11:48:09 +03:00
lynne
f44d0f5eca ospf6d: Make debug logs configurable to only display message headers
This change allows the user to only log the message header and not
include all the LSAs in each packet.   In a large setup printing out
all the LSAs in each packet can make the system very hard to debug.
When the user finds an issue with the adjacency not coming up or in a
specific packet type they can turn on a full dump of the message.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-04-29 08:40:34 -04:00
David Lamparter
30043e4ce2 ospf6d: kill ospf6_memory.h, use MTYPE_STATIC
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>
2021-03-22 19:31:56 +01:00
lynne
ccf260c4c8 ospfd6: Clear locks when ospf messages need to be chunked
When there are too many LSA updates to be sent in a packet the code needs to
correctly clear the locks that are taken while walking the lists and then wait
for the appropriate timer to expire to continue walking the list.   The routine
that was being called would not properly remove all the locks that needed to be
cleared, and would also try to incorrectly delete the lsa/route.   The code now
clears the locks and leaves the lsa on the list.  When the timers fire again
the code continues walking the list to send the rest of the lsas to the
neighbor.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-03-16 11:34:17 -04:00
David Lamparter
5145a17261 *: fix printf extension types
Some mistakes have crept in again.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-14 22:56:07 +01:00
Donald Sharp
d47b448de5 ospf6d: Convert to use builtin printf functionality
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-14 22:56:07 +01:00
lynne
bac66c5c64 ospf6d: Don't advertise AS-External LSAs into stub area
If area is a normal area and has adjacencies up and then the user changes
the area to a stub area, the code was leaving existing AS-External LSAs in
the database and was sending AS-External LSAs into the stub area causing
the adjacency to stay in Ex-Start.   With this change we now cleanup the
AS-External LSAs that existed when area was not a stub and do not advertise
AS-External LSAs into the stub area.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-03-03 09:20:36 -05:00
lynne
ff99e5b648 ospf6d: Update logs that indicate why ospf6 adjacency is not coming up.
Add more details to these logs to help make it easier to determine why
ospf6 adjacency is not coming up.   Also make these logs show up without
having to turn on debug logging, again making it easier to debug the
misconfiguration.

Signed-off-by: Lynne Morrison <lynne@voltaio.net>
2021-02-18 10:24:51 -05:00
Rafael Zalamena
7c62dc76d4
Merge pull request #7261 from Niral-Networks/niral_dev_vrf_ospf6
ospf6d : Transformation changes for ospf6 vrf support.
2020-11-03 11:59:38 -03:00
harios_niral
beadc736bb ospf6d : Transformation changes for ospf6 vrf support.
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>
2020-10-30 23:50:08 -07:00
Donald Sharp
b66ec22ca9 ospf6d: ifindex should not be a pointer for ospf6_sendmsg
Let's cleanup the ospf6_sendmsg api and not pass in a pointer
to the ifindex to use.  It's an integer.

Also remove the assert(*ifindex);  We never use ifindex of 0

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-29 07:01:40 -04:00
Donald Sharp
2e37407f9d ospf6d, tests: Prevent use after free
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>
2020-10-11 11:16:44 -04:00
Donald Sharp
c527acf1eb ospf6d: Move header includes around to reflect reality
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>
2020-10-08 20:44:23 -04:00
Kaushik
7df1f3623e ospf6d : Socket change for ospf6d vrf support.
1. The socket() call is changed to vrf_socket().
2. The ospf6 instance creation api added.
3. The global socket fd is replaced with ospf6->fd.
4. All dependency of the global socket is resolved.
5. Added the ospf6 receive timer in the global structure.
6. Performed the thread off on receive timer when we do "no router ospf6".

Co-authored-by: harios <hari@niralnetworks.com>
Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-10-06 21:23:54 -07:00
Kaushik
c5d28568c6 ospf6d : Preparing for ospf6d VRF support.
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>
2020-09-01 03:02:46 -07:00
Donald Sharp
e2e60c48bf ospf6d: Revert "ospf6d: Prevent use after free"
This reverts commit 0f9f74baeb.

This commit was causing crashes and the goal of this commit
was to make coverity sanity happy.  I'd rather have coverity
sad and not have ospfv3 crash

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-14 15:35:19 -04:00
Donald Sharp
744ba56969 ospf6d: Prevent use after free
ospf6_lsa_unlock may free the lsa data structure as such
we cannot use the passed in data structure after freeing it.

Provide a mechanism to know if the data has been freed
using the same usage patterns of other _unlock functions
in FRR.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-18 08:35:06 -04:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Quentin Young
e1b36e132b *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-04 13:19:37 -05:00
Quentin Young
b3ba5dc7fe *: don't null after XFREE; XFREE does this itself
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03 11:22:13 -05:00
Donald Sharp
0f9f74baeb ospf6d: Prevent use after free
the for (ALL_LSDB...) macro was iterating over lsa,
when lsa had just been freed in these functions.
Remove the macro and make the adjustments saving lsa_next
before the free.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-25 09:26:24 -04:00
Quentin Young
0a22ddfbb1 *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
450971aa99 *: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:34:28 +00:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
4ba03be5d3 ospf6d: Update OSPFv3 to use new zlog_ferr
Update OSPFv3 to use the new zlog_ferr messages

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
0ce1ca805d *: ALLOC calls cannot fail
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>
2018-08-11 17:14:58 +02:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
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>
2018-03-27 15:13:34 -04:00
Donald Sharp
e4c42d655a ospf6d: Stop debug messages happening in rare case
When we have a interface disabled in ospfv3 and
we are receiving messages on it.  We will spam
the log file repeatedly.  Debug guard the message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-13 21:06:04 -04:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Chirag Shah
76249532fa ospf6d: Handle Premature Aging of LSAs
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>
2018-02-14 17:37:34 -08:00
Chirag Shah
43855e3d47 ospf6d: Add protocol stats and show command
Add OSPFv3 Protocol incoming/outgoing packets
stats.

r3# show ipv6 ospf6 interface traffic

Interface       HELLO            DB-Desc         LS-Req    LS-Update     LS-Ack
                Rx/Tx            Rx/Tx            Rx/Tx    Rx/Tx         Rx/Tx
--------------------------------------------------------------------------------------------
swp1              3/4              2/2             0/2     8/6           3/2
swp2              3/4              2/2             0/1     7/3           2/0
swp3              0/4              0/0             0/0     0/0           0/0

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-15 16:55:24 -08:00
Chirag Shah
1ba43456a4 ospf6d: Handle lsupdate upto max ospf6 payload
While traversing LSUpdate list, if LSUpdate message
fills up (w/ LSAs) to the interface MTU size,
Send the existing filled LSUpdate message if max
payload exceeds max ospf6 payload,
reset sendbuf (buffer) to fill rest of
the remaining LSAs.

Add relevant fields to debugs.

Ticket:CM-18069

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-16 22:37:02 -07:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
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>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
e553b498f1 Merge pull request #820 from opensourcerouting/gcc7
fix new warnings emitted by GCC 7
2017-07-14 12:54:40 -04:00
David Lamparter
22106bbf68 Merge remote-tracking branch 'frr/master' into table-hash-ospf6-lsdb-refactor
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 17:30:56 +02:00
David Lamparter
acd738fc7f *: fix GCC 7 switch/case fallthrough warnings
Need a comment on these.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 16:59:43 +02:00
David Lamparter
55f70b671f *: remove VTYNL, part 4 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
26a429fe8e *: remove VTYNL, part 2 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
6b18e3b2e0 ospf6d: VNL -> VTYNL
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
49dd8e3758 ospf6d: use macro for LSDB walks
... to make it easier to refactor all of the iteration uses.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-11 13:48:20 +02:00
Quentin Young
56b4067930 *: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b

The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-21 15:22:21 +00:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Quentin Young
66e78ae64b *: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See
previous commit message.

To ensure that the behavior stays functionally correct, any assignments
with the result of a thread_add* function have been transformed to set
the pointer to null before passing it. These can be removed wherever the
pointer is known to already be null.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:22 +00:00
Quentin Young
ffa2c8986d *: remove THREAD_ON macros, add nullity check
The way thread.c is written, a caller who wishes to be able to cancel a
thread or avoid scheduling it twice must keep a reference to the thread.
Typically this is done with a long lived pointer whose value is checked
for null in order to know if the thread is currently scheduled.  The
check-and-schedule idiom is so common that several wrapper macros in
thread.h existed solely to provide it.

This patch removes those macros and adds a new parameter to all
thread_add_* functions which is a pointer to the struct thread * to
store the result of a scheduling call. If the value passed is non-null,
the thread will only be scheduled if the value is null. This helps with
consistency.

A Coccinelle spatch has been used to transform code of the form:

  if (t == NULL)
    t = thread_add_* (...)

to the form

  thread_add_* (..., &t)

The THREAD_ON macros have also been transformed to the underlying
thread.c calls.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:19 +00:00
David Lamparter
cf672a8654 *: use monotime()
This is largely a bulk-replace made with coccinelle.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
afe4c21720 *: remove quagga_gettime() return value checks
The next patch will bulk-replace these, and monotime() has time_t as
return value, not an error indicator.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00