Commit Graph

177 Commits

Author SHA1 Message Date
Donald Sharp
d1a85fe40d
Merge pull request #2608 from pacovn/PVS-Studio_dead_code_1
eigrpd lib pimd zebra: dead code (PVS-Studio)
2018-07-19 08:50:01 -04:00
Donald Sharp
2b57b94834 pimd: Remove unnecessary alloc failures
Remove from pim unnecessary alloc failure testing
as that alloc failure will cause an assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-08 12:09:21 -04:00
F. Aragon
2e1cc43679
eigrpd lib pimd zebra: dead code (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-06 01:10:15 +02:00
Donald Sharp
7692c5ae82 pimd: Cleanup ifchannel deletion
When we are being told to go away, cleanup ifchannel deletion
a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:36:24 -04:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Donald Sharp
55cd0f612a *: Make assignment from RB_ROOT in while loop work better
Fix up the assignment of the variable = RB_ROOT inside of
while loop patter we were using.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-23 07:08:36 -05:00
Donald Sharp
b456bceb4a pimd: Really, Actually send S,G rpt prune upstream
When we receive a S,G rpt prune message for a mroute,
really, absolutely, guarantee the send upstream immediately.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-12 20:29:38 -05:00
Renato Westphal
451fda4f9a *: use the FOR_ALL_INTERFACES abstraction from babeld
This improves code readability and also future-proofs our codebase
against new changes in the data structure used to store interfaces.

The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but
for now only babeld is using it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:46 -03:00
Renato Westphal
f4e14fdba7 *: use rb-trees to store interfaces instead of sorted linked-lists
This is an important optimization for users running FRR on systems with
a large number of interfaces (e.g. thousands of tunnels). Red-black
trees scale much better than sorted linked-lists and also store the
elements in an ordered way (contrary to hash tables).

This is a big patch but the interesting bits are all in lib/if.[ch].

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03:00
Donald Sharp
affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **.  This is to allow the list pointer to be nulled.

I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.

Let's make the api explicit in it setting the list pointer
to null.

Cynical Prediction:  This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:13 -04:00
Renato Westphal
a2addae8fe *: use clang's 'ForEachMacros' format style option
This fixes the broken indentation of several foreach loops throughout
the code.

From clang's documentation[1]:
  ForEachMacros: A vector of macros that should be interpreted as foreach
  loops instead of as function calls.

[1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-15 14:53:46 -03:00
Donald Sharp
37736d0870 pimd: More S,G RPT prune state missinformation
If you read the extra fine print of the PIM RFC
it asks you to stop the PP Timer and the
Expiry Timer when you are certain S,G RPT states.

This commit puts this into practice and it also
deletes the S,G ifchannel if necessary.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
2017-09-13 19:43:39 -04:00
Donald Sharp
c206937b91 pimd: Cleanup S,GRPt prune handling on Mroute Loss
1) Clean up display of S,GRPt prune state to be more meaningful
2) Upon receipt of a S,GRPt prune make sure we transition to
   the correct state
3) Upon loss of a S,GRPt prune make sure we transition to
   the correct state as well as immediately send a *,G
   join upstream to propagate the loss of the prune.
4) Removal of a weird S,G state being installed upon
   loss of a S,G RPt prune.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 10:01:50 -04:00
Donald Sharp
c6f94e1971 pimd: Ensure cleanup of S,G on ifchannel failure to create
There exists a path for ifchannel creation that if a S,G
fails to create and a corresponding *,G ifchannel is there,
the S,G will be deleted but we were leaving the S,G in the
*,G ifchannel sources list.  Remove from the list in this case

