Commit graph

836 commits

Author SHA1 Message Date
Ondrej Zajicek (work) f761be6b30 Nest: Clean up main channel handling
Remove assumption that main channel is the only channel.
2021-06-17 16:56:51 +02:00
Ondrej Zajicek (work) 10498b8e89 OSPF: Fix OSPFv3 in IPv4 mode with multiple areas
Some area handling code got confused by IPv4 setup in OSPFv3 mode.
2021-05-26 18:57:32 +02:00
Ondrej Zajicek (work) 2a0af925b8 OSPF: Allow ifaces with host address as unnumbered PtP or PtMP ifaces
Ifaces with host address (/32) were forced to be stubby, but now they
can be used as PtP or PtMP. For these ifaces we need to:

 - Do not force stub mode
 - Accept packets from any IP as local
 - Accept any configured neighbor as local
 - Detect ifaces properly as unnumbered
 - Use ONLINK flag for nexthops
2021-05-10 13:39:55 +02:00
Ondrej Zajicek (work) bc591061f6 OSPF: Packets on PtP networks should be always sent to AllSPFRouters
As specified in RFC 2328 8.1: "On physical point-to-point networks,
the IP destination is always set to the address AllSPFRouters."

Note that this likely break setups with multiple neighbors on a network
configured as PtP, which worked before. These should be configured as
PtMP.

Thanks to Senthil Kumar Nagappan for the original patch and to Joakim
Tjernlund for suggestions.
2021-05-09 15:26:13 +02:00
Ondrej Zajicek (work) 1647923bd8 OSPF: Minor refactoring of packet sending code
Common behavior for LSupd and delayed LSack moved to ospf_send_to_iface()
and other minor changes.
2021-05-09 14:51:39 +02:00
Ondrej Zajicek (work) ae9ae864d3 OSPFv3: Update neighbor authentication state from Hello packets
In OSPFv3, only Hello and DBDes packets contain flags specifying whether
RFC 7166 authentication trailer is used. Other packets are processed
based on stored authentication state in neighbor structure. Update this
state with each received Hello to handle authentication change from
reconfigurations.

Thanks to Joakim Tjernlund and Kenth Eriksson for the bugreport.
2021-03-16 16:34:42 +01:00
Ondrej Zajicek (work) c9ae81656f Some minor sl_allocz() cleanups 2020-11-24 03:21:44 +01:00
Ondrej Zajicek (work) 00ddd18b02 OSPFv3: Fix intra-area-prefix-LSA origination on DR
When a new link-LSA is originated, we need to notify intra-area-prefix-LSA
handling, like when a new link-LSA is received. Otherwise a new network
prefix added to a DR is not propagated immediately.

Thanks to Bala Sajja for the bugreport.
2020-11-18 17:37:29 +01:00
Ondrej Zajicek (work) 9d3fc3062b BFD: Allow per-request session options
BFD session options are configured per interface in BFD protocol. This
patch allows to specify them also per-request in protocols requesting
sessions (currently limited to BGP).
2020-11-08 15:33:22 +01:00
Maria Matejka 600eb695b1 OSPF: Fixed a debug assert 2020-08-31 15:41:39 +02:00
Ondrej Zajicek (work) dc8d9dec4a OSPF: Skip out-of-state packets earlier
Sometimes multicast OSPF packet is received when neighbor adjacency is
not established. Such packet should be ignored earlier in packet
processing as otherwise it causes strange error messages when OSPFv3
authentication is enabled.
2020-08-12 19:42:44 +02:00
Ondrej Zajicek (work) c26c6bc2d7 Show info from multiple protocols when protocol is not specified
Most commands like 'show ospf neighbors' fail when protocol is not
specified and there are multiple instances of given protocol type.
This is annoying in BIRD 2, as many protocols have IPv4 and IPv6
instances. The patch changes that by showing output from all protocol
instances of appropriate type.

Note that the patch also removes terminating cli_msg() call from these
commands and moves it to the common iterating code.
2020-06-28 15:38:47 +02:00
Ondrej Zajicek (work) 82937b465b OSPF: Fix bad header length test
Thanks to Slava Aseev for the thorough bugreport.
2020-06-10 13:27:14 +02:00
Maria Matejka eee8af4db2 OSPF: setting list node to zero before enlisting 2020-06-02 16:58:06 +02:00
Ondrej Zajicek (work) c1632ad0f3 OSPF: Fix handling of unnumbered PtPs
This issue has a long history. In 2012, we changed data field for
unnumbered PtP links from iface id (specified by RFC) to IP address based
on reports of bugs in Quagga that required it, and we used out-of-band
information to distinquish unnumberred PtPs with the same local IP
address.

Then with OSPF graceful restart implementation, we found that we can no
longer use out-of-band information, and we need to use only LSAdb info
for routing table calculation, but i forgot to finish handling of this
case, so multiple unnumbered PtPs with the same local IP addresses were
broken.

