Commit Graph

247 Commits

Author SHA1 Message Date
Anuradha Karuppiah
7984af1840 pimd: set mfcc_parent at the time of MFCC programming
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-15 12:00:29 -08:00
Anuradha Karuppiah
69e3538cd8 pimd: decide between SPT based and RPT based forwarding
An (S,G) mroute can be created as a result of rpt prune. However that
entry needs to stay on the parent (*,G)'s tree (IIF) till a decision is
made to switch the source to the SPT.

The decision to stay on the RPT is made based on the SPTbit setting
according to - RFC7761, Section 4.2 “Data Packet Forwarding Rules”

However those rules are hard to achieve when hw acceleration i.e.
control and data planes are separate. So instead of relying on data
we make the decision of using SPT if we have decided to join the SPT -
Use_RPT(S,G) {
    if (Joined(S,G) == TRUE          // we have decided to join the SPT
            OR Directly_Connected(S) == TRUE // source is directly connected
            OR I_am_RP(G) == TRUE)   // RP
        //use_spt
        return FALSE;
    //use_rpt
    return TRUE;
}

To make that change some re-org was needed -
1. pim static mroutes and dynamic (upstream mroutes) top level APIs
have been separated. This is to limit the state machine to dynamic
mroutes.
2. c_oil->oil.mfcc_parent is re-evaluated based on if we decided
to use the SPT or stay on the RPT.
3. upstream mroute re-eval is done when any of the criteria involved
in Use_RPT changes.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 12:00:29 -08:00
Anuradha Karuppiah
1b249e7097 pimd: update add_oif and del_oif debugs to print caller
These logs were printing file name which has little value (is always
pim_oil.c). Instead print the caller.

add_oif/del_oif are being called directly from one too many. Instead OIF
setup needs to be consolidated via the PIM state machine. These
debugs are expected to help in understanding what needs to be cleaned up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 08:47:33 -08:00
Jafar Al-Gharaibeh
48cb555d4e
Merge pull request #5276 from donaldsharp/pim_double
pimd: No need to add then remove the oif if not DR
2019-11-14 09:38:44 -06:00
Satheesh Kumar K
46c2687c72 pimd, lib: adding support for MLAG Message processing at PIM
This includes:
1. Defining message formats
2. Stream Decoding after receiving the message at PIM
3. Handling MLAG UP & Down Notifications

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-11-13 20:43:15 -08:00
Satheesh Kumar K
36b5b98fef pimd : Add support for MLAG Register & Un-register
when ever a FRR Client wants to send any data to another node
using MLAG Channel, uses below mechanisam.

1. sends  a MLAG Registration to zebra with interested messages that
   it is intended to receive from peer.
2. In response to this request, Zebra opens communication channel with
   MLAG. and also in Rx. diretion zebra forwards only those messages which
   client shown interest during registration
3. when client is no-longer interested in communicating with MLAG, client
   posts De-register to Zebra
4. if this is the last client which is interested for MLAG Communication,
   zebra closes the channel.

why PIM Needs MLAG Communication
================================
1. In general on LAN Networks elecetd DR will send the Join towards
   Multicast RP in case of a LHR and Register in case of FHR.
2. But in case DR Goes down, traffic will be re-converged only after
   the New DR is elected, but this can take time based on Hold Timer to
   detect the DR down.