Ticket: CM-17605
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-14 20:16:48 -04:00
Donald Sharp
ad7b74c4f7 pimd: Convert to using a RB tree for the pim_ifp ifchannel_list
This patch does two things:
1) Converts the pim_ifp->ifchannel_list to a pim_ifp->ifchannel_rb
2) Removes the hashing to use the RB RB_FIND instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-02 07:44:00 -04:00
Donald Sharp
86b473a7e8 pimd: Rename pim_ifp->pim_ifchannel_list
Remove the redundant information in pim_ifp->pim_ifchannel_list
just call it pim_ifp->ifchannel_list

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-02 07:44:00 -04:00
Donald Sharp
1a8a3da8c2 pimd: Remove almost duplicate pim->ifchannel_list
The pim->ifchannel_list can be duplicated by iterating
over each vrf and then over each pim_ifp->pim_ifchannel_list
Since list handling is taking allot of time at scale
convert over to using this value.

Additionally clean up pim_cmd.c to have helper functions
to handle the actual encoding of data for output.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-02 07:44:00 -04:00
Donald Sharp
19b807ca17 pimd: Allow the keepalive time to be per vrf.
Allow the keepalive period to be per vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-28 08:03:50 -04:00
Donald Sharp
aabb9a2f07 pimd: Allow installation of NULL mroute in some situations
When we receive a S,G,RPT prune as part of a *,G tree, install
the NULL oil S,G mroute.  This will cause the traffic to stop
flowing for this particular S,G as we expect.

Ticket: CM-16978
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:52:57 -04:00
Donald Sharp
74d1799ae6 pimd: Fix unininitialized data usage found by clang
clang 5.0 to the rescue!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:41 -04:00
Donald Sharp
862756ff85 pimd: Ensure that we properly shutdown threads on start failure
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:41 -04:00
Donald Sharp
1e7a3a2a53 pimd: Fix some small crashes in pim
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:40 -04:00
Donald Sharp
9c80de2434 pimd: Fix crash with ifchannel and upstream
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:40 -04:00
Donald Sharp
0885a9f1f4 pimd: Fix code to not send joins when SGRPT Prune is received
When we receive a SGRPT Prune we were switching the upstream
to JOINED and immediately sending a join.  This was not
the right thing to do.

This was happening because we were making decisions about the
new ifchannel before it was fully formed.

Rework ifchannel startup to provide enough information to
the pim upstream data structure to make the right decisions

Ticket: CM-16425
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:40 -04:00
Donald Sharp
1eca85760b pimd: Fix crash when attempting to use channel_oil->pim before it is assigned
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:38 -04:00
Donald Sharp
2002dcdb94 pimd: Cleanup some basic crashes from mistakes made converting to vrf
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:38 -04:00
Donald Sharp
6f439a7058 pimd: Cleanup pim_ssm.c to use 'struct pim_instance *'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:36 -04:00
Donald Sharp
f88df3a642 pimd: Move pim_ifchannel_list and vif array into 'struct pim_instance *'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:36 -04:00
Donald Sharp
9b29ea95fc pimd: Remove pimg from pim_upstream.c
Move the upstream_list, hash and wheel into 'struct pim_instance'
Remove all pimg to pim in pim_upstream

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp
43e40fdfe1 pimd: Create the pimreg per vrf 2017-07-24 13:51:34 -04:00
Donald Sharp
a88e628d29 pimd: Remove unnecessary NULL check
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:34 -04:00
Donald Sharp
0708beb1f4 pimd: Cleanup use of VRF_DEFAULT to pimg->vrf_id
Use the appropriate vrf_id instead of always defaulting
to VRF_DEFAULT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:33 -04:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
David Lamparter
326452238a Merge branch 'stable/3.0'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-06 17:37:41 +02:00
Donald Sharp
7656e7fc46 pimd: Remove qpim_inaddr_any
In prep for switching over to having PIM understand VRF
remove the qpim_inaddr_any global variable and just
use INADDR_ANY directly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-02 13:44:37 -04:00
Chirag Shah
ee22bbae78 pimd: Fix to Tx S,G Join when SGRpt->Join state
-Upon Rx (*,G) Join w/o SGRpt at RP, trigger (S,G) Join
towards FHR, unset SGRpt flag from channel,
add (*,G) oif to (S,G) entry.
-Add I am not RP check to triger SGRpt on *,G path otherwise,
send S,G Prune on SPT path from RP to FHR upon receving *,G Prune.
-Upon Rx SGRpt receive, remove OIF(downstream where Prune received) from specific S,G.

