Commit Graph

2089 Commits

Author SHA1 Message Date
Donald Sharp
6da712b9e9
Merge pull request #13041 from FRRouting/mergify/bp/stable/8.5/pr-13038 2023-03-19 18:39:02 -04:00
Donald Sharp
610c449198 ospfd: Free up q_space in early return path
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 52ff0e3ed4)
2023-03-19 04:45:23 +00:00
Donald Sharp
05dee7a121 ospfd: Fix ospf_ti_lfa drop of an entire table
The new_rtrs variable was just generated and then dropped.  Let's
fix that entirely

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit eb7e14011f)
2023-03-19 04:45:23 +00:00
Donald Sharp
89992e547c ospfd: Cleanup some memory leaks on shutdown in ospf_apiserver.c
Clean up some memory leaks found in ospf_apiserver.c  Also
a crash in the original implementation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 7773d0071a)
2023-03-19 04:29:22 +00:00
Martin Winter
07751d58e1 ospfd: Log Adjacency Changes with Neighbor IP in addition to Neighbor ID
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 386d232a1a)
2023-03-17 11:55:54 +00:00
Donatas Abraitis
922429d123 ospfd, ospf6d: Add more logging details
Basically just router-id or interface/IP.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ba427e6348)
2023-03-17 11:55:53 +00:00
Christian Hopps
2b2061e274 ospfd: compare prefix values in host order
Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 156a904cae)
2023-02-22 16:55:11 +00:00
Christian Hopps
5a51609d84 ospfd: small bugfix for miscounting A[S]BRs
- improve the debug for the second add router call.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1eea62bb1c)
2023-02-22 16:55:11 +00:00
Christian Hopps
7f8f9aaee6 ospfd: inc. opaque data in show opaque info detail json output
Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1794afe010)
2023-02-22 16:55:10 +00:00
Donatas Abraitis
1ce23106eb *: Drop deprecated incorrect JSON fields with wrong naming
Deprecation cycle already passed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 10:18:28 +02:00
Russ White
9b1b028cc2
Merge pull request #12682 from opensourcerouting/time-cs
*: fix time truncation in many places
2023-01-24 10:51:44 -05:00
mobash-rasool
c6188284fb
Merge pull request #12677 from opensourcerouting/fix/ospf_potential_memory_leak
ospfd: Free memory for JSON allocated object before return
2023-01-24 09:54:44 +05:30
Donatas Abraitis
88c5852b72 ospfd: Free memory for JSON allocated object before return
For show_ip_ospf_database_type_adv_router_common().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-23 13:46:42 +02:00
Donatas Abraitis
cb2689d3e5 ospfd: Free memory for JSON allocated object before return
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-22 21:15:44 +02:00
Chirag Shah
1ffbb2e487 ospfd: fix crash show ip ospf border-routers json
When show ip ospf border-routers json (without vrf)
specificed, it leads to crash if there no border-routers
information.

Fix:
Do not free json object if use_vrf flag (means vrf option
is not passed) is not set.

Ticket:#3229017
Issue:3229017
Testing Done:

with fix:
l1# show ip ospf border-routers json
{
}
l1# show ip ospf vrf default border-routers json
{
}

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-01-20 23:24:44 -08:00
Rafael Zalamena
fce7f209fc *: introduce function for sequence numbers
Don't directly use `time()` for generating sequence numbers for two
reasons:
1. `time()` can go backwards (due to NTP or time adjustments)
2. Coverity Scan warns every time we truncate a `time_t` variable for
   good reason (verify that we are Y2K38 ready).