3. this can be optimised by using MLAG Mecganisam.
4. and also Traffic can be forwarded more efficiently by knowing the cost
   towards RP using MLAG

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-11-13 19:46:52 -08:00
Donald Sharp
8e389ea9e8 pimd: No need to add then remove the oif if not DR
When adding an OIF to the OIL, if we are not the DR
there is no need to install it then remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-04 10:55:52 -05:00
Donald Sharp
721c08573a *: Convert connected_free to a double pointer
Set the connected pointer to set the pointer to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Quentin Young
6a597223d3 Revert "Merge pull request #4885 from satheeshkarra/pim_mlag"
This reverts commit d563896dad, reversing
changes made to 09ea1a4038.
2019-10-14 17:15:09 +00:00
Jafar Al-Gharaibeh
d563896dad
Merge pull request #4885 from satheeshkarra/pim_mlag
pimd, lib, Zebra: PIM MLAG Support
2019-10-14 01:07:24 -05:00
Russ White
9898a2fb34
Merge pull request #5009 from donaldsharp/interface_deletion
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-30 07:46:19 -04:00
Donald Sharp
24cbd13098 pimd: up->channel_oil cannot be NULL
When we create the up data structure we create the channel_oil
as well.  As such it is impossible to get into this code
so it can be removed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-25 09:26:24 -04:00
Satheesh Kumar K
5fdca4ded5 pimd, lib: adding support for MLAG Message processing at PIM
This includes:
1. Defining message formats
2. Stream Decoding after receiving the message at PIM
3. Handling MLAG UP & Down Notifications

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-09-24 01:35:09 -07:00
Donald Sharp
3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
b0b69e59f4 *: Convert interface_down to interface down callback
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ddbf3e6060 *: Convert from ->interface_up to the interface callback
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Satheesh Kumar K
4bf3dda597 pimd : Add support for MLAG Register & Un-register
when ever a FRR Client wants to send any data to another node
using MLAG Channel, uses below mechanisam.

1. sends  a MLAG Registration to zebra with interested messages that
   it is intended to receive from peer.
2. In response to this request, Zebra opens communication channel with
   MLAG. and also in Rx. diretion zebra forwards only those messages which
   client shown interest during registration
3. when client is no-longer interested in communicating with MLAG, client
   posts De-register to Zebra
4. if this is the last client which is interested for MLAG Communication,
   zebra closes the channel.

why PIM Needs MLAG Communication
================================
1. In general on LAN Networks elecetd DR will send the Join towards
   Multicast RP in case of a LHR and Register in case of FHR.
2. But in case DR Goes down, traffic will be re-converged only after
   the New DR is elected, but this can take time based on Hold Timer to
   detect the DR down.
3. this can be optimised by using MLAG Mecganisam.
4. and also Traffic can be forwarded more efficiently by knowing the cost
   towards RP using MLAG

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-09-16 20:11:01 -07:00
Donald Sharp
46dd6edb06 pimd: pim_upstream *always* creates a channel_oil
Modify code base so that pim_upstream *always* creates a channel_oil
and as such we do not need to create it later or play other games.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-18 07:56:37 -04:00
Donald Sharp
afb2f47031 pimd: Add pim_channel_oil_change_iif
Add a function that allows you to modify the channel oil's incoming
interface and to appropriately install/remove it from the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-18 07:54:04 -04:00
Anuradha Karuppiah
ecbbc3a750 pimd, zebra: request for replay of SG entries on startup
zvni setup in zebra is controlled via bgpd i.e. advertise_all_vni
from bgpd triggers this setup. As a part of zvni creation we may need
to setup BUM mcast SG entries which are propagated to pimd for MDT setup.

Now pimd may not be present at the time of zvni creation or may restart
post zvni creation so we need a mechanism to replay (on pimd startup) and
to cleanup (on pimd stop). This is addressed via zebra_vxlan_sg_replay and
zebra_evpn_pim_cfg_clean_up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-07-03 10:11:53 -07:00
Rafael Zalamena
9b2d87406a
Merge pull request #4525 from donaldsharp/some_cleanups
Some cleanups
2019-06-25 16:06:57 -03:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
Donald Sharp
4bcf44412a
Merge pull request #4518 from sarav511/dr_lhr
pimd: fix DR at LHR scenario where non DR is connected to RP
2019-06-21 19:33:14 -04:00
Donald Sharp
11884868d4 pimd: ALLOC functions cannot fail.
There is no need to check for ALLOC function failures
in the code base.  If we cannot get more memory we
assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-19 19:07:12 -04:00
Donald Sharp
8a3e7e9ed9 pimd: Add debugs for channel_oil creation and deletion
Add some debugs so we can see channel oil creation and deletion
events.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-14 19:22:43 -04:00
saravanank
50d06d9e56 pimd: fix DR at LHR scenario where non DR is connected to RP
In Scenario where receiver is present in a subnet where 2 or more pim mrouters.
When IGMP query received on a DR interface and RP is reachable through non DR.
Currently we are blocking to create upstream where iif == oif. So pim join
not generated towards RP. We have to allow the DR router in the network to create an upstream.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-06-12 19:07:13 -07:00
Philippe Guibert
a41c4e1b1f *: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *.
For that all other code referencing to (interface)->vrf_id is replaced.
This work should not change the behaviour.
It is just a continuation work toward having an interface API handling
vrf pointer only.