Testing Done:
pim-smoke
Ran 95 tests in 11790.552s
FAILED (SKIP=10, failures=4)

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-05-18 14:36:25 -07:00
Donald Sharp
ac139b5fb6 Merge remote-tracking branch 'origin/master' into pim_crash_a_boo 2017-05-18 09:45:57 -04:00
Donald Sharp
69b174d4ec pimd: Fix indentation issue that is causing clang unhappiness
The indentation of ifjoin_to_noinfo was not consistent with
the rest of the function and caused clang to loose it's mind

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-18 09:03:58 -04:00
Donald Sharp
f1deac618b pimd: Fix indentation issue that is causing clang unhappiness
The indentation of ifjoin_to_noinfo was not consistent with
the rest of the function and caused clang to loose it's mind

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-18 08:56:40 -04:00
David Lamparter
57463530f3 Merge branch 'stable/3.0'
Conflicts:
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/interface.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:28:12 +02:00
Donald Sharp
4a07939b68 pimd: Thread changes allow pim to crash a boo
When we add a thread pointer to thread_add_XXX functions
when the specified function is called, thread.c is setting
the thread pointer to NULL.  This was causing pim to
liberally pull it's zassert grenade pin's.

Additionally clean up code to not set the NULL pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-17 20:33:43 -04:00
Chirag Shah
95d3f5011b pimd: Fix input value to bool
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-05-16 22:02:41 -07:00
Chirag Shah
5578590086 pimd: Avoid deleting SGRpt entry from PP->P state
-Upon Receving SGRpt Prune message, transitioning from Prune Pending state
to NOINFO state, ifchannel entry was getting deleted in prune pending timer
expiry. This can result in SGRpt ifhchannel deleted and recreated upon receving
triggered or periodic SGRpt received from downstream.
The automation test failed as it expected (check) SGRpt entry at RP after it triggers
SPT switchover.

- While transitioning from Prune-Pending state to NOINFO(Pruned) state, Trigger
SGRpt message towards RP.

- Add/del some of the debug traces

Ticket:CM-16057
Reviewed By:CCR-6198
Testing Done:
Rerun test08 multiple times and observed passing it.

Pim-smoke with hardnode
Ran 95 tests in 11219.420s
FAILED (SKIP=10, failures=4)

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-05-16 10:18:29 -07:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Quentin Young
ffa2c8986d *: remove THREAD_ON macros, add nullity check
The way thread.c is written, a caller who wishes to be able to cancel a
thread or avoid scheduling it twice must keep a reference to the thread.
Typically this is done with a long lived pointer whose value is checked
for null in order to know if the thread is currently scheduled.  The
check-and-schedule idiom is so common that several wrapper macros in
thread.h existed solely to provide it.

This patch removes those macros and adds a new parameter to all
thread_add_* functions which is a pointer to the struct thread * to
store the result of a scheduling call. If the value passed is non-null,
the thread will only be scheduled if the value is null. This helps with
consistency.

A Coccinelle spatch has been used to transform code of the form:

  if (t == NULL)
    t = thread_add_* (...)

to the form

  thread_add_* (..., &t)

The THREAD_ON macros have also been transformed to the underlying
thread.c calls.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:19 +00:00
Chirag Shah
4ba87bb9e2 pimd: Fix WG/SGRpt & WG J/P processing
During processing of Join/Prune,
for a S,G entry, current state is SGRpt, when only *,G is
received, need to clear SGRpt and add/inherit the *,G OIF to S,G so
it can forward traffic to downstream where *,G is received.
Upon receiving SGRpt prune remove the inherited *,G OIF.

From, downstream router received *,G Prune along with SGRpt
prune. Avoid sending *,G and SGRpt Prune together.
Reset upstream_del reset ifchannel to NULL.

