mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
![]() nhrp_shortcut_terminate() previously was just freeing the associated AFI shortcut RIBs and not addressing existing shortcut cache entries. This cause a use after free issue in vrf_terminate() later in the terminate sequence NHRP: Received signal 7 at 1717516286 (si_addr 0x1955d, PC 0x7098786912c0); aborting... NHRP: zlog_signal+0xf5 709878ad1255 7fff3d992eb0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: core_handler+0xb5 709878b0db85 7fff3d992ff0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: __sigaction+0x50 709878642520 7fff3d993140 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000) NHRP: ---- signal ---- NHRP: __lll_lock_wait_private+0x90 7098786912c0 7fff3d9936d8 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000) NHRP: pthread_mutex_lock+0x112 709878698002 7fff3d9936e0 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000) NHRP: _event_add_read_write+0x63 709878b1f423 7fff3d993700 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: zclient_send_message+0xd4 709878b37614 7fff3d993770 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: nhrp_route_announce+0x1ad 5ab34d63d39d 7fff3d993790 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: nhrp_shortcut_cache_notify+0xd8 5ab34d63e758 7fff3d99d4e0 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: nhrp_cache_free+0x165 5ab34d632f25 7fff3d99d510 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: hash_iterate+0x4d 709878ab949d 7fff3d99d540 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: nhrp_cache_interface_del+0x37 5ab34d633eb7 7fff3d99d580 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: nhrp_if_delete_hook+0x26 5ab34d6350d6 7fff3d99d5a0 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: if_delete_retain+0x3d 709878abcd1d 7fff3d99d5c0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: if_delete+0x4c 709878abd87c 7fff3d99d600 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: if_terminate+0x53 709878abda83 7fff3d99d630 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: vrf_terminate_single+0x24 709878b23c74 7fff3d99d670 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: nhrp_request_stop+0x34 5ab34d636844 7fff3d99d690 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: frr_sigevent_process+0x53 709878b0df53 7fff3d99d6a0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: event_fetch+0x6c5 709878b20405 7fff3d99d6c0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: frr_run+0xd3 709878ac8163 7fff3d99d840 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000) NHRP: main+0x195 5ab34d631915 7fff3d99d960 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) NHRP: __libc_init_first+0x90 709878629d90 7fff3d99d980 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000) NHRP: __libc_start_main+0x80 709878629e40 7fff3d99da20 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000) NHRP: _start+0x25 5ab34d631b65 7fff3d99da70 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000) Signed-off-by: Dave LeRoy <dleroy@labn.net> |
||
---|---|---|
.. | ||
.gitignore | ||
debug.h | ||
linux.c | ||
Makefile | ||
netlink.h | ||
netlink_arp.c | ||
nhrp_cache.c | ||
nhrp_errors.c | ||
nhrp_errors.h | ||
nhrp_event.c | ||
nhrp_interface.c | ||
nhrp_main.c | ||
nhrp_multicast.c | ||
nhrp_nhs.c | ||
nhrp_packet.c | ||
nhrp_peer.c | ||
nhrp_protocol.h | ||
nhrp_route.c | ||
nhrp_shortcut.c | ||
nhrp_vc.c | ||
nhrp_vty.c | ||
nhrpd.h | ||
os.h | ||
README.kernel | ||
README.nhrpd | ||
reqid.c | ||
subdir.am | ||
vici.c | ||
vici.h | ||
zbuf.c | ||
zbuf.h | ||
znl.c | ||
znl.h |
Quagga / NHRP Design and Configuration Notes ============================================ Quagga/NHRP is an NHRP (RFC2332) implementation for Linux. The primary use case is to implement DMVPN. The aim is thus to be compatible with Cisco DMVPN (and potentially with FlexVPN in the future). Current Status -------------- - IPsec integration with strongSwan (requires patched strongSwan) - IPv4 over IPv4 NBMA GRE - IPv6 over IPv4 NBMA GRE -- majority of code exist; but is not tested - Spoke (NHC) functionality complete - Hub (NHS) functionality complete - Multicast support is not done yet (so OSPF will not work, use BGP for now) The code is not (yet) compatible with Cisco FlexVPN style DMVPN. It would require relaying IKEv2 routing messages from strongSwan to nhrpd and parsing that. It is doable, but not implemented for the time being. Routing Design -------------- In contrast to opennhrp routing design, Quagga/NHRP routes each NHRP domain address individually (similar to Cisco FlexVPN). To create NBMA GRE tunnel you might use following: ip tunnel add gre1 mode gre key 42 ttl 64 dev eth0 ip addr add 10.255.255.2/32 dev gre1 ip link set gre1 up This has two important differences compared to opennhrp setup: 1. The 'tunnel add' now specifies physical device binding. Quagga/NHRP wants to know stable protocol address to NBMA address mapping. Thus, add 'dev <physdev>' binding, or specify 'local <nbma-address>'. If neither of this is specified, NHRP will not be enabled on the interface. Alternatively you can skip 'dev' binding on tunnel if you allow nhrpd to manage it using 'tunnel source' command (see below). 2. The 'addr add' now has host prefix. In opennhrp you would have used the GRE subnet prefix length here instead, e.g. /24. Quagga/NHRP will automatically create additional host routes pointing to gre1 when a connection with these hosts is established. The gre1 subnet should be announced by routing protocol. This allows routing protocol to decide which is the closest hub and get the gre addresses' traffic. The second benefit is that hubs can then easily exchange host prefixes of directly connected gre addresses. And thus routing of gre addresses inside hubs is based on routing protocol's shortest path choice -- not on random choice from next hop server list. Configuring nhrpd ----------------- The configuration is done using vtysh, and most commands do what they do in Cisco. As minimal configuration example one can do: configure terminal interface gre1 tunnel protection vici profile dmvpn tunnel source eth0 ip nhrp network-id 1 ip nhrp shortcut ip nhrp registration no-unique ip nhrp nhs dynamic nbma hubs.example.com There's important notes about the "ip nhrp nhs" command: 1. The 'dynamic' works only against Cisco (or nhrpd), but is not compatible with opennhrp. To use dynamic detection of opennhrp hub's protocol address use the GRE broadcast address there. For the above example of 10.255.255.0/24 the configuration should read instead: ip nhrp nhs 10.255.255.255 nbma hubs.example.com 2. nbma <FQDN> works like opennhrp dynamic-map. That is, all of the A-records are configured as NBMA addresses of different hubs, and each hub protocol address will be dynamically detected. Hub functionality ----------------- Sending Traffic Indication (redirect) notifications is now accomplished using NFLOG. Use: iptables -A FORWARD -i gre1 -o gre1 \ -m hashlimit --hashlimit-upto 4/minute --hashlimit-burst 1 \ --hashlimit-mode srcip,dstip --hashlimit-srcmask 16 --hashlimit-dstmask 16 \ --hashlimit-name loglimit-0 -j NFLOG --nflog-group 1 --nflog-range 128 or similar to get rate-limited samples of the packets that match traffic flow needing redirection. This kernel NFLOG target's nflog-group is configured in global nhrp config with: nhrp nflog-group 1 To start sending these traffic notices out from hubs, use the nhrp per-interface directive: ip nhrp redirect opennhrp used PF_PACKET and tried to create packet filter to get only the packets of interest. Though, this was bad if shortcut fails to establish (remote policy, or both are behind NAT or restrictive firewalls), all of the relayaed traffic would match always. Getting information via vtysh ----------------------------- Some commands of interest: - show dmvpn - show ip nhrp cache - show ip nhrp shortcut - show ip route nhrp - clear ip nhrp cache - clear ip nhrp shortcut Integration with strongSwan --------------------------- Contrary to opennhrp, Quagga/NHRP has tight integration with IKE daemon. Currently strongSwan is supported using the VICI protocol. strongSwan is connected using UNIX socket (default /var/run/charon.vici use configure argument --with-vici-socket= to change). Thus nhrpd needs to be run as user that can open that file. Currently, you will need patched strongSwan. The working tree is at: http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras And the branch with patches against latest release are: http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras-release