Commit Graph

1735 Commits

Author SHA1 Message Date
Donald Sharp
effee18744 ospfd: Fix quick interface down up event handling in ospf
When we get this sequence of events:

- zebra receives interface up, sends to ospf
- ospf receives intf up, processes( including neighbor formation and spf )
  and sends route to zebra for installation.
- zebra receives route for processing, schedules it too happen in the future
- zebra receives interface down event, sends to ospf
- zebra processes route X and marks it inactive because nexthop
  interface is down
- zebra receives interface up event, sends to ospf
- ospf receives both events and processes the change and decides
  that nothing has changed so it does not send any route change for X to zebra.

At this point zebra has a route from ospf that is marked as inactive, while
ospf believes that the route should be installed properly.

Modify the code such that on an interface down event, ospf marks the routes
as changed if the ifindex is being used for a nexthop, so that when ospf
is deciding if routes have changed post spf that it can just automatically
send that route down again if it still exists.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-25 14:43:40 -04:00
Don Slice
b56114aa9e ospfd: "ip ospf area" command can select wrong process
Found that in some circumstances, when the "ip ospf area"
command was entered for the default vrf, the wrong ospf
process would be used to check for the presence of a
"network" statement, causing the "ip ospf area" command to
be rejected. This was due to the command using the ospf
instance lookup to find the right ospf process, which can
be in error depending on when the processes were created.

Signed-off-by: Don Slice <dslice@nvidia.com>
2021-05-20 12:09:27 -04:00
Donald Sharp
55370b9564 ospfd: New code adds newline to log files
FRR is not using newlines in log messages.  Remove them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-19 15:10:48 -04:00
Olivier Dugeon
e55ee4b9ed
Merge pull request #8690 from idryzhov/ospf-fix-tlv-size
ospfd: fix SID/Label Sub TLV size
2021-05-19 16:16:35 +02:00
Igor Ryzhov
1f25f6c768
Merge pull request #8408 from Orange-OpenSource/TE
ospfd: Correct Coverity defects
2021-05-19 17:04:48 +03:00
Olivier Dugeon
8db278b5e3 ospfd: Correct Coverity defects
When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().

To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.

This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-05-19 09:48:54 +02:00
Igor Ryzhov
bc298f5d49 ospfd: fix SID/Label Sub TLV size
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18 21:00:41 +03:00
Igor Ryzhov
b46538c4a3 ospfd: fix "default-information originate" in non-existing vrf
If the default route redistribution is configured in OSPF router before
the VRF is created, then this is not currently registered in zebra after
the VRF creation.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18 01:23:35 +03:00
Donald Sharp
a4544597f4 ospfd: Use _func__ instead of __PRETTY_FUNCTION__
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 12:03:59 -04:00
Rafael Zalamena
34723b2fad
Merge pull request #8639 from idryzhov/isis-new-bfd-lib
isisd: rework BFD integration
2021-05-09 17:10:42 -03:00
Mark Stapp
f94b1d526b
Merge pull request #8634 from idryzhov/ospf-vrf-redist
ospf redistribution fixes
2021-05-07 15:22:19 -04:00
Igor Ryzhov
ca187fd355 ospfd: free "default-information originate" config when removing router
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-07 18:10:01 +03:00
Igor Ryzhov
c97b34cf1a lib: remove old bfd library
This commit also adds missing `bfd_protocol_integration_set_shutdown` to
ospf6d and pimd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-07 12:03:57 +03:00
Igor Ryzhov
7bced643b9 ospfd: fix redistribution config when vrf doesn't exist
Currently ospfd relies on vrf bitmaps in zclient to check that the
redistribution is configured. This doesn't work when the VRF for OSPF
instance doesn't exist yet, because vrf bitmaps ignore VRF_UNKNOWN id.

Because of this, the following problems occur when the VRF doesn't exist:
- repeated "redistribute smth" command is processed as a first-time
  instead of an update
- "no redistribute smth" doesn't work at all