some new generic functions are created in vrf:
vrf_to_id, vrf_to_name,

a zebra function is also created:
zvrf_info_lookup

an ospf function is also created:
ospf_lookup_by_vrf

it is to be noted that now that interface has a vrf pointer, some more
optimisations could be thought through all the rest of the code. as
example, many structure store the vrf_id. those structures could get
the exact vrf structure if inherited from an interface vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 14:10:28 +02:00
Philippe Guibert
da85f5e038 lib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change if_update_to_new_vrf() api
vrf_id parameter is replaced with struct vrf * parameter. It is
needed to create vrf structure before entering in the fuction.
an error is generated in case the vrf parameter is missing.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:58 +02:00
Philippe Guibert
f11e98eca3 *: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:54 +02:00
Rafael Zalamena
5fd270a114
Merge pull request #4112 from pguibert6WIND/bfd_vrf
support for BFD VRF
2019-05-14 10:24:56 -03:00
Jafar Al-Gharaibeh
60f678ae0d
Merge pull request #4214 from donaldsharp/s_g_channel_deletion
pimd: Deletion of a ifchannel does not immediately mean remove from OIL
2019-05-10 09:49:24 -05:00
Philippe Guibert
0945d5ed01 bgp, ospfd, ospf6d, pimd, lib, isisd: add bfd_client_sendmsg vrf_id
vrf_id parameter is added to the api of bfd_client_sendmsg().
this permits being registered to bfd from a separate vrf.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-07 15:53:07 +02:00
Quentin Young
121f9dee7c *: use ZAPI_CALLBACK_ARGS macro for zapi handlers
This macro:
- Marks ZAPI callbacks for readability
- Standardizes argument names
- Makes it simple to add ZAPI arguments in the future
- Ensures proper types
- Looks better
- Shortens function declarations

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-03 20:57:35 +00:00
Donald Sharp
2164ed5d04 pimd: Deletion of a ifchannel does not immediately mean remove from OIL
So when we remove a ifchannel from the system we should check to
see if we still care about the S,G having it in the OIL still
due to inheritance rules.  The deletion does not necessarily
mean it should not be in the OIL for the S,G.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-24 04:38:53 -04:00
Anuradha Karuppiah
0a2dcc1c41 pimd: setup multicast vxlan tunnel termination device
An interface needs to be designated as "termination device" and added to
the termination mroute's OIL. This is used by kernel and ASIC backends
to vxlan-decaps matching flows.

The default termination device is expected to have the prefix (start
sub-string) "ipmr-lo". This can be made configurable if needed -
root@TORS1:~# ip -d link show ipmr-lo
28: ipmr-lo: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 12:5a:ae:74:51:a2 brd ff:ff:ff:ff:ff:ff promiscuity 0
    dummy addrgenmode eui64
root@TORS1:~# ip mr

This commit includes the changes to enable pim implicitly on the device
and set it up as the vxlan-term device per-pim-instance.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:23 -07:00
Anuradha Karuppiah
b1891fa084 pimd: API for enabling pim on the vxlan term device ipmr-lo
ipmr-lo is a dummy netdev with no additional addressing requirements -
root@TORS1:~# ip -d link show ipmr-lo
28: ipmr-lo: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/ether 12:5a:ae:74:51:a2 brd ff:ff:ff:ff:ff:ff promiscuity 0
    dummy addrgenmode eui64
