mirror_frr/ospf6d
Donald Sharp 6188d70c21 ospf6d: Fix crash because neighbor structure was freed
The loading_done event needs a event pointer to prevent
use after free's.  Testing found this:

    ERROR: AddressSanitizer: heap-use-after-free on address 0x613000035130 at pc 0x55ad42d54e5f bp 0x7ffff1e942a0 sp 0x7ffff1e94290
    READ of size 1 at 0x613000035130 thread T0
        #0 0x55ad42d54e5e in loading_done ospf6d/ospf6_neighbor.c:447
        #1 0x55ad42ed7be4 in event_call lib/event.c:1995
        #2 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #3 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #4 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
        #5 0x55ad42cf2b19 in _start (/usr/lib/frr/ospf6d+0x248b19)

    0x613000035130 is located 48 bytes inside of 384-byte region [0x613000035100,0x613000035280)
    freed by thread T0 here:
        #0 0x7f57998d77a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
        #1 0x55ad42e3b4b6 in qfree lib/memory.c:130
        #2 0x55ad42d5d049 in ospf6_neighbor_delete ospf6d/ospf6_neighbor.c:180
        #3 0x55ad42d1e1ea in interface_down ospf6d/ospf6_interface.c:930
        #4 0x55ad42ed7be4 in event_call lib/event.c:1995
        #5 0x55ad42ed84fe in _event_execute lib/event.c:2086
        #6 0x55ad42d26d7b in ospf6_interface_clear ospf6d/ospf6_interface.c:2847
        #7 0x55ad42d73f16 in ospf6_process_reset ospf6d/ospf6_top.c:755
        #8 0x55ad42d7e98c in clear_router_ospf6_magic ospf6d/ospf6_top.c:778
        #9 0x55ad42d7e98c in clear_router_ospf6 ospf6d/ospf6_top_clippy.c:42
        #10 0x55ad42dc2665 in cmd_execute_command_real lib/command.c:994
        #11 0x55ad42dc2b32 in cmd_execute_command lib/command.c:1053
        #12 0x55ad42dc2fa9 in cmd_execute lib/command.c:1221
        #13 0x55ad42ee3cd6 in vty_command lib/vty.c:591
        #14 0x55ad42ee4170 in vty_execute lib/vty.c:1354
        #15 0x55ad42eec94f in vtysh_read lib/vty.c:2362
        #16 0x55ad42ed7be4 in event_call lib/event.c:1995
        #17 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #18 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #19 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

    previously allocated by thread T0 here:
        #0 0x7f57998d7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
        #1 0x55ad42e3ab22 in qcalloc lib/memory.c:105
        #2 0x55ad42d5c8ff in ospf6_neighbor_create ospf6d/ospf6_neighbor.c:119
        #3 0x55ad42d4c86a in ospf6_hello_recv ospf6d/ospf6_message.c:464
        #4 0x55ad42d4c86a in ospf6_read_helper ospf6d/ospf6_message.c:1884
        #5 0x55ad42d4c86a in ospf6_receive ospf6d/ospf6_message.c:1925
        #6 0x55ad42ed7be4 in event_call lib/event.c:1995
        #7 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #8 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #9 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Add an actual event pointer and just track it appropriately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-07-03 09:44:05 +03:00