Testing Done:
Run failed smoke test of sending data packets, trigger SPT switchover,
*,G path received SGRpt later data traffic stopped S,G ages out from LHR, sends only
*,G join to upstream, verified S,G entry inherit the OIF.
Upon receiving SGRpt deletes inherited oif and retains in SGRpt state.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-05-06 17:38:18 -07:00
Donald Sharp
e6d700e33b pimd: Note when a S,G stream should be a FHR as well
When we have a S,G being created, that it might
also be a FHR router as well.  This happens
when the FHR is in the path of the RP->LHR
for when it builds it's SPT tree for the S,G.

Ticket: CM-16056, CM-15836
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-04 11:11:57 -04:00
Jafar Al-Gharaibeh
71d702a85e Merge branch 'stable/3.0' into pim_dev_3_0 2017-04-28 10:38:05 -05:00
Chirag Shah
1f58d560da pimd: Fix WG/SGRpt & WG J/P processing
During processing of Join/Prune,
for a S,G entry, current state is SGRpt, when only *,G is
received, need to clear SGRpt and add/inherit the *,G OIF to S,G so
it can forward traffic to downstream where *,G is received.
Upon receiving SGRpt prune remove the inherited *,G OIF.

Testing Done:
Trigger SPT switchover, *,G path received SGRpt later data
traffic stopped S,G ages out from LHR, sends only
*,G join to upstream, verified S,G entry inherit the OIF.
Upon receiving SGRpt deletes inherited oif and retains in SGRpt state.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-04-25 12:51:58 -07:00
Donald Sharp
e3a55f03bf pimd: Tweak pim_ifchannel_compare to be faster
Tweak the ifchannel compare to sort based upon
interface first

Ticket: CM-15629
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-20 16:00:21 -04:00
Donald Sharp
2a28f7a0b9 pimd: Add ability for upstream to know it's ifchannels
Add a list structure to track the ifchannels associated
with a particular upstream.

We are not doing anything with this particular knowledge
yet but it will be come useful in the near future.

Ticket: CM-15629
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-20 15:59:12 -04:00
Donald Sharp
c8fc07cb03 pimd: Limit search to relevant ifchannels in some cases
When we are determining an inherited_olist, let's be allot
smarter about what we look at.  Before this code change
we are looping over the entirety of all ifchannels in
the system to find the relevant ones.  Convert the
code to *find*(hash table lookup) the specific ifchannels we
are interested in.

Ticket: CM-15629
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-20 15:59:01 -04:00
Donald Sharp
cf528e4f26 pimd: When loosing *,G igmp report notify S,G too
When we have a S,G that was created due to the *,G IGMP
report going away, safely remove the S,G as well.

Ticket: CM-15838
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2017-04-20 15:57:00 -04:00
Donald Sharp
df94f9a91d pimd: Add prefix list handling to spt-switchover
To the 'ip pim spt-switchover infinity-and-beyond' command
add 'prefix-list <PLIST>'. To the command.

Use this as the basis to deny (Not immediate switchover)
or permit (Immediate switchover), based upon matching
the group address and the prefix-list.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-20 15:55:50 -04:00
Donald Sharp
a7b2b1e298 pimd: Add the ability to never SPT switchover
Add the ability to allow pim to determine if we should
allow spt-switchover or not on the LHR.

Signed-off-by: Donald Sharp
2017-04-05 12:38:12 -04:00
Donald Sharp
850a9f99b8 pimd: Allow SPT switchover
This allows SPT switchover for S,G upon receipt of packets
on the LHR.

1) When we create a *,G from a IGMP Group Report, install
the *,G route with the pimreg device on the OIL.

2) When a packet hits the LHR that matches the *,G, we will
get a WHOLEPKT callback from the kernel and if we cannot
find the S,G, that means we have matched it on the LHR via
the *,G mroute.  Create the S,G start the KAT and run
inherited_olist.

3) When the S,G times out, safely remove the S,G via
the KAT expiry