root@TORS1:~#

This device is used by pim-vxlan to signify multicast-vxlan-tunnel
termination.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:21 -07:00
Anuradha Karuppiah
af7b561b9f pimd: handle VxLAN SG notifications from zebra
zebra sends (S, G) and (*, G) entries for BUM mcast groups to pimd. This
commit includes the changes to handle the notifications and trigger the
creation of (S, G) base cache in pimd.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:21 -07:00
Mark Stapp
d1a1b09c45 pimd: fix compile warnings
Remove set-but-unused variables that provoke compile warnings

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-04-16 14:28:10 -04:00
Donald Sharp
43763b11d0 pimd: Tracking of RPF is *separate* from the lookup
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-05 11:12:59 -04:00
Jafar Al-Gharaibeh
aee1decce2
Merge pull request #4040 from donaldsharp/pim_cleanup
Pim cleanup
2019-04-01 10:25:07 -05:00
Donald Sharp
9d6c33eadf bfdd, nhrpd, pimd: When deleting an interface clean up
When we delete an interface, we need to set the interface
ifindex to an internal value so that we don't end up in
a state where the re-addition of the same ifindex, due to
a rename operation, causes an infinite loop.

Fixes:#4007
Fix-Suggested-by: Saravanan K
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-29 12:44:05 -04:00
Donald Sharp
4f9aec30ea pimd: No need to rescan upstream list on rpf change
The code as written will scan the entirety of all pim upstreams
on a rpf change, this is not necessary because we know that when
we get a nexthop change we already scan the upstreams reliant
on that and do this work.  There is no need to do this again a
short time later.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-28 10:30:35 -04:00
Sarita Patra
1250cb5df2 pimd: clear upstream rpf information when RP becomes not reachable
When route to RP gets modified, FRR receives a notification from
zebra, and call the function pim_resolve_upstream_nh() to compute the
nexthop and update upstream->rpf structure.
Issue: In case when RP becomes not reachable, FRR only uninstall
the mroute from the kernal, but not update the upstream->rpf structure.

Fix: When FRR receives a notification from zebra saying RP becomes
not reachable, then update the following fields.
1. update channel_oil incoming interface as MAXVIFS
2. Un-install the mroute from the kernel.
3. Switch upstream state from JOINED to NOTJOINED.
4. Clear the nexthop information of the upstream.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 23:27:08 -08:00
Sarita Patra
732c209c98 pimd: create dummy (*,G) upstream when RP not configured/reachable
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-24 21:30:06 -08:00
Sarita Patra
957d93eaf2 pimd: Handling Null incoming interface of dummy upstream
When FRR receives IGMP/PIM (*, G) join and RP is not configured or not
reachable, then we are creating a dummy upstream with incoming interface
as NULL and upstream address as INADDR_ANY.