..
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
Makefile build: non-recursive ospf* 2017-08-04 11:09:50 +02:00
ospf6_abr.c ospf6d: ospf6_route_cmp_nexthops make return sane 2022-11-28 09:41:03 -05:00
ospf6_abr.h ospf6d: code cleanup. 2021-10-06 08:54:47 -07:00
ospf6_area.c Merge pull request #12196 from opensourcerouting/xref-vtysh 2022-11-03 08:54:09 -04:00
ospf6_area.h ospf6d: remove unused constants 2021-11-23 14:24:07 -03:00
ospf6_asbr.c ospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackhole. 2022-12-19 03:52:59 -08:00
ospf6_asbr.h ospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackhole. 2022-12-19 03:52:59 -08:00
ospf6_auth_trailer.c ospf6d: Ensure that ospf6d does not memcpy beyond end of data 2022-06-23 13:43:25 -04:00
ospf6_auth_trailer.h ospf6d: fix coverity issues. 2022-02-14 06:36:02 +00:00
ospf6_bfd.c *: cleanup ifp->vrf_id 2021-11-22 20:47:23 +03:00
ospf6_bfd.h ospf6d: rework BFD integration 2021-04-22 16:10:01 -03:00
ospf6_flood.c ospfd, ospf6d: Add more logging details 2023-03-17 11:55:53 +00:00
ospf6_flood.h ospf6d: Remove ospf6->external_id_table 2021-11-23 19:49:28 -05:00
ospf6_gr_helper.c ospfd, ospf6d: Add more logging details 2023-03-17 11:55:53 +00:00
ospf6_gr.c build, vtysh: extract vtysh commands from .xref 2022-10-26 17:12:34 +01:00
ospf6_gr.h ospf6d: Addressing few coverity issues. 2021-10-29 11:04:06 -07:00
ospf6_interface.c ospf6d: Fix auth_key string memory leak 2022-12-15 11:15:33 -05:00
ospf6_interface.h *: Change thread->func to return void instead of int 2022-02-23 19:56:04 -05:00
ospf6_intra.c ospf6d: combine two conditions for lsa prefix 2022-08-02 21:09:33 -04:00
ospf6_intra.h *: Change thread->func to return void instead of int 2022-02-23 19:56:04 -05:00
ospf6_lsa.c *: Drop deprecated incorrect JSON fields with wrong naming 2023-01-31 10:18:28 +02:00
ospf6_lsa.h *: Change thread->func to return void instead of int 2022-02-23 19:56:04 -05:00
ospf6_lsdb.c ospf6d: crash in ospf6_decrement_retrans_count. 2022-03-17 16:58:02 +05:30
ospf6_lsdb.h *: Fix spelling of accidently 2022-04-19 08:31:30 -04:00
ospf6_main.c ospf6d: support keychain for ospf6 authentication 2022-02-09 01:56:38 +00:00
ospf6_message.c ospf6d: Fix crash because neighbor structure was freed 2023-07-03 09:44:05 +03:00
ospf6_message.h *: Change thread->func to return void instead of int 2022-02-23 19:56:04 -05:00
ospf6_neighbor.c ospf6d: Fix crash because neighbor structure was freed 2023-07-03 09:44:05 +03:00
ospf6_neighbor.h ospf6d: Fix crash because neighbor structure was freed 2023-07-03 09:44:05 +03:00
ospf6_network.c *: Properly use memset() when zeroing 2022-05-11 14:08:47 +03:00
ospf6_network.h ospf6d: add dbdesc messages to tx FIFO 2021-06-18 09:40:42 +01:00
ospf6_nssa.c Merge pull request #12191 from manojvn/463777 2022-12-13 09:58:04 -05:00
ospf6_nssa.h ospf6d: fix test_ospf6_gr_topo1 topotest 2022-07-13 10:01:11 +00:00
ospf6_proto.c ospf6d: Stitching the auth trailer code with rest of ospf6. 2022-02-09 01:57:08 +00:00
ospf6_proto.h ospf6d: Stitching the auth trailer code with rest of ospf6. 2022-02-09 01:57:08 +00:00
ospf6_route.c ospf6d: Consolidate to ospf6_route_is_identical 2022-11-28 10:30:31 -05:00
ospf6_route.h ospf6d: ospf6_route_cmp_nexthops make return sane 2022-11-28 09:41:03 -05:00
ospf6_routemap_nb_config.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
ospf6_routemap_nb.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
ospf6_routemap_nb.h ospf6d: North-bound implementation for ospf6d rmaps 2021-03-30 22:59:30 +03:00
ospf6_snmp.c *: cleanup ifp->vrf_id 2021-11-22 20:47:23 +03:00
ospf6_spf.c ospf6d: missing ECMP NHs in certain topologies 2023-04-14 13:09:47 +00:00
ospf6_spf.h ospf6d: missing ECMP NHs in certain topologies 2023-04-14 13:09:47 +00:00
ospf6_top.c *: Drop deprecated incorrect JSON fields with wrong naming 2023-01-31 10:18:28 +02:00
ospf6_top.h *: Fix spelling of Gracefull 2022-04-02 07:46:19 -04:00
ospf6_zebra.c ospf6: permit route delete without nexthops 2022-06-17 11:47:55 -04:00
ospf6_zebra.h ospf6d: implement Type-7 default routes for NSSA areas 2021-09-21 17:47:13 -03:00
ospf6d.c *: Create and use infrastructure to show debugs in lib 2022-10-07 12:39:05 -04:00
ospf6d.h ospf6d: give error information for commands with non-exist vrfs 2022-01-11 04:21:05 -05:00
README ospf6d: add "auto-cost reference-bandwidth" command 2014-03-21 06:28:48 +01:00
subdir.am build, vtysh: extract vtysh commands from .xref 2022-10-26 17:12:34 +01:00

		  Zebra OSPF daemon for IPv6 network

			     2003/08/18