4) When the *,G is removed, remove any S,G associated
with it via the LHR flag.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-05 12:38:12 -04:00
Donald Sharp
31edf0b509 Merge branch 'master' into pim-ssm 2017-03-30 16:20:34 -05:00
Donald Sharp
d78f0ac13c pimd: Update inherited_olist when receiving a prune
We were not always updating the inherited_olist
when we received a prune.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-23 12:59:42 -04:00
anuradhak
15a5dafe44 pimd: Allow SSM groups to co-exist with ASM groups.
SSM groups (232/8 or user configured SSM range) can exist in the same
multicast network as ASM groups. For such groups all RPT related state
machine operations have to be skipped as defined by section 4.8 of
RFC4601 -
1. Source registration is skipped for SSM groups. For SSM groups mroute
is setup on the FHR when a new multicast flow is rxed; however source
registration (i.e. pimreg join) is skipped. This will let the ASIC black
hole the traffic till a valid OIL is added to the mroute.
2. (*,G) IGMP registrations are ignored for SSM groups.

Sample output:
=============
fhr#  sh ip pim group-type
SSM group range : 232.0.0.0/8
fhr#  sh ip pim group-type 232.1.1.1
Group type: SSM
fhr#  sh ip pim group-type 239.1.1.1
Group type: ASM
fhr#

Sample config:
=============
fhr(config)# ip pim ssm prefix-list ssm-ranges
fhr(config)#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-15344
Testing Done:
1. SSM/ASM source-registration/igmp-joins.
2. On the fly multicast group type changes.
3. pim-smoke.
2017-03-23 09:47:53 -07:00
Donald Sharp
d1e77284c1 pimd: Add display of SGRpt state for ifchannel
When we get a SGrpt Prune embedded in the *,G Join,
Display the created ifchannel as being SGRpt state.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-17 14:48:14 -04:00
Donald Sharp
982bff8972 pimd: Join/Prune Aggregation
Add the ability for PIM to send Join/Prunes as an
aggregated message instead of individual messages
for each S,G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-02 08:13:03 -05:00
Donald Sharp
b5e2377cca pimd: Refactor pim_joinprune_send
Refactor pim_joinprune_send to use 'struct rpf'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
a625e9373b pimd: Make ifchannel lookup a hash lookup
When we are at scale, it is possible that
we have a very large number of ifchannels
per interface.  So make lookup for
that situation to be a hash lookup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
9f44d04202 pimd: Narrow inheritance search down to interface we are interested in.
When we are only looking at one ifchannel, for inheritance, narrow
the search down to only the interface/ifchannel we are interested in

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:41 -05:00
Donald Sharp
116b989af2 pimd: Only debug in the unusual case
When receiving a J/P packet, only check to see if we should
log when the J/P packet is not for us.

Very slight performance improvement additionally

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
c48a612c21 pimd: Remove unneeded parameter
pim_upstream_join_timer_decrease_to_t_override passed in
a `struct in_addr` that in all cases was part of the
upstream data structure that was passed in already.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-24 10:03:40 -05:00
Donald Sharp
a118e71d0e pimd: Fix handling of *,G on RP to allow prune of S,G to go out
When on the RP we received a prune *,G for an established S,G
If join_desired is no longer true we need to prune and
reset some timers, in addition to removing the inherited
interface from the olist.

This was not happening because we were just removing
the inherited oif from the *,G.

Ticket: CM-14561
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:54:20 -05:00
Donald Sharp
98573e196c pimd: Cleanup uninitialized memory access
Valgrind noticed that we have a read of uninitialized memory:

Conditional jump or move depends on uninitialised value(s)
==13749==    at 0x428067: pim_ifassert_winner_set (pim_assert.c:57)
==13749==    by 0x4266F0: pim_ifchannel_add (pim_ifchannel.c:535)
==13749==    by 0x426CC1: pim_ifchannel_join_add (pim_ifchannel.c:730)
==13749==    by 0x427B5B: recv_join (pim_join.c:95)
==13749==    by 0x427B5B: pim_joinprune_recv (pim_join.c:270)
==13749==    by 0x42354F: pim_pim_packet (pim_pim.c:249)
==13749==    by 0x4236C0: pim_sock_read (pim_pim.c:349)
==13749==    by 0x4E60587: thread_call (thread.c:1462)
==13749==    by 0x40C75E: main (pim_main.c:266)
==13749==

