summaryrefslogtreecommitdiff
path: root/pimd/pim_rp.c
AgeCommit message (Collapse)Author
2021-07-01*: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLENDonatas Abraitis
Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-05-12pimd: Remove pim->vrf_id and use pim->vrf->vrf_idDonald Sharp
VRF creation can happen from either cli or from knowledged about the vrf learned from zebra. In the case where we learn about the vrf from the cli, the vrf id is UNKNOWN. Upon actual creation of the vrf, lib/vrf.c touches up the vrf_id and calls pim_vrf_enable to turn it on properly. At this point in time we have a pim->vrf_id of UNKNOWN and the vrf->vrf_id of the right value. There is no point in duplicating this data. So just remove all pim->vrf_id and use the vrf->vrf_id instead since we keep a copy of the pim->vrf pointer. This will remove some crashes where we expect the pim->vrf_id to be usable and it's not. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-03pimd: cleanup & convert bsm_rpinfo to TS listDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-02-14*: remove tabs & newlines from log messagesDavid Lamparter
Neither tabs nor newlines are acceptable in syslog messages. They also break line-based parsing of file logs. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-01-08pimd : Added the command to clear the pim bsr data.vdhingra
This command has been added in the context of PIM BSM functionality. This command will clear the data structs having bsr information. Co-authored-by: Sarita Patra <saritap@vmware.com> Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2020-12-14*: Replace s_addr check agains 0 with INADDR_ANYDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-11-19Merge pull request #6145 from patrasar/pim_nb_code_upstreamDonald Sharp
pimd: northbound backend code
2020-11-06pimd: Northbound implementation for rp commands.Sarita Patra
ip_pim_rp ip_pim_rp_prefix_list no_ip_pim_rp no_ip_pim_rp_prefix_list module: frr-pim-rp augment /frr-routing:routing/frr-routing:control-plane-protocols/frr-routing:control-plane-protocol/frr-pim:pim/frr-pim:address-family: +--rw rp +--rw static-rp +--rw rp-list* [rp-address] +--rw rp-address ietf-inet-types:ip-address +--rw (group-list-or-prefix-list)? +--:(group-list) | +--rw group-list* ip-multicast-group-address-prefix +--:(prefix-list) +--rw prefix-list? plist-ref Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-10-22pimd: replace inet_ntoaMark Stapp
Replace all use of inet_ntoa, using %pI4 or inet_ntoa instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-17*: Create/Use accessor functions for lock countDonald Sharp
Create appropriate accessor functions for the rn->lock data. We should be accessing this data through accessor functions since it is private data to the data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-07-16pimd: Cleanup leaked memory from rp initializationDonald Sharp
When creating a pim instance, we were allocating table information but never freeing it. Do so. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-23Merge pull request #6262 from qlyoung/remove-sprintfDavid Lamparter
2020-04-23Merge pull request #6025 from patrasar/rp-info-igmp-group-json-fixDonatas Abraitis
pimd: Modified rp-info json o/p
2020-04-22pimd: Added a new field "rpAddress" in "show ip pim rp-info jsonSarita Patra
Fix: Added a new field "rpAddress" in "show ip pim rp-info json" Before: "40.0.0.2":[ { "outboundInterface":"ens224", "group":"224.0.0.0\/4", "source":"Static" } After: "40.0.0.2":[ { "rpAddress":"40.0.0.2", "outboundInterface":"ens224", "group":"224.0.0.0\/4", "source":"Static" } Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-04-20*: sprintf -> snprintfQuentin Young
Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-17pimd: don't use strcpyQuentin Young
>:( Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-03-18Merge pull request #5882 from patrasar/2386429Donatas Abraitis
pimd: fix pim interface traffic & pim rp-info json command
2020-03-16pimd: fix pim interface traffic & pim rp-info json commandSarita Patra
Issue 1: "show ip pim interface traffic" not show prune TX/RX Rootcause : not added the variable in the json Fix : add prune TX/RX in show ip pim interface traffic json Issue 2: "show ip pim rp-info" not shows the key iAmRp when it is false Rootcause: Only display the key when the value is true. Fix: add iAmRp as false in show ip pim rp-info json Issue 3: "show ip pim rp-info" not showing outbound interface if it is empty Rootcause: Only display when there is any OIL Fix: When RP is not reachable then, the outbound interface is Unknown The command "show ip pim rp-info json" not displaying the outbound interafce if it is unknown Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-15pimd: moving the route_unlock_node outside debug functionsaravanank
Problem: Route node is not de referenced after search when pim debug events are not enabled when pim_rp_find_match_group is called. So this memory will not get released when route node is deleted after hitting this path. RCA: Dereferencing is done inside debug condition. Fix: Moving outside debug condition Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-06*: Finish off the __PRETTY_FUNCTION__ to __func__Donald Sharp
FINISH IT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-01-03pimd: Convert the upstream_list and hash to a rb treeDonald Sharp
Convert the upstream_list and hash to a rb tree, Significant time was being spent in the listnode_add_sort. This reduces this time greatly. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-06Merge pull request #5355 from AnuradhaKaruppiah/pim-state-machine-fixesJafar Al-Gharaibeh
PIM state machine fixes
2019-11-19pimd: Various buffer overflow reads and crashesDonald Sharp
A variety of buffer overflow reads and crashes that could occur if you fed bad info into pim. 1) When type is setup incorrectly we were printing the first 8 bytes of the pim_parse_addr_source, but the min encoding length is 4 bytes. As such we will read beyond end of buffer. 2) The RP(pim, grp) macro can return a NULL value Do not automatically assume that we can deref the data. 3) BSM parsing was not properly sanitizing data input from wire and we could enter into situations where we would read beyond the end of the buffer. Prevent this from happening, we are probably left in a bad way. 4) The received bit length cannot be greater than 32 bits, refuse to allow it to happen. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-18Merge pull request #5360 from donaldsharp/pim_crash_rpJafar Al-Gharaibeh
Pim crash rp
2019-11-18pimd: Dissallow obvious addresses from being the RPDonald Sharp
When configuring a RP, dissallow the choice of 0.0.0.0 or 255.255.255.255 as the address as that they make no sense what so ever. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-18pimd: Tighten up `show ip pim rp-info`Donald Sharp
We were adding a newline for the source in some cases but not others and tighten up the display of data eva# show ip pim rp-info RP address group/prefix-list OIF I am RP Source 10.254.0.1 224.0.0.0/4 lo yes Static 4.4.4.4 225.1.2.3/32 abcdefghijklmno yes Static 10.0.20.45 226.200.100.100/32 r1-eth0 no Static eva# Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-15pimd: RPF change to unreachable was leaving a stale entry in the jp-agg listAnuradha Karuppiah
This was causing pimd to crash later; call-stack - (gdb) bt context=<optimized out>) at lib/sigevent.c:254 group=group@entry=0x7ffffa9797e0) at pimd/pim_rp.c:207 grp=grp@entry=0x7ffffa9799fe, sgs=sgs@entry=0x560ac069edb0, size=52) at pimd/pim_msg.c:200 groups=<optimized out>) at pimd/pim_join.c:562 at pimd/pim_neighbor.c:288 at lib/thread.c:1599 at lib/libfrr.c:1024 envp=<optimized out>) at pimd/pim_main.c:162 (gdb) fr 4 group=group@entry=0x7ffffa9797e0) at pimd/pim_rp.c:207 207 pimd/pim_rp.c: No such file or directory. (gdb) fr 6 grp=grp@entry=0x7ffffa9799fe, sgs=sgs@entry=0x560ac069edb0, size=52) at pimd/pim_msg.c:200 200 pimd/pim_msg.c: No such file or directory. (gdb) p source->up->sg_str $1 = '\000' <repeats 31 times>, <incomplete sequence \361> (gdb) This problem can manifest in the following event sequence - 1. upstream RPF neighbor is resolved 2. upstream RPF neighbor becomes unresolved (but upstream entry stays on the jp-agg list) 3. upstream entry is removed on the next old-neighbor jp-agg-list processing the stale entry is accessed resulting in the crash. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15pimd: add caller string prefix to pim_rpf_update logsAnuradha Karuppiah
No functional change; log enhancements only. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15pimd: on some triggers use_rpt re-evaluated for all groupsAnuradha Karuppiah
RP config change is a big hammer and use_rpt/spt needs to be re-evaluated on all existing (S,G) entries. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15pimd: set mfcc_parent at the time of MFCC programmingAnuradha Karuppiah
mfcc_parent for an (S, G) entry was being updated on any upstream RPF change. With the change to use RPT for (S,G) in some cases we can no longer do that. Instead the upstream entry's RPF neigbor is managed separately form the channel_oil's mfcc_parent i.e. via NHT. And the mfcc_parent is evaluated at the time of mroute programming. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-12pimd: `debug igmp trace` turns on non igmp debugsDonald Sharp
When you turn on `debug igmp trace` we are seeing a bunch of debugs associated with pim processing. This is because we were using PIM_DEBUG_TRACE which is both `debug igmp trace` and `debug pim trace` when tracing igmp code it would be nice to only see igmp work. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-24pimd: Initialize nht_p variableDonald Sharp
nht_p.family and .prefixlen have code paths where we may not initialize. Fix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-07pimd: Remove unnecessary boolean to pim_rpf_updateDonald Sharp
We already log whether or not we add nht tracking, having an additional boolean to say to log another line is a bit over the top. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-14pimd: rp_new & rp_del split into 2 tier functions & implement rp_changesaravanank
pim_rp_new split into pim_rp_new_config and pim_rp_new. pim_rp_new_config is called by CLI. pim_rp_new will be called by pim_rp_new_config and bsm rp config. pim_rp_del is split into pim_rp_del_config and pim_rp_del pim_rp_del_config is called by CLI. pim_rp_del is called by pim_rp_del_config and bsm rp config Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14pimd: Show RP source in show ip pim rp-info commandsaravanank
Sw3# sh ip pim rp-info RP address group/prefix-list OIF I am RP Source 20.0.0.2 225.1.1.1/32 ens192 no BSR 9.9.9.9 226.1.1.1/32 (Unknown) no BSR 30.0.0.100 229.1.1.5/32 ens192 no Static Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14pimd: PIM nexthop tracking changes for tracking nexthop path of BSR.saravanank
Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-04-05pimd: Tracking of RPF is *separate* from the lookupDonald Sharp
Start the separation of tracking a Destination from the act of looking it up. The cojoining of these two concepts led to a bunch of code that had to think about both problems leading to weird situations and code paths. Simplify the code by making pim_ecmp_nexthop_search a static function and we only ever call pim_ecmp_nexthop_lookup when we need to do a RPF(). pim_ecmp_nexthop_lookup will now attempt to find a stored pnc and if it finds one it will report on the answer from it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-05pimd: Determining if we are the RP should happen alwaysDonald Sharp
When creating new RP information from a `ip pim rp A.B.C.D/M A.B.C.D` we should determine if we are the RP even if we can or cannot determine if we have a path to the RP via RPF. This is because we should determine if we are the RP based upon a connected ip address match not whether or not we have a path to the RPF. We would normally think this is not important but RPF is inherently asynchronous and we can have a state where we have registered for nht but have not received the actual path back yet from zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-02pimd: Limit lookup of neighbor since we know we have oneDonald Sharp
When a new pim neighbor comes up, we need to go through and mark nexthops that we have received from zebra for reachability tracking so we can refigure stuff. If we pass in the new neighbor we can limit the search to those nexthops out the interface that the new neighbor has come up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-01Merge pull request #4040 from donaldsharp/pim_cleanupJafar Al-Gharaibeh
Pim cleanup
2019-03-28pimd: Reduce RP checks a bitDonald Sharp
The pim_rp_check_is_my_ip_address function was checking to see if we were the actual RP as well as the pim_register code was doing the same thing. Remove the reduncancy a bit and just make this function check for that we are the actual receiver of this data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-26pimd: Interfaces can be upto 16 charactersDonald Sharp
The interface column in pim was limited to 8 or 9 columns all over the place in pim, fix the code up to allow interface length to be up to 16 columns. Ticket: CM-23083 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-20Merge pull request #3863 from patrasar/RP_addition_deletion_changesDonald Sharp
Rp addition deletion changes
2019-02-25*: remove null check before XFREEQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-24pimd: update pim upstream structure when RP gets deletedSarita Patra
When a RP gets deleted, find all the (*, G) upstream whose group belongs to the deleted RP. case 1: if the group belongs to any other rp, then call pim_upstream_update() to update the upstream addr and rpf information. case 2: If no RP found for the group, then clear the pim upstream address and rpf information. Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24pimd: update pim upstream structure when RP gets configuredSarita Patra
When a new RP is configured, find all the (*, G) upstream whose group belongs to the new RP and then update the upstream structure with the below fields. 1. De-register for the old RP. 2. Set the upstream address as new RP 3. Register for the new RP. 4. Update the upstream rpf information and kernel multicast forwarding cache(MFC), if the new RP is reachable. Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24pimd: create dummy (*,G) upstream when RP not configured/reachableSarita Patra
In this commit, we are creating a dummy upstream & dummy channel_oil for (*, G) when RP is not configured or not reachable. Dummy upstream: <upstream_addr = INADDR_ANY, rpf = Unknown> Dummy channel oil: <iif = MAXVIFS> Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-08pimd: reject inconsistent address/mask "ip pim rp command"Sarita Patra
Issue: Configure "ip pim rp x.x.x.x 225.0.0.0/4". Show running config shows "ip pim rp x.x.x.x 224.0.0.0/4" This is mis-leading. Root-cause: Internally 225.0.0.0/4 is getting converted to 224.0.0.0/4 group mask, since the prefix length is 4. Fix: Restrict the user to configure inconsistent group address mask by throughing a cli error "Inconsistent address and mask". Signed-off-by: Sarita Patra <saritap@vmware.com>