Commit Graph

179 Commits

Author SHA1 Message Date
Igor Ryzhov
42cabc552d ospf6d: fix interface area configuration
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>
2021-06-08 21:38:09 +03:00
Kaushik
ad500b22b5 ospf6d: Support for nssa in ospfv3
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>
2021-06-04 07:23:10 -03:00
Igor Ryzhov
d16cff32b2 ospf6d: fix using vrf interface as a loopback
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-28 16:14:34 +03:00
Igor Ryzhov
b4b6bd0017 ospf6d: fix possible crashes
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>
2021-05-25 21:59:46 +03:00
lynne
f85b76195a ospf6d: Limit the number of interface addresses being supported
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>
2021-05-11 09:43:07 -04:00
Rafael Zalamena
4478793c43
Merge pull request #8636 from idryzhov/ospfv3-vrf-support
OSPFv3 VRF support
2021-05-06 08:50:32 -03:00
harios_niral
d48ef099db ospf6d: add vty support for multiple vrfs
Co-authored-by: Kaushik Nath <kaushiknath.null@gmail.com>
Signed-off-by: harios_niral <hari@niralnetworks.com>
2021-05-06 10:54:31 +03:00
Yash Ranjan
17ab36c6c4 ospf6d: Send Link LSAs when interface priority is changed
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>
2021-05-02 10:19:16 -07:00
Rafael Zalamena
1f7be0d242 ospf6d: add support for BFD profiles
Allow user to pre configure BFD sessions using profiles.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-22 16:10:04 -03:00
Rafael Zalamena
d06cc41644 ospf6d: rework BFD integration
Use the new BFD library to integrate with BFD.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-22 16:10:01 -03: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
Donatas Abraitis
37916b2b11
Merge pull request #8121 from opensourcerouting/macro-cleanup
*: require ISO C11 + semicolons after file-scope macros
2021-03-22 11:00:34 +02:00
David Lamparter
96244aca23 *: require semicolon after DEFINE_QOBJ & co.
Again, see previous commits.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:37 +01:00
David Lamparter
8451921b70 *: require semicolon after DEFINE_HOOK & co.
See previous commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:17 +01:00
David Lamparter
bf8d3d6aca *: require semicolon after DEFINE_MTYPE & co
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>
2021-03-17 06:18:17 +01:00
ckishimo
d100d0b00c ospf6d: remove interface prefix when area is removed
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>
2021-03-17 00:01:22 +01:00
Emanuele Di Pascale
7bfc5ae813 ospf6d: fix setting NOAUTOCOST flag
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>
2021-03-03 10:56:51 +01:00
Russ White
67821bf2ad
Merge pull request #8051 from volta-networks/fix_ospf6_hello_lo
ospf6d: Don't send hellos on loopback interface
2021-02-16 11:42:01 -05:00
lynne
cb978d686b ospf6d: Don't send hellos on loopback interface
When ospf6 passive is turned off on a loopback interface don't start
sending ospf6 hellos.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-02-09 19:31:18 -05:00
Yash Ranjan
35aeb295ed ospf6d: Json support added for command "show ipv6 ospf6 interface prefix [json]"
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>
2021-01-26 20:06:02 -08:00
Yash Ranjan
eacd0828d4 ospf6d: Json support added for command "show ipv6 ospf6 route [json]"
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>
2021-01-26 20:06:02 -08:00
Donald Sharp
9ae41e3105 ospf6d: Track wait_timer and disable when needed
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>
2021-01-26 08:13:44 -05:00
Mobashshera Rasool
bb4c56616f ospf6d: Link LSA is not updated when router priority is modified
Issue: #7727

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-12-14 07:57:13 +00:00
Igor Ryzhov
e285b70d3c ospf6: get instance from route table scope
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-11-30 17:36:10 +03:00
Donald Sharp
b84696e6c0
Merge pull request #7454 from ranjanyash54/dev_8
ospf6d: Json support added for command "show ipv6 ospf6 interface traffic [json]"
2020-11-18 18:37:30 -05:00
github login name
f16ae8cf5d ospf6d: Json support added for command "show ipv6 ospf6 interface [json]"
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>
2020-11-16 21:18:39 -08:00
github login name
ba30b37677 ospf6d: Json support added for command "show ipv6 ospf6 interface traffic [json]"
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>
2020-11-15 21:16:10 -08:00
github login name
6a5bb30062 ospf6d: Json support added for command "show ipv6 ospf6 neighbor [json]"
Modify code to add JSON format output in show command
"show ipv6 ospf6 neighbor" with proper formating

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2020-11-04 22:44:21 -08: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
Donatas Abraitis
2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03: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
Mark Stapp
f6d11a9bf6 ospf6d: fix SA warning
Fix an SA issue in ospf6_interface.c.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-09-03 12:57:36 -04: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
David Lamparter
3efd0893d0 *: un-split strings across lines
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>
2020-07-14 10:37:25 +02:00
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
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>
2020-04-16 12:53:59 +02:00
David Lamparter
243895805a *: move CLI parent data to cmd_node->parent_node
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>
2020-04-16 12:53:00 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
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>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
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>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
2b64873d24 *: generously apply const
const const const your boat, merrily down the stream...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00
Russ White
9898a2fb34
Merge pull request #5009 from donaldsharp/interface_deletion
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-30 07:46:19 -04:00
Donald Sharp
3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
b0b69e59f4 *: Convert interface_down to interface down callback
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ddbf3e6060 *: Convert from ->interface_up to the interface callback
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>
2019-09-19 13:34:06 -04:00
Donald Sharp
ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
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>
2019-09-19 13:34:06 -04:00
Donald Sharp
138c5a7450 *: Add infrastructure to support zapi interface callbacks
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>
2019-09-19 13:34:06 -04:00
David Lamparter
5aeb4f3c60 ospf6d: track explicit interface type config
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: #3930
Fixes: #4873
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-17 16:23:44 +02:00
David Lamparter
e597335362 ospf6d: fix mistaken if_is_* instead of oi->type
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>
2019-09-17 16:18:26 +02:00