This commit fixes that issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:53:27 -05:00
Donald Sharp
f663aa7ad4 pimd: Use correct flag to add an oif
When we are creating the igmp ifchannel we were creating
it with both a P and a I flag.  This was causing
it to not be cleaned up properly when the interface
was shut down.  Subsuquently when the interface
came back up we would attempt to add it back in
but it would fail.

Ticket: CM-14586
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-30 12:51:45 -05:00
Donald Sharp
781a1745c0 pimd: Fixup tracking of where we got OIF's from.
This commit does these three things:

1) Add code to 'show ip pim state' to show where OIF's got their
decision to include that interface

2) Add code in pim_mroute_[add|del] to display what we think we are
adding to the kernel

3) Add code to properly track where we got the incoming request from and
to appropriately not remove a OIL if we have state still

Ticket: CM-14034
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-01-30 12:49:38 -05:00
Donald Sharp
b58ed1f8a8 Merge remote-tracking branch 'origin/master' into pim_lib_work2 2017-01-17 21:01:56 -05:00
Donald Sharp
ef71d1f860 pimd: Allow bridges and bonds to up and down
Bridges and bonds when ifdowned are removed from
the kernel in it's entirety, while pim assumed
that interfaces were kept around in some fashion.

Basically when we had an ifdown event, for all ifchannels
on that interface delete from the OIF.  Also note
the fact that the vif has gone away and we need to
recreate it on the next ifup.

Ticket: CM-13896
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:19 -05:00
Donald Sharp
6578dfa378 pimd: Fix where we handle the inherited_olist for ifchannel
When we receive a new *,G ifchannel, handle the inherited_olist
for S,G mroutes in a place where it is more appropriate.

Ticket: CM-13892
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2016-12-21 20:26:18 -05:00
Donald Sharp
1e3a513213 pimd: Modify the Prune Pending Timer Pop to not assert
So there exist conditions where we can start the Prune
Pending Timer and receive other packets that cause
us to not stop the pending timer.  This was
due to a missread of the state machine.

Additionally when the prune pending timer pops and
we are not in prune pending state, note the fact
and move on with our life instead of crashing and burning

Ticket: CM-13851
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
2016-12-21 20:26:18 -05:00
Donald Sharp
a770ef9063 pimd: Remove redundant logging
When receiving a JOIN/PRUNE message if we have trace
turned on we output this:

2016/11/28 17:11:46.368827 PIM: pim_socket_recvfromto: HAVE_IP_PKTINFO to=224.0.0.13,103
2016/11/28 17:11:46.368956 PIM: Recv PIM JOINPRUNE packet from 169.254.0.6 to 224.0.0.13 on swp31s1: ttl=255 pim_version=2 pim_msg_size=34 checksum=e623
2016/11/28 17:11:46.369003 PIM: pim_joinprune_recv: from 169.254.0.6 on swp31s1
2016/11/28 17:11:46.369053 PIM: recv_prune: prune (S,G)=(20.0.11.253,229.1.2.3) rpt=0 wc=0 upstream=169.254.0.5 holdtime=210 from 169.254.0.6 on swp31s1
2016/11/28 17:11:46.369099 PIM: nonlocal_upstream: recv prune (S,G)=(20.0.11.253,229.1.2.3) to local upstream=169.254.0.5 on swp31s1

Clean up the messaging to this:

2016/11/28 17:11:46.368956 PIM: Recv PIM JOINPRUNE packet from 169.254.0.6 to 224.0.0.13 on swp31s1: ttl=255 pim_version=2 pim_msg_size=34 checksum=e623
2016/11/28 17:11:46.369053 PIM: recv_prune: prune (S,G)=(20.0.11.253,229.1.2.3) rpt=0 wc=0 upstream=169.254.0.5 holdtime=210 from 169.254.0.6 on swp31s1

