Remove from MSDP peer data structure two temporary variables
that should only be used when calling library functions.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Fully flushed out the AutoRP implementation now with the AutoRP mapping agent.
This touched most of AutoRP in order to have common reuse of containers for each
section of AutoRP operation (Candidate RP announcement, Mapping agent, Discovery).
Many debugs had guards added and many more debug logs added.
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Fix Coverity Scan CID 1601875: use the return value to tell user about
the availability of a next hop to the learned RP (needs debug enabled).
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Signalize termination to functions so they can avoid accessing pointers
that might be no longer available.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
When a multicast route is created with embedded RP the channel oil
never gets decremented when `clear ipv6 mroute` is called.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Implement embedded RP support and configuration commands.
Embedded RP is disabled by default and can be globally enabled with the
command `embedded-rp` in the PIMv6 configuration node.
It supports the following options:
- Embedded RP maximum limit
- Embedded RP group filtering
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This only matters to single hop nodes that are adjacent to the bsr. More common
with IPv6 where LL address is used in PIM as the primary address. If the BSR IP
happens to be an address on the same interface, the receiving pim router
rejects the BSR address because it expects the BSR IP to resolve via the LL address
even if we have a connected route for the same BSR IP subnet. Effectively, we want to
allow rpf to be resolved via secondary IPs with connected routes on the same interface,
and not limit them to primary addresses.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
If a packet doesn't have an interface, we're gonna crash 2 lines below.
An assert is a little more useful... and makes clang-SA not complain
about it.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
The `buf` pointer is being updated as the parse goes along. It's not
used after the last update, but I'd rather keep this in for consistency.
Just make a note of it being unused.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
clang-SA complains that it's only partially initialized (because it's
used with IPv4 only). The code later calls some AF-generic code,
prompting clang-SA to complain that the non-IPv4 parts are used without
being set. While this shouldn't happen, just initialize it fully.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Currently FRR needs to send a uint16_t value for the number
of nexthops as well it needs the ability to properly decode
all of this. Find and handle all the places that this happens.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Currently FRR is limiting the nexthop count to a uint8_t not a
uint16_t. This leads to issues when the nexthop count is 256
which results in the count to overflow to 0 causing problems
in the code.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
In `pim_if_addr_add()`, some code inside `PIM_IPV == 4`
( the case of `igmp->mtrace_only` ) wrongly accepts ipv6 address.
So, clearly add IPV4 check.
Signed-off-by: anlan_cs <anlan_cs@126.com>
```
ERROR: AddressSanitizer: heap-use-after-free on address 0x6160000aecf0 at pc 0x5555557ecdb9 bp 0x7fffffffe350 sp 0x7fffffffe340
READ of size 4 at 0x6160000aecf0 thread T0
#0 0x5555557ecdb8 in igmp_source_delete pimd/pim_igmpv3.c:340
#1 0x5555557ed475 in igmp_source_delete_expired pimd/pim_igmpv3.c:405
#2 0x5555557de574 in igmp_group_timer pimd/pim_igmp.c:1346
#3 0x7ffff7275421 in event_call lib/event.c:1996
#4 0x7ffff7140797 in frr_run lib/libfrr.c:1237
#5 0x5555557f5840 in main pimd/pim_main.c:166
#6 0x7ffff6a54082 in __libc_start_main ../csu/libc-start.c:308
#7 0x555555686eed in _start (/usr/lib/frr/pimd+0x132eed)
0x6160000aecf0 is located 112 bytes inside of 600-byte region [0x6160000aec80,0x6160000aeed8)
freed by thread T0 here:
#0 0x7ffff767b40f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x7ffff716ed34 in qfree lib/memory.c:131
#2 0x5555557169ae in pim_channel_oil_free pimd/pim_oil.c:84
#3 0x555555717981 in pim_channel_oil_del pimd/pim_oil.c:199
#4 0x55555573c42c in tib_sg_gm_prune pimd/pim_tib.c:196
#5 0x5555557d6d04 in igmp_source_forward_stop pimd/pim_igmp.c:229
#6 0x5555557d5855 in igmp_anysource_forward_stop pimd/pim_igmp.c:61
#7 0x5555557de539 in igmp_group_timer pimd/pim_igmp.c:1344
#8 0x7ffff7275421 in event_call lib/event.c:1996
#9 0x7ffff7140797 in frr_run lib/libfrr.c:1237
#10 0x5555557f5840 in main pimd/pim_main.c:166
#11 0x7ffff6a54082 in __libc_start_main ../csu/libc-start.c:308
previously allocated by thread T0 here:
#0 0x7ffff767ba06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153
#1 0x7ffff716ebe1 in qcalloc lib/memory.c:106
#2 0x555555716eb7 in pim_channel_oil_add pimd/pim_oil.c:133
#3 0x55555573b2b9 in tib_sg_oil_setup pimd/pim_tib.c:30
#4 0x55555573bdd3 in tib_sg_gm_join pimd/pim_tib.c:119
#5 0x5555557d6788 in igmp_source_forward_start pimd/pim_igmp.c:193
#6 0x5555557d5771 in igmp_anysource_forward_start pimd/pim_igmp.c:51
#7 0x5555557ecaa0 in group_exclude_fwd_anysrc_ifempty pimd/pim_igmpv3.c:310
#8 0x5555557ef937 in toex_incl pimd/pim_igmpv3.c:839
#9 0x5555557f00a2 in igmpv3_report_toex pimd/pim_igmpv3.c:938
#10 0x5555557f543d in igmp_v3_recv_report pimd/pim_igmpv3.c:2000
#11 0x5555557da2b4 in pim_igmp_packet pimd/pim_igmp.c:787
#12 0x5555556ee46a in process_igmp_packet pimd/pim_mroute.c:763
#13 0x5555556ee5f3 in pim_mroute_msg pimd/pim_mroute.c:787
#14 0x5555556eef58 in mroute_read pimd/pim_mroute.c:877
#15 0x7ffff7275421 in event_call lib/event.c:1996
#16 0x7ffff7140797 in frr_run lib/libfrr.c:1237
#17 0x5555557f5840 in main pimd/pim_main.c:166
#18 0x7ffff6a54082 in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: heap-use-after-free pimd/pim_igmpv3.c:340 in igmp_source_delete
Shadow bytes around the buggy address:
0x0c2c8000dd40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000dd50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000dd60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000dd70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000dd80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c2c8000dd90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd
0x0c2c8000dda0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000ddb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000ddc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c2c8000ddd0: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
0x0c2c8000dde0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
```
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
New CLI commands added:
router pim [vrf NAME]
autorp discovery
autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}
autorp discovery
Enables Auto RP discovery for learning dynamic RP information using the
AutoRP protocol.
autorp announce RP-ADDR [GROUP | group-list PREFIX-LIST]
Enable announcements of a candidate RP with the given group range, or
prefix list of group ranges, to an AutoRP mapping agent.
autorp announce {scope (1-255) | interval (1-65535) | holdtime (0-65535)}
Configure the parameters of the AutoRP announcement messages.
The scope sets the packet TTL.
The interval sets the time between TX of announcements.
The holdtime sets the hold time in the message, the time the mapping
agent should wait before invalidating the candidate RP information.
debug pim autorp
Enable debug logging of the AutoRP protocol
show ip pim [vrf NAME] autorp [json]
Show details of the AutoRP protocol.
To view learned RP info, use the existing command 'show ip pim rp-info'
Extend pim yang for new configuration:
augment /frr-rt:routing/frr-rt:control-plane-protocols/frr-rt:control-plane-protocol/frr-pim:pim/frr-pim:address-family:
+--rw rp
+--rw auto-rp
+--rw discovery-enabled? boolean
+--rw announce-scope? uint8
+--rw announce-interval? uint16
+--rw announce-holdtime? uint16
+--rw candidate-rp-list* [rp-address]
+--rw rp-address inet:ip-address
+--rw (group-or-prefix-list)?
+--:(group)
| +--rw group? frr-route-types:ip-multicast-group-prefix
+--:(prefix-list)
+--rw prefix-list? plist-ref
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Perform AutoRP discovery and candidate RP announcements using the
AutoRP protocol.
Mapping agent is not yet implemented, but this feature is not
necessary for FRR to support AutoRP as we only need one AutoRP
mapping agent in the network.
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
Use existing igmp static join infrastructure.
Add an enum to distinguish static from proxy joins.
Signed-off-by: Barry A. Trent <barry.trent@atcorp.com>
This change re-adds an additional check bsr rpf that was removed
in 2c6a32f9be.
Without that check, bsr messages is resent (causing a loop) if we
have more than one pim neighbor on a link.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
When trying to track down a MTYPE_TMP memory leak
it's harder to search for it when you happen to
have some usage of ttable_dump. Let's just give
it it's own memory type so that we can avoid
confusion in the future.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>