This commit fixes both issues by relying on internal redistribution
config instead of zclient vrf bitmaps.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-05 19:31:22 +03:00
Igor Ryzhov
de11c1bc24 ospfd: deregister vrf from zebra when vrf is disabled
Currently the VRF is deregistered only when it is re-enabled again.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-05 19:31:22 +03:00
Donald Sharp
674c29dd23 ospfd: Use %pI4 in some places
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 09:06:14 -04:00
Donald Sharp
5e5181bbe2 ospfd: Fix some deep indentation issues in ospf_asbr.c
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 09:06:13 -04:00
Donald Sharp
b259f5af14 ospfd: Fix indentation in ospf_is_type_redistributed
clang-format was not happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 09:03:27 -04:00
Donald Sharp
5d8c8d0b1d ospfd: Do not use case default for switches that have enum
Found a couple spots where FRR was using `case default` when
using a switch over an enum.  In this case we *must* enumerate
all states as part of the switch.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 09:03:27 -04:00
Donald Sharp
6ec9c6a899 ospfd: Cleanup some awful deep indentation in ospf_zebra.c
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 09:03:27 -04:00
Mark Stapp
f71e1ff6a9
Merge pull request #8545 from opensourcerouting/assert-our-own
*: make our own assert() actually work
2021-05-03 11:17:36 -04:00
Olivier Dugeon
4c7ce7bd28
Merge pull request #8585 from stipmonster/asan-fixes-ospf-te
ospfd: Fixed some ASAN errors
2021-04-30 11:34:32 +02:00
Olivier Dugeon
92e36a784a
Merge pull request #7789 from rgirada/fix_DR
ospfd: show ip ospf interface displays only BDR info, Added DR info.
2021-04-29 20:01:06 +02:00
Donald Sharp
6cbd4c830a
Merge pull request #8409 from rgirada/ospf-memleak
ospfd: Fixing few valgrind issues
2021-04-29 12:50:03 -04:00
rgirada
2fbb8f4543 ospfd: show ip ospf interface only shows BDR info, Added DR info.
Description:
	DR information is missing under "show ip ospf interface [json]".
	Added DR infomation to display in "show ip ospf interface".

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-04-29 04:20:14 -07:00
Erik Kooistra
23508fff9f ospfd: Fixed some ASAN errors
This fixes 2 asan errors:
If we only have a TLV_ROUTER_ADDR don't continue after we skipped it.
Fixed length when parsing EXT_TLV_LINK_SIZE.

Signed-off-by: Erik Kooistra <me@erikkooistra.nl>
2021-04-28 15:51:18 +02:00
David Lamparter
1f8031f79a *: make sure config.h or zebra.h is first
`config.h` has all the defines from autoconf, which may include things
that switch behavior of other included headers (e.g. _GNU_SOURCE
enabling prototypes for additional functions.)