Found by Coverity Scan (CID 1519812, 1519786, 1519783 and 1519772)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-01-20 15:40:28 -03:00
Donatas Abraitis
405e1c848f Revert "ospfd: rSPF calc and messaging for optimal route reflection"
This reverts commit a3d3a14c09.
2023-01-17 18:11:56 +02:00
Donatas Abraitis
1ea57af264 Revert "bgpd, ospfd: BGP ORR CI warning fixes"
This reverts commit d6b2761134.
2023-01-17 18:10:04 +02:00
Donatas Abraitis
3228977f58 Revert "ospfd: few fixes in rSPF calc when LSA received from non root node"
This reverts commit 9f2984d97c.
2023-01-17 18:09:55 +02:00
Donatas Abraitis
731d0769e2 Revert "bgpd, ospfd: update BGP when routes are removed from OSPF routing table"
This reverts commit bba9435157.
2023-01-17 18:07:41 +02:00
Donatas Abraitis
e993b11c23 Revert "bgpd: code review comments addressed"
This reverts commit 80f6ea8b99.
2023-01-17 18:07:36 +02:00
Jafar Al-Gharaibeh
8935b0fac6 ospfd: report the router IP with Opaque capability mismatch
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2023-01-06 09:27:18 -06:00
Donatas Abraitis
aca2d29f1e
Merge pull request #12571 from Shikugawa/ospfd-json
ospfd: show ospf database info using formatted json
2023-01-04 22:45:34 +02:00
Rei Shimizu
ff68181eda ospfd: show ospf database info using formatted json
Signed-off-by: Rei Shimizu <rshimizu@apache.org>
2023-01-03 02:06:35 +00:00
Jafar Al-Gharaibeh
eab190351f ospfd: add advertising router IP to Opaque capability mismatch error message
Submitted-by Marc Boucher <marc@airvitesse.net>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2022-12-24 19:59:38 -06:00
Russ White
971930a5f6
Merge pull request #12543 from donaldsharp/ospf_json_mem_leak
ospfd: Fix some json mem leaks and some issues
2022-12-20 11:15:28 -05:00
Donald Sharp
f9f19fef9d ospfd: Fix some json mem leaks and some issues
a) if show_function happened to be NULL we would leak json memory
b) json_lsa_type was being allocated but only used in the default case, leaking memory
c) json output would sometimes produce text output and that is incorrect

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-20 08:45:51 -05:00
Rafael Zalamena
9bf19426e0 ospfd: fix SPF table memory leak
After `free()`ing a table also set it to NULL so when the instance
release function is called we know whether the pointer is valid or not.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-20 08:51:13 -03:00
Sindhu Parvathi Gopinathan
2c248c3ed2 ospfd: json support for show ip ospf border-routers
show ip ospf border-routers json support added.
commands:
  - show ip ospf vrf default border-routers json
  - show ip ospf vrf all border-routers json
  - show ip ospf border-routers json

Testing Done: Unit testing completed.

rut# show ip ospf vrf all border-routers json
{
  "default":{
    "vrfName":"default",
    "vrfId":0,
    "routers":{
      "0.0.0.8":{
        "routeType":"R ",
        "cost":10,
        "area":"0.0.0.1",
        "routerType":"abr",
        "nexthops":[
          {
            "ip":"12.0.0.2",
            "via":"swp1"
          }
        ]
      },
      "0.0.0.9":{
        "routeType":"R ",
        "cost":10,
        "area":"0.0.0.1",
        "routerType":"abr",
        "nexthops":[
          {
            "ip":"12.0.1.2",
            "via":"swp2"
          }
        ]
      }
    }
  }
}

rut#
rut# show ip ospf vrf all border-routers json
{
  "default":{
	"vrfName":"default",
	"vrfId":0,
        "routers":{
  	  "0.0.0.15":{
	    "routeType":"R ",
	    "cost":30,
	    "area":"0.0.0.0",
	    "routerType":"abr",
	    "nexthops":[
		{
		  "ip":"11.0.0.2",
		  "via":"br1"
		}
	     ]
	  }
      }
  }
}

rut# show ip ospf border-routers json
{
  "routers":{
    "0.0.0.15":{
      "routeType":"R ",
      "cost":30,
      "area":"0.0.0.0",
      "routerType":"abr",
      "nexthops":[
        {
	  "ip":"11.0.0.2",
          "via":"br1"
	}
      ]
   }
 }
}

Ticket:#3229017
Issue:3229017

Co-authored-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2022-12-16 08:46:10 -08:00
Donald Sharp
5519e0eb14
Merge pull request #12499 from opensourcerouting/ospf-vertex-leak
ospfd: fix memory leak on SPF calculation
2022-12-12 18:36:07 -05:00
Rafael Zalamena
b3bcfd3dc6 ospfd: fix memory leak on SPF calculation
Fix the following problems:
- Always free vertex next hops on `vertex_parent_free`
- Signalize failure on `ospf_spf_add_parent` when parent already exists
  so the caller has the chance to `free()` any allocated resources.