README for newer code is not yet. General usage should remain
the same. For further usage, see command helps by typing '?'
in vty, and then imagin ! ;p) Previous README contents follows.

		  Zebra OSPF daemon for IPv6 network

			     2001/12/20

Zebra OSPF6d is OSPF version 3 daemon which is specified by
"OSPF for IPv6" (RFC 2740).

*** NOTE ***
  Zebra ospf6d is in development yet. It may lack some functionalities,
  and may have some bugs. Use the latest version from the anoncvs
  repository (http://www.zebra.org/cvs.html) !

This file README is like memo yet, so please feel free to ask
<yasu@sfc.wide.ad.jp> by E-mail. Patches will be appriciated.

ospf6d's vty port was default to 2606/tcp.
Use commands below.

VIEW NODE:
  show ipv6 ospf6
    To see Router-ID, uptime of ospf6d, some statistics.

  show ipv6 ospf6 database ...
    This command shows LSA database. You can specify
    LS-type/LS-ID/Advertising-Router of LSAs. '*' is recognized.

  show ipv6 ospf6 interface ...
    To see the status of the OSPF interface, and the configuration
    like interface costs.

  show ipv6 ospf6 neighbor ...
    Shows state of neighbors and choosed (Backup) DR on the I/F.

  show ipv6 ospf6 route (X::X)
    This command shows internal routing table of the ospf6d.
    Routes not calculated by OSPFv3 (like connected routes)
    are not shown. If Address is specified (X::X), shows the route
    that the address matches.

  show ipv6 ospf6 route redistribute (X::X)
    Shows the routes advertised as AS-External routes by the router
    itself. If Address is specified (X::X), shows the route
    that the address matches.

CONFIG NODE:
  interface NAME
    To enter INTERFACE NODE

  router ospf6 ...
    To enter OSPF6 NODE

INTERFACE NODE:
  ipv6 ospf6 cost COST
    Sets the interface's output cost. Depends on interface bandwidth by default.

  ipv6 ospf6 hello-interval HELLOINTERVAL
    Sets the interface's Hello Interval. default 10

  ipv6 ospf6 dead-interval DEADINTERVAL
    Sets the interface's Router Dead Interval. default 40

  ipv6 ospf6 retransmit-interval RETRANSMITINTERVAL
    Sets the interface's Rxmt Interval. default 5

  ipv6 ospf6 priority PRIORITY
    Sets the interface's Router Priority. default 1

  ipv6 ospf6 transmit-delay TRANSMITDELAY
    Sets the interface's Inf-Trans-Delay. default 1

OSPF6 NODE:
  router-id A.B.C.D
    Sets the router's Router-ID

  interface NAME area AREA
    Binds interface to specified Area, and start
    sending OSPFv3 packets.

  auto-cost reference-bandwidth COST
    Sets the reference bandwidth for cost calculations, where this
    bandwidth is considered equivalent to an OSPF cost of 1, specified
    in Mbits/s. The default is 100Mbit/s (i.e. a link of bandwidth
    100Mbit/s or higher will have a cost of 1. Cost of lower bandwidth
    links will be scaled with reference to this cost).  This
    configuration setting MUST be consistent across all routers within
    the OSPF domain.

Sample configuration is in ospf6d.conf.sample.

--
Yasuhiro Ohara <yasu@sfc.wide.ad.jp>
Kunihiro Ishiguro <kunihiro@zebra.org>