So, the first include in any `.c` file must be either `config.h` (with
the appropriate guard) or `zebra.h` (which includes `config.h` first
thing.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-23 12:06:35 +02:00
Rafael Zalamena
b38f1fd03d
Merge pull request #8536 from idryzhov/bfd-enabled
lib: remove enabled flag for bfd sessions
2021-04-22 15:06:48 -03:00
Igor Ryzhov
e82acdce22 lib: remove enabled flag for bfd sessions
Currently this flag is only helpful in an extremely rare situation when
the BFD session registration was unsuccessful and after that zebra is
restarted. Let's remove this flag to simplify the API. If we ever want
to solve the problem of unsuccessful registration/deregistration, this
can be done using internal flags, without API modification.

Also add the error log to help user understand why the BFD session is
not working.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-22 16:39:29 +03:00
David Lamparter
0c4285d77e build: properly split CFLAGS from AC_CFLAGS
`CFLAGS` is a "user variable", not intended to be controlled by
configure itself.  Let's put all the "important" stuff in AC_CFLAGS and
only leave debug/optimization controls in CFLAGS.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-21 15:42:36 +02:00
David Lamparter
09781197b6 build: make builddir include path consistent
... by referencing all autogenerated headers relative to the root
directory.  (90% of the changes here is `version.h`.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-21 15:42:33 +02:00
Russ White
8c3d6b8be5
Merge pull request #8455 from achernavin22/ospf_nssa_after_redist2
ospfd: install Type-7 when NSSA area is configured after redistribution
2021-04-20 10:28:49 -04:00
Russ White
7408af70f5
Merge pull request #8373 from mjstapp/fix_ospf_timeval_dump
ospfd: show seconds in timeval_dump
2021-04-20 07:39:50 -04:00
rgirada
4a61b0d00e ospfd: Fixing few valgrind issues
Description:
	All matching external routes are added to matching external hash table
        of aggregate route when aggregation is enabled.
        But these external info pointers are not delinked from this hash table
        before freeing the corresponding memory  while disabling redistribution.
        Addressing these memory issues in this change.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-04-16 11:15:53 -07:00
Jafar Al-Gharaibeh
d75213d260
Merge pull request #8153 from reubendowle/nhrp-multicast
nhrp, ospf: add nhrp multicast for OSPF DMVPN
2021-04-13 12:49:28 -05:00
Mark Stapp
7de06eab47 ospfd: show seconds in timeval_dump
If the number of seconds is < one minute, show seconds and
msecs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-13 09:09:31 -04:00
Renato Westphal
0a6a5721c6
Merge pull request #8396 from achernavin22/ospf_fast_hello_show_run
ospfd: fix output of dead-interval in show running
2021-04-13 00:14:56 -03:00
David Lamparter
9c2a14e753
Merge pull request #8100 from qlyoung/remove-sample-conf-files 2021-04-13 02:20:53 +02:00
Alexander Chernavin
1c1c342d2a ospfd: install Type-7 when NSSA area is configured after redistribution
Currently, if NSSA area is configured before redistribution is enabled,
Type-7 LSA's are installed and flooded. But if NSSA area is configured
after redistribution is enabled, Type-7 LSA's are not installed.

With this change, when NSSA area is configured, schedule a task that
scans for external LSA's. If they exist, install Type-7 and flood to
all NSSA Areas.

There already was an attempt to fix this problem in 0f321812f where
ospf_asbr_nssa_redist_task() was triggered in ospf_abr_task_timer().
This turns out to be incorrect place for this operation because it's
a one-off operation needed only after "area <ID> nssa" execution. And
ospf_abr_task_timer() is a periodic operation. Triggering
ospf_asbr_nssa_redist_task() in ospf_abr_task_timer() caused a problem
that was fixed in 945eec2b6 making the problem with NSSA area
configured after redistribution actual again.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2021-04-12 09:34:20 -04:00
Quentin Young
b832909b42 *: remove *.conf.sample files
Most of these are many, many years out of date. All of them vary
randomly in quality. They show up by default in packages where they
aren't really useful now that we use integrated config. Remove them.

The useful ones have been moved to the docs.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-04-09 13:14:30 -04:00
Rafael Zalamena
e2134a79ee ospfd: fix crash on interface/vrf removal
The interface parameters deletion must be called before
`route_table_finish` due to the usage of the route data structures to
search neighbors in the same interface. If the route info is removed
before that we get the following crash:

```
 6  0x00007f5c6ed50394 in core_handler at lib/sigevent.c:255
 7  <signal handler called>
 8  ospf_interface_bfd_apply (ifp=<optimized out>) at ospfd/ospf_bfd.c:130
 9  0x000055d4c306d076 in ospf_interface_disable_bfd at ospfd/ospf_bfd.c:159
 10 0x000055d4c3071781 in ospf_del_if_params at ospfd/ospf_interface.c:553
 11 0x000055d4c3071900 in ospf_if_delete_hook at ospfd/ospf_interface.c:704
 12 0x00007f5c6ed17935 in hook_call_if_del at lib/if.c:59
 13 if_delete_retain at lib/if.c:290
 14 0x00007f5c6ed19bc5 in if_delete at lib/if.c:313
 15 0x00007f5c6ed19d88 in if_terminate at lib/if.c:1067
 16 0x00007f5c6ed63a04 in vrf_delete at lib/vrf.c:297
 17 0x00007f5c6ed76784 in zclient_vrf_delete at lib/zclient.c:1974
 18 zclient_read at lib/zclient.c:3686
 19 0x00007f5c6ed60f85 in thread_call at lib/thread.c:1815
 20 0x00007f5c6ed20228 in frr_run at lib/libfrr.c:1149
 21 0x000055d4c306bc70 in main at ospfd/ospf_main.c:233
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-04-09 10:54:23 -03:00
Mark Stapp
519b14645e ospfd: permit over-write of message-digest-key
Allow over-write of message-digest-key interface config. Most
attributes handle multi-instance by ... ignoring instances,
and tolerating repeated config: do the same for md5 auth.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-06 15:26:51 -04:00
Alexander Chernavin
6dd632c65d ospfd: fix output of dead-interval in show running
When you set OSPF hello-interval for an interface and dead-interval is
not set for this interface, dead-interval will be calculated and set
automatically. "show running-config" will contain an invalid command:

    test(config)# interface vpp1
    test(config-if)# ip ospf area 0
    test(config-if)# ip ospf hello-interval 1
    test(config-if)# exit
    test(config)#
    test(config)# do show running-config
    ...
    interface if1
     ip ospf area 0
     ip ospf dead-interval minimal hello-multiplier 0
     ip ospf hello-interval 1
    !
    ...

It causes frr-reload.py to fail because of this:

    # vtysh -c "show running-config no-header" | vtysh -m -f -
    line 9: % Unknown command:  ip ospf dead-interval minimal hello-multiplier 0
    ...

With this change, output "ip ospf dead-interval" only if it has value
configured explicitly.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2021-04-06 05:34:55 -04:00
Reuben Dowle
686967467c ospfd: Suppress spurious write message when using ip nhrp map multicast
When ip nhrp map multicast is being used, this is usually accompanied by an
iptables rule to block the original multicast packet. This causes sendmsg to
return EPERM.

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:23:42 +12:00
Amol Lad
0c5506a856 ospfd: changes for PMP network /32 prefix length
Operation with PMP network on /32 prefix is needed for DMVPN

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:23:42 +12:00
Amol Lad
bc97889b39 ospfd: Support use of ospf with DMVPN
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-04-06 09:22:59 +12:00
Igor Ryzhov
a900cece99 ospfd: ignore duplicated "ip ospf area" commands
Fixes #8388.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-02 03:22:24 +03:00
Igor Ryzhov
69b34634ec ospfd: fix building with --disable-bfdd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-31 15:54:34 +03:00
Sarita Patra
a623b52619 ospfd: North-bound implementation for ospfd rmaps
This commit introduces the implementation for the north-bound
callbacks for the ospfd-specific route-map match and set clauses.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
Signed-off-by: Sarita Patra <saritap@vmware.com>
2021-03-30 22:59:30 +03:00
Mark Stapp
ea631ac834
Merge pull request #8058 from rgirada/ospf-ecmp
ospfd: Max multipath config support
2021-03-30 11:57:33 -04:00