Ticket: CM-13752
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-12-21 20:26:17 -05:00
Donald Sharp
8bfb8b67ae pimd: Allow storing of sg in string format
Debugs are extremely expensive currently.  Let's
store 'struct prefix_sg sg' string format in
the ifchannel, upstream and msdp_sa structures.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:16 -05:00
Donald Sharp
1405c852fc pimd: Add code to handle pim prune(S,G) with sptbit
Add some more code to handle the prune(S,G) with the
sptbit set.  Turns this ifchannel into a (S,G,rpt).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
b72f79a92b pimd: Fix possible crash when leaving a channel
When leaving a channel, there exists a possibility
that we have not created the channel oil yet.
Ensure that we have channel oil before dereferencing

Ticket: CM-13522
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
7f8b8a9af6 pimd: Remove unnecessary asserts
When we handle the thread arguments,
there is no need to assert.  As that
if they are wrong, we are going down
shortly anyways.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
220d8a49e6 pimd: Add Handler for Receive (*,G) join for (S,G,rpt)
According to Figure 5( Downstream per-interface (S,G,rpt)
state when we receive a (*,G) we need to move (S,G,rpt)
children of the (*,G) into different states.  This
implements that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
45b0c8f3cf pimd: Don't delete ifchannel if expiry timer is still running.
Don't delete the ifchannel if the expiry timer is still running.
We might need to add the prune pending timer as well?  Not sure

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
3fdfd9433e pimd: Add ability for ifchannel *,G to know their S,G's
Add the ability for pim ifchannels *,G's to know their
corresponding S,G's.  This will facilitate handling
S,G,rpt state information better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
ea4a71fcf7 pimd: Store ifchannel information in a global list too.
This fix handles two issues:

1) Searching entire vrf_iflist to get per interface pim_ifchannel_list
2) Display of ifchannel information in pim not being ordered correctly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:14 -05:00
Donald Sharp
03417ccd6d pimd: pim upstream child list
Add the ability to keep the list of S,G's associated with
a *,G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:13 -05:00
Donald Sharp
06afa136e9 pimd: Fix gcc compile issue.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
372eab92a2 pimd: Convert pim_joinprune_send to receive upstream
When sending a join/prune send in the upstream pointer.
this will allow us to implement some of the other state
machines necessary.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
df90067aac pimd: Ignore (S,G) Prunes with no current state
If we get a (S,G) Prune with no current ifchannel state, ignore
the neighbors request.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
be4791f257 pimd: Start (S,G,rpt) coding
Start putting some infrastructure for (S,G,rpt) handling

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
cb24fec45c pimd: Clean up the interface deletion
When cleaning up the interface, actually clean up
data associated with that interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
e5905a3bc3 pimd: Fix possible double free of upstream
Fix possible double free of upstream and in
addition add some debug code to help find
where the problem is coming from.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
7c4002dd3e pimd: Fix child ifchannel overwrite parent ifchannel
When we look for child channels, don't overwrite the
parents ifchannel.  Leave that one alone.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:12 -05:00
Donald Sharp
594a78cc8a pimd: Add interface to ifchannel debugs
When outputting data about ifchannels due to debug
include the interface this is happening on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
1be8f9d323 pimd: Fix ifchannel being left around
In some situations, the deletion of the ifchannel would
not ocurr if the last flag cleared was the assert flag.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
eaa54bdb67 pimd: replace grp_str[100] with grp_str[INET_ADDRSTRLEN]
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
0f58898971 pimd: Add hash lookups for upstream 2016-12-21 20:26:11 -05:00
Donald Sharp
5ce794664d pimd: Only delete on KAT when created by stream
When we have pim_mroute.c or pim_register.c create
the upstream state, only delete it then when
the KAT timer expires, else we will not have
the refcount right and we will do bad things.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Donald Sharp
5b668dd747 pimd: Fix LHR both a receiver and a sender
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:11 -05:00
Daniel Walton
bbd64ce1e7 pimd: sort pim_ifchannel_list
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-21 20:26:10 -05:00