- Don't reuse vertex next hops without the reference count logic in
  `ospf_nexthop_calculation`. Instead allocate a new copy so it can be
  `free()`d later without complications

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-12 15:16:45 -03:00
Jafar Al-Gharaibeh
bf8d8a5451 ospfd: fix typo and report the link name in the warning
Submitted-by: Marc Boucher <marc@airvitesse.net>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2022-12-12 09:17:27 -06:00
Donald Sharp
253113bcb8 ospfd, ospfclient: Do not just include .c files in another .c
ospfclient.c includes .c files directly from ospfd.  Let's separate
these out a bit.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-05 11:55:14 -05:00
Donald Sharp
29a1a53d6c ospfd: Remove MTYPE_TMP
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-05 11:43:57 -05:00
Russ White
c0a4793035
Merge pull request #12367 from rgirada/ospf_valgrind_fix
ospfd: Fixing a memleak.
2022-11-29 11:23:27 -05:00
Russ White
1407cbaea6
Merge pull request #12334 from ylopez/patch-1
Increase maximum packet size in ospf API
2022-11-29 10:11:32 -05:00
Donald Sharp
7b7ca2d319 ospfd: Do not auto-debug DR-Election notifications
Every 1/2 hour my logs are filling up with this:
2022-11-26 13:54:47.531 [DEBG] ospfd: [P4PQ9-K4XFD] DR-Election[1st]: Backup 192.168.119.229
2022-11-26 13:54:47.531 [DEBG] ospfd: [HBZ7F-65Y86] DR-Election[1st]: DR     192.168.119.229
2022-11-26 13:54:47.531 [DEBG] ospfd: [H01MF-RN00N] DR-Election[2nd]: Backup 0.0.0.0
2022-11-26 13:54:47.531 [DEBG] ospfd: [R7BJ4-KP8JT] DR-Election[2nd]: DR     192.168.119.229

This should be guarded by an if check to ensure that the operator really
wants to see this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-28 08:57:38 -05:00
Donald Sharp
15e78e64b4 ospfd: Do not always debug joining AllDRouters Multicast group
My log file is filling up with:
2022-11-26 13:24:47.532 [DEBG] ospfd: [RY794-DQ7AK] interface 192.168.119.229 [2] join AllDRouters Multicast group.

Every 1/2 hour.  There is nothing an operator needs to do here and nothing
that they can change.  Let's guard this output.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-28 08:53:20 -05:00
rgirada
594f80c83f ospfd: Fixing memleak.
Description:
	As part of signal handler ospf_finish_final(),  lsas are originated
	and added to refresh queues are not freed.

	One such leak is :
	==2869285== 432 (40 direct, 392 indirect) bytes in 1 blocks are definitely lost in loss record 159 of 221
	==2869285==    at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
	==2869285==    by 0x4910EC3: qcalloc (memory.c:116)
	==2869285==    by 0x199024: ospf_refresher_register_lsa (ospf_lsa.c:4017)
	==2869285==    by 0x199024: ospf_refresher_register_lsa (ospf_lsa.c:3979)
	==2869285==    by 0x19A37F: ospf_network_lsa_install (ospf_lsa.c:2680)
	==2869285==    by 0x19A37F: ospf_lsa_install (ospf_lsa.c:2941)
	==2869285==    by 0x19C18F: ospf_network_lsa_update (ospf_lsa.c:1099)
	==2869285==    by 0x1931ED: ism_change_state (ospf_ism.c:556)
	==2869285==    by 0x1931ED: ospf_ism_event (ospf_ism.c:596)
	==2869285==    by 0x494E0B0: thread_call (thread.c:2006)
	==2869285==    by 0x494E395: _thread_execute (thread.c:2098)
	==2869285==    by 0x19FBC6: nsm_change_state (ospf_nsm.c:695)
	==2869285==    by 0x19FBC6: ospf_nsm_event (ospf_nsm.c:861)
	==2869285==    by 0x494E0B0: thread_call (thread.c:2006)
	==2869285==    by 0x494E395: _thread_execute (thread.c:2098)
	==2869285==    by 0x19020B: ospf_if_cleanup (ospf_interface.c:322)
	==2869285==    by 0x192D0C: ism_interface_down (ospf_ism.c:393)
	==2869285==    by 0x193028: ospf_ism_event (ospf_ism.c:584)
	==2869285==    by 0x494E0B0: thread_call (thread.c:2006)
	==2869285==    by 0x494E395: _thread_execute (thread.c:2098)
	==2869285==    by 0x190F10: ospf_if_down (ospf_interface.c:851)
	==2869285==    by 0x1911D6: ospf_if_free (ospf_interface.c:341)
	==2869285==    by 0x1E6E98: ospf_finish_final (ospfd.c:748)
	==2869285==    by 0x1E6E98: ospf_deferred_shutdown_finish (ospfd.c:578)
	==2869285==    by 0x1E7727: ospf_finish (ospfd.c:682)
	==2869285==    by 0x1E7727: ospf_terminate (ospfd.c:652)
	==2869285==    by 0x18852B: sigint (ospf_main.c:105)
	==2869285==    by 0x493BE12: frr_sigevent_process (sigevent.c:130)
	==2869285==    by 0x494DCD4: thread_fetch (thread.c:1775)
	==2869285==    by 0x4905022: frr_run (libfrr.c:1197)
	==2869285==    by 0x187891: main (ospf_main.c:235)

	Added a fix to cleanup all these queue pointers and corresponing lsas in it.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2022-11-22 09:59:40 +00:00