Added upstream address and incoming interface validation where it is necessary,
before doing any operation on the upstream.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 21:26:58 -08:00
Donald Sharp
ee56831894 pimd: Pim is not respecting the move of an interface from old->new vrf
PIM needed to be updated to move to the new vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-05 09:13:30 -05:00
Donald Sharp
d6749d74c6 pimd: Store the router mlag role
When we are told about the mlag role, store it for later usage.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:23:39 -05:00
Donald Sharp
4dfe9ad26e pimd: Remove pimg
The pimg data structure is only used in one spot to send the default
vrf id to zebra upon startup.  Add the default vrf id to the struct pim_router
data structure and remove the pimg pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:23:39 -05:00
Donald Sharp
da03883e1e pimd: Convert rpf_cache_refresh_delay_msec into pim_router struct
Move the rpf_cache_refresh_delay_msec into the pim_router since
it should own the data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:23:39 -05:00
Donald Sharp
36417fcc20 pimd: Create a struct pim_router and move thread master into it
Create a `struct pim_router` and move the thread master into it.
Future commits will further move global varaibles into the pim_router
structure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:21:00 -05:00
Donald Sharp
ac567a6f4a pimd: Add the reading of capabilities on startup.
Just add the ability to notice the capabilities on startup,
but don't do anything with it yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04 12:21:00 -05:00
Donald Sharp
b96892db62 pimd: When we fail to initiate ifchannel backout work done
When we receive a igmp report and attempt to initiate
a pim ifchannel for it and that fails to work then
let's back out the work done setting stuff up to this
point.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-15 19:28:43 -05:00
Donald Sharp
26f63a1ec6 *: Replace zclient_new with zclient_new_notify
It's been a year since we added the new optional parameters
to instantiation.  Let's switch over to the new name.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-12 09:16:23 -05:00
Donald Sharp
5330c5e4a8 pimd: Why was pim including zebra headers?
Remove the inclusion of zebra headers from pim.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-23 16:29:41 -04:00
Donald Sharp
90a084e4a1 pimd: Add a debug to tell why we are not creating upsteam state
When we decide we are not the right pim process to add upstream state
for the igmp state received, notice this in a debug to make life
easier to debug.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-21 10:28:57 -04:00
Donald Sharp
85a13586ed pimd: use bool instead of int to pass true/false
In pim_if_new use bool instead of an int to pass
true/false values for what we should create the
pim interface type for.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-17 14:09:06 -04:00
Donald Sharp
59752d4ea5 pimd: Actually create vif's in non-integrated config
The startup of a non-integrated config was not properly
allowing for startup to create the vif when we have
not learned about the interface we are trying to configure
at this point in time.  Actually notice when we are
trying to create a pimreg device or not to properly
notice when to attempt to create the vif or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-17 13:58:59 -04:00
Donald Sharp
cc67ccf9f3 pimd: Abstract a RPF change for upstream handling
Abstract the RPF change for upstream handling code so
that we do not have two copies of the code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-31 18:27:54 -04:00
Donald Sharp
7438923168 pimd: Abstract sending of data to peers
After we have decided what has changed as part of a update
we need to send the j/p messages to our peers.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-31 17:40:37 -04:00
Russ White
b6292a289b
Merge pull request #2641 from donaldsharp/pim_igmp_dr
pimd: Do not create upstream state when not DR for igmp request
2018-07-23 16:50:59 -04:00
Donald Sharp
75c61a1875 pimd: Do not create upstream state when not DR for igmp request
When we receive a IGMP report on an interface, do not create upstream
state for that request, unless we are the DR for the incoming interface.

This will prevent a interface on a LAN segment from causing traffic
to flow to itself.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-09 18:04:00 -04:00
Donald Sharp
b938537bdb pimd: Remove duplicate parameter to functions
Both pim_ecmp_nexthop_lookup and pim_ecmp_fib_lookup_if_vif_index
pass the address in 2 times.  Make function calls consistent
and just pass in the src once.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 10:15:02 -04:00
F. Aragon
0651460e00
eigrpd nhrpd ospfd pimd: fomat fixes (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-02 17:50:21 +02:00
Donald Sharp
87270023eb pimd: Remove redistribution request
pim does not pay attention to redistribution events
from zebra so let's not request them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-27 20:01:22 -04:00
Donald Sharp
26bb1fd528 pimd: Allow interface to move in and out of vrfs
When we get an interface move event track the correct
pim instance.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:38:01 -04:00
Donald Sharp
bfc9201928 pimd: Move some data tracking variables per VRF
There were a few more global variables that needed to be per
vrf.  So move them over.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-17 21:34:55 -04:00
Donald Sharp
5d59e40841 pimd: make igmp_source_forward_reevaluate_all vrf aware
There is no need to look at all VRF's when we need to
reevaluate the source forward since the calling function
knows the vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-17 21:16:42 -04:00
Donald Sharp
da11e32521 pimd: Make the rpf scan per vrf.
We know the vrf that we are in when we need to initiate a
rescan of the rpf cache.  So pass it in and use that information.
This should help the rescan at scale with several vrf's cutting
out a lot of unnecessary work.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-17 21:13:09 -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
daeda3d7ff pimd: No need to assert on the redist_default
zclient_init sets the redist_default to the appropriate
value, testing it with an assert doesn't really provide
us with much of anything useful.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-22 19:44:52 -05:00
Philippe Guibert
87ad28f48c pim: fix compilation issue with pim
The change of vrf_id_t from 16 bit to 32 bit needs some changes in pim
daemon.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-01-22 13:52:24 +01:00
Donald Sharp
e1a1880de3 *: Make zapi route install Notifications optional
Allow the higher level protocol to specify if it would
like to receive notifications about it's routes that
it has installed.

I've purposely made it part of zclient_new_notify because
we need to track the routes on a per daemon basis only.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-27 09:09:35 -05:00
Donald Sharp
97f03dde1e pimd: Fix crash with debug and ifp changes
Certain interface flapping events can cause a lookup
that does not find any ifp pointer.  This is only causing
a crash in the `debug pim zebra` command due to only needing
to lookup the interface for it's name.

Modify code to ensure we have a valid pointer.  Follow other
debug statements lead in the same function for what to display
when an interface does not currently exist.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-30 19:59:18 -04:00
Donald Sharp
819f099bdd pimd: Cleanup vrf SA issues exposed by recent commits
A recent commit has shown that we were not consistent with
handling of the vrf lookup.  Adjust pim to do the right
thing with vrf lookup to be consistent and to make SA
happier.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-25 13:43:51 -04:00
Donald Sharp
342213eac0 *: Modify zclient_init to require privs data
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-23 18:12:29 -04: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
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
e691f179b6 pimd: Cleanup a variety of SA issues
1) Error check return from setsockopt and sockets
2) Check return codes for str2prefix
3) Clean up some potential NULL References

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 20:34:28 -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
a895ac3029 pimd: Ensure that (S,G) output is consistent
Ensure that displayed (S,G) output in logs is
consistent for all debugs.  This will make it
easier to grep for interesting data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:40 -04:00
Donald Sharp
90133de64c pimd: Allow pim to work in vrf's without explicitly configuring the vrf device
Under vrf's pim needs to have a socket listening for pim packets on the vrf
device so that we can actually get the packets.  As such when we configure
up a vrf interface, configure just enough to allow it to listen on the
device and to do the right thing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:39 -04:00
Donald Sharp
1f9666a1db pimd: Remove knowledge of HAVE_TCP_ZEBRA from pim
pim was the only routing daemon to have any knowledge
of how zebra connects to each daemon.  There is no
need for this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:39 -04:00
Donald Sharp
e0ae31b886 lib, pimd, zebra: Allow pim to set pimregX into appropriate vrf
The pimregX devices when created by the kernel are put into
the default vrf.  When pim gets the callback that the device
exists, check to see if it is a pimregX device and if so
move it into the appropriate vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:39 -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
c68ba0d7bf pimd: Convert pim_cmd.c to use correct pim instance
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:38 -04:00
Donald Sharp
b11e234147 pimd: Fix crash associated with pim_ifp not actually being created yet
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:37 -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
6f932b0c91 pimd: Make XX_forward_start 'struct pim_instance *' aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:36 -04:00
Donald Sharp
611925dc02 pimd: Convert channel_oil_hash and list into 'struct pim_instance *'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:36 -04:00
Donald Sharp
7cfc7bcfe7 pimd: Convert vif and ifindex lookups to use 'struct pim_instance *'
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:36 -04:00
Donald Sharp
d9c9a9ee06 pimd: Convert pim_rp.c to use '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
fec883d95a pimd: pim_rp.c -> convert pimg to pim
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp
25b787a287 pimd: Remove pimg from pim_nht.c in totality
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp
25bdac421e pimd: Add 'struct pim_instance' to find_or_track_nexthop
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
Donald Sharp
cb9c7c50d3 pimd: Refactor some functions
A bunch of functions had return values that were never
checked for ( and not needed ) and opposite return values
for proper calling function boolean logic.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -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