Considering that even recent Mikrotik RouterOS has broken next hop
calculation that depends on IP address in PtP link data field, we
cannot just switch back to the iface id for unnumbered PtP links.

The patch makes two changes: First, it goes back to use out-of-band
(position) info for distinguishing local interfaces in SPF when graceful
restart is not enabled, while still uses LSAdb-only approach for SPF
calculation when graceful restart is enabled.

Second, it adds OSPF interface option 'ptp address', which controls
whether IP address or iface id is used in data field. It is enabled
by default except for unnumbered PtP links with enabled graceful
restart.

Thanks to Kenth Eriksson for the bugreport and Joakim Tjernlund for
suggestions.
2020-05-26 18:21:43 +02:00
Maria Matejka 258be56539 Nest: Added const to ea_show just to declare that this shouldn't really change anything 2020-05-01 15:19:12 +02:00
Maria Matejka a7d9b8f116 OSPF: Zero-initialization of a temporary neighbor 2020-05-01 15:19:12 +02:00
Maria Matejka 9e64ac4b7c OSPF: Adding a note about a static analyzer result. 2020-05-01 15:19:12 +02:00
Maria Matejka dccee40826 OSPF: variable-length array of size 0 replaced by alloca()'d pointer
NULL pointer is safer than a random pointer onto stack if this function
gets changed and eventually broken.
2020-05-01 15:19:12 +02:00
Maria Matejka fd9f0c0640 Configuration strings are constant.
This is merely a const propagation. There was no problem in there.
2020-04-09 15:37:14 +02:00
Ondrej Zajicek (work) 9f2670277c OSPF: Fix bad initialization of tx_hdrlen field
Function ifa_tx_hdrlen() uses fields autype and passwords, so it must be
called after these are set.

Thanks to Kenth Eriksson for the bugreport.
2020-01-09 03:02:15 +01:00
Ondrej Zajicek (work) 56d8b1e7f6 OSPF: Fix 'show ospf lsadb' cmd without proto arg
It crashed when used without protocol argument.

Thanks to Alexander for the bugreport.
2019-08-29 20:58:16 +02:00
Ondrej Zajicek (work) cec40a7467 Merge remote-tracking branch 'origin/mq-filter-stack' 2019-07-24 15:38:32 +02:00
Ondrej Zajicek (work) 048c2f0e8c OSPF: Fix formatting of 'show ospf neighbors'
The formatting was broken when too short router-id was used.
2019-07-23 17:02:41 +02:00
Ondrej Zajicek (work) cf7ff99513 BFD: Support for VRFs
Allow multiple BFD instances in separate VRFs, dispatch BFD requests
according to VRFs.

Thanks to Alexander Zubkov for notice and patches.
2019-07-17 16:20:35 +02:00
Maria Matejka 8263690e75 Merge remote-tracking branch 'origin/master' into mq-filter-stack 2019-07-15 16:07:16 +02:00
Ondrej Zajicek (work) 1aec7112f7 OSPF: Fix handling of NSSA option flags
Per RFC 3101, N-bit signalling NSSA support should be used only in Hello
packets, not in DBDES packets. BIRD since 2.0.4 verifies N-bit in
neighbor structure, which is learned from DBDES packets, therefore
NSSA-LSAs are not propagated to proper implementations of RFC 3101.

This patch fixes that. Both removing the check and removing N-bit from
DBDES packet. This will fix compatibility issues with proper
implementations, but causes compatibility issues with BIRD 2.0.4.
2019-07-10 18:25:36 +02:00
Maria Matejka b2a4feeb4c Merge branch 'master' into mq-filter-stack 2019-07-10 11:27:08 +02:00
Ondrej Zajicek (work) deb84d7989 OSPF: Minor fix in graceful restart
Most LSA origination is blocked in ospf_update_topology(), this fix
blocks LSA origination from ospf_rt_spf().
2019-07-09 15:57:46 +02:00
Ondrej Zajicek (work) 2872ab927e OSPF: Update DR when local priority changes
When priority is reconfigured locally, we need to trigger DR election.

(recommiting, was reset by the previous commit)
2019-07-09 03:48:02 +02:00
Ondrej Zajicek (work) 85840d4c03 OSPF: Fix handling of external routes on graceful restart
We need to flush learned external LSAs a bit later than other LSAs (after
first feed after end of the graceful restart) to avoid flap of external
routes.
2019-07-09 03:39:19 +02:00
Ondrej Zajicek (work) fa1e0ba354 OSPF: Update DR when local priority changes
When priority is reconfigured locally, we need to trigger DR election.
2019-07-04 13:34:42 +02:00
Maria Matejka eac9250fd5 Merge branch 'master' into mq-filter-stack 2019-07-03 11:12:25 +02:00
Maria Matejka 78976974e7 Dynamic attributes definition split whether it is bitmask or not. 2019-07-03 00:00:11 +02:00
Ondrej Zajicek (work) 1a2ad348f6 OSPF: Support for graceful restart
Implement OSPFv2 (RFC 3623) and OSPFv3 (RFC 5187) graceful restart,
for both restarting and helper sides. Graceful restart is initiated
by 'graceful down' command.
2019-06-30 21:30:41 +02:00
Maria Matejka 9eef9c648c Lexer now returns known sym / unknown sym / keyword 2019-05-17 22:26:21 +02:00
Ondrej Zajicek (work) 6ff8119765 OSPFv3: Fix some overlooked cases in IPv4 mode
Prefixes with max length (/32) were not handled properly.

Thanks to bauen1 for the bugreport.
2019-04-12 14:11:23 +02:00
Maria Matejka 8d65add626 Merge branch 'master' into HEAD 2019-03-18 12:54:40 +01:00
Ondrej Zajicek (work) 875cc073b0 Nest: Update handling of temporary attributes
The temporary atttributes are no longer removed by ea_do_prune(), but
they are undefined by store_tmp_attrs() protocol hooks. This fixes
several bugs where temporary attributes were removed when they should
not or not removed when they should be. The flag EAF_TEMP is no longer
needed and was removed.

Update all protocol make_tmp_attrs() / store_tmp_attrs() hooks to use
helper functions and to handle unset attributes properly.

Also fix some related bugs like improper handling of empty eattr list.
2019-03-14 17:31:40 +01:00
Ondrej Zajicek (work) 9aa77fcceb OSPF: Improved handling of tmpattrs
Keep track of whether OSPF tmpattrs are actually defined for given route
(using flags in rte->pflags). That makes them behave more like real
eattrs so a protocol can define just a subset of them or they can be
undefined by filters.

Do not set ospf_metric2 for other than type 2 external OSPF routes and do
not set ospf_tag for non-external OSPF routes. That also fixes a bug
where internal/inter-area route propagated from one OSPF instance to
another is initiated with infinity ospf_metric2.

Thanks to Yaroslav Dronskii for the bugreport.
2019-03-06 18:28:00 +01:00
Maria Matejka c0e958e022 Filter + Config: Fix bugs, tests and split symbols by type 2019-02-20 22:30:54 +01:00
Maria Matejka 4c553c5a5b Filter refactoring: dropped the recursion from the interpreter
This is a major change of how the filters are interpreted. If everything
works how it should, it should not affect you unless you are hacking the
filters themselves.

Anyway, this change should make a huge improvement in the filter performance
as previous benchmarks showed that our major problem lies in the
recursion itself.

There are also some changes in nest and protocols, related mostly to
spreading const declarations throughout the whole BIRD and also to
refactored dynamic attribute definitions. The need of these came up
during the whole work and it is too difficult to split out these
not-so-related changes.
2019-02-20 22:30:54 +01:00
Ondrej Zajicek (work) bf8d7bba9e OSPF: Reset LSAs during area type change
When area is reconfigured to a different type, we need to flush LSAs as
they may not be valid (e.g. NSSA-LSA for non-NSSA area). Also, when we
have have just one OSPF area and that changes type, we could restart OSPF
as there is no state to keep anyway. That solves issue with different
handling of external routes exported to OSPF based of main area type.
2019-02-17 01:54:01 +01:00
Ondrej Zajicek (work) 4a3f5b3617 OSPF: Basic support for DN-bit handling (RFC 4576)
External LSAs originated by OSPF routers with VPN-PE behavior enabled are
marked by DN flag and they are ignored by other OSPF routers with VPN-PE
enabled.
2019-02-13 15:53:36 +01:00
Ondrej Zajicek (work) 1e958e52d3 OSPF: Do not originate Router-Information LSA
As we do not have much usage for it yet.
2019-02-09 16:15:01 +01:00
Ondrej Zajicek (work) a9b97cbcb7 OSPF: Send direct acknowledgements as unicast
Direct acknowledgements should be send as unicast to a corresponding
neighbor. Only delayed acks should be send as multicast to all/designated
routers.
2019-02-03 20:22:40 +01:00
Ondrej Zajicek (work) 16605f2fda OSPF: Reject duplicate DBDES packets after dead interval
Master may free last DBDES packet immediately. Slave must wait dead
interval before freeing last DBDES packet and then reject duplicate
DBDES packets with SeqNumberMismatch.
2019-02-03 17:31:27 +01:00
Ondrej Zajicek (work) 9c94583a3d OSPF: DD seqnum should be initialized only for first attempts
After SeqNumberMismatch/BadLSReq, we should continue with the old
seqnum++. The old code tries to do that by n->adj, but it was set
nowhere.
2019-02-03 16:20:37 +01:00
Ondrej Zajicek (work) 267da8138d OSPF: Reject DBDES packets with non-matching MTU
As it is specified in RFC 2328. The old code just provided warning.
2019-02-03 15:45:43 +01:00
Ondrej Zajicek (work) 1c730ee761 Doc: Remove doc for already removed option 2019-01-26 20:44:37 +01:00