Mobashshera Rasool
ca5997cd01 ospfd: Fix RFC conformance test cases 25.19 and 27.6
Steps to reproduce:
--------------------------
1. ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0 with DUT as DR.
2. ANVL: Listen (for up to 2 * <RxmtInterval> seconds) on DIface-0.
3. DUT: Send <OSPF-LSU> packet.
4. ANVL: Verify that the received <OSPF-LSU> packet contains a Network- LSA for network N1
   originated by DUT, and the LS Sequence Number is set to <InitialSequenceNumber>.
5. ANVL: Establish full adjacency with DUT for neighbor Rtr-0-B on DIface-0 with DUT as DR.
6. ANVL: Listen (for up to 2 * <RxmtInterval> seconds) on DIface-0.
7. DUT: Send <OSPF-LSU> packet.
8. ANVL: Verify that the received <OSPF-LSU> packet contains a new instance of the
   Network-LSA for network N1 originated by DUT, and the LS Sequence Number
   is set to (<InitialSequenceNumber> + 1).

Both the test cases were failing while verifying the initial sequence number for network LSA.

This is because currently OSPF does not reset its LSA sequence number when it is going down.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-11-21 03:19:33 -08:00
ylopez
319cfdc765 ospfd: increase API maximum message size
OSPF_MAX_LSA_SIZE does not represent the actual maximum size of LSA packets which may be larger than 1500 bytes. If relaying a large OSPF packet to the OSPF API, we do not allocate a big enough buffer to send over the API. This patch increases the maximum size of OSPF packets transmitted over the API.

Signed-off-by: ylopez <yoann.lopez@gmail.com>
2022-11-18 09:30:09 +01:00
Jafar Al-Gharaibeh
2bb16f6472
Merge pull request #12269 from pguibert6WIND/ospf_external_lsa_crash
ospfd: prevent from crashing when processing external lsa
2022-11-10 13:20:50 -06:00
Philippe Guibert
e5309c1a6e ospfd: prevent from crashing when processing external lsa
When using debug mode, the ei parameter may be NULL. In that
case, do not display the log trace, otherwise a crash will
happen.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-11-10 15:11:53 +01:00
Donatas Abraitis
0b280b334c
Merge pull request #11302 from punith-shivakumar/master
ospf6d: add missing ABR task on interface start and change default task delay to 5
2022-11-08 21:28:30 +02:00
Donatas Abraitis
bd162aae09 ospfd: Get route-map name for default-information originate
LR1.wue3(config)# route-map foo-bar-baz10 permit 10
LR1.wue3(config-route-map)# exit
LR1.wue3(config)# router ospf
LR1.wue3(config-router)#  ospf router-id 172.18.254.201
LR1.wue3(config-router)#  log-adjacency-changes
LR1.wue3(config-router)# default-information originate metric 50 metric-type 1 route-map foo-bar-baz10
LR1.wue3(config-router)# end

Results in:

LR1.wue3# show run
...
!
router ospf
 ospf router-id 172.18.254.201
 log-adjacency-changes
 default-information originate metric 50 metric-type 1 route-map oute-map
exit
!
route-map foo-bar-baz10 permit 10
exit
!
end

Let's fix this.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-07 22:23:07 +02:00
Donald Sharp
d7cde18c63
Merge pull request #12196 from opensourcerouting/xref-vtysh
*: rewrite `extract.pl` using `xref` infra
2022-11-03 08:54:09 -04:00
Donald Sharp
eec5525e9d
Merge pull request #12195 from anlancs/fix/ospfd-missing-max-metric
ospfd: fix missing max-metric in show running config
2022-10-31 07:40:26 -04:00
Jafar Al-Gharaibeh
5ac678c599
Merge pull request #12215 from LabNConsulting/working/lb/ospf-allow-for-zero
ospfd: remove asster on zero length LSA - which is permitted by spec
2022-10-29 16:58:50 -05:00
Jafar Al-Gharaibeh
d353152de7
Merge pull request #12222 from LabNConsulting/working/lb/fix-p2X-acks
ospfd: fix bug where acks were not be generated to incoming P2P/P2MP peers
2022-10-29 16:57:12 -05:00
Lou Berger
dd3b58a00a ospfd: fix bug where acks were not be generated to incoming P2P/P2MP neighbors
Signed-off-by: Lou Berger <lberger@labn.net>
2022-10-29 17:17:56 +00:00