Commit Graph

1914 Commits

Author SHA1 Message Date
ron
851a91b80a
pimd: fix igmp user config
user config should go ahead no matter it is a query router or not

Signed-off-by: ron <lyq140hf2006@163.com>
2021-11-26 21:20:40 +08:00
Donald Sharp
e5b5ea92c5
Merge pull request #9906 from patrasar/2553196
pimd: During Joined -> NotJoined, upstream should send prune nomatter
2021-11-24 12:33:44 -05:00
sarita patra
0a4497f14a pimd: During Joined -> NotJoined, upstream should send prune nomatter
RCA: When upstream transition from Joined to NotJoined due to SGRpt
prune, then only SGRpt prune was sent and SG Prune is missed.

Fix: Send SG Prune towards source as well as SGRpt prune towards RP.

Signed-off-by: sarita patra <saritap@vmware.com>
2021-11-24 04:30:10 -08:00
Donatas Abraitis
0ecdbedbf9
Merge pull request #10040 from idryzhov/ifp-vrf-id-cleanup
*: cleanup ifp->vrf_id
2021-11-23 11:43:48 +02:00
Donald Sharp
f1189d7374
Merge pull request #9919 from mobash-rasool/pim-upst-3
pimd: STAR inherited Flag not properly set in certain scenarios
2021-11-22 14:42:56 -05:00
Igor Ryzhov
096f7609f9 *: cleanup ifp->vrf_id
Since f60a1188 we store a pointer to the VRF in the interface structure.
There's no need anymore to store a separate vrf_id field.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-22 20:47:23 +03:00
Donald Sharp
9d5a61264a
Merge pull request #10076 from idryzhov/if-is-loopback-or-vrf
*: unify if_is_loopback/if_is_loopback_or_vrf
2021-11-22 12:02:21 -05:00
Donald Sharp
cfbf74a9a1
Merge pull request #10088 from opensourcerouting/pim-forward-stop
pimd: fix stale forwarding entries left around after join goes away
2021-11-22 08:30:18 -05:00
Mobashshera Rasool
62596d9a1f pimd : packet processing optimization on rp change
Problem Statement:
==================
on rp_change, PIM processes all the upstream in a loop and for selected
upstreams PIM has to send join/prune based on the RPF changed.
join and prune packets are not getting aggregated in a single packet.

Root Cause Analysis:
====================
on pim_rp_change pim_upstream_update() gets called for selected upstreams.
This API calculates to whom it has to send join and to whom it has to
send prune via API pim_zebra_upstream_rpf_changed(). This API peprares
the upstream_switch_list list per interface and inserts the group and
sources.
Now PIM is still in the pim_upstream_update() API context, i.e PIM
is still processing the same upstream. In the last there is a
call to pim_zebra_update_all_interfaces() which processes the
upstream_switch_list list, sends the packets out and clears the list.

Fix:
====
Don't process the upstream_switch_list in the upstream context.
process all the upstreams prepare the upstream_switch_list and then
process in one go. This will club all the S,G entries.
It also saves list cleanup with respect to memory allocation and
deallocation multiple times.

Signed-off-by: Vishal Dhingra <rac.vishaldhingra@gmail.com>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-11-18 21:46:07 -08:00
Donatas Abraitis
4e9a98636f *: Remove unused variables
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:41 +02:00
Donatas Abraitis
b0d5264e3f pimd: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:41 +02:00
Donatas Abraitis
c594695225
Merge pull request #10077 from idryzhov/pim-if-addr-add
pimd: use correct VRF when processing interface address add
2021-11-18 10:34:33 +02:00
David Lamparter
5e0105ff80 pimd: fix event order for forward_stop()
`pim_ifchannel_ifjoin_switch()` changes flags that `pim_forward_stop()`
looks at.  This leads to data flow continuing until we have some reason
to sync state again.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 16:47:28 +01:00
David Lamparter
86696f7bbe pimd: remove some constant parameters
ch_del is always true for all callers of ifjoin_to_noinfo.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 16:46:05 +01:00
David Lamparter
43038bd5ef pimd: correctly process rp-count==0 BSMs
rp-count==0 isn't a broken BSM, it just means the BSR no longer has any
Candidate RPs for the group range.  Previous behavior is badly mistaken
since it stops processing the entire packet.

Fix to correctly remove group range on rp-count==0 and continue
processing remainder of the packet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
David Lamparter
caef8f7961 pimd: add back blocking RPF for BSM
NHT won't have a result yet when we get the first BSM from a new BSR.
Hence, the first packet(s) are lost, since their RPF validation fails.

Re-add the blocking RPF check that was there before (though in a much
more sensible manner.)

Also nuke the now-unused pim_nexthop_match* functions.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
David Lamparter
b09bd804ac pimd: move BSM clear into BSM code
... where it actually belongs.  And make a bunch of stuff static, since
it's no longer used across files now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
David Lamparter
4efdb9c628 pimd: clean up BSR NHT & fix parallel links
The Bootstrap message RX path needs a RPF check for the BSR address,
and this is implemented both incorrectly as well as quite ugly.

Clean up and fix case when we have multiple interfaces to the same LAN
and/or ECMP nexthops (both would cause message duplication, the former
can even cause BSM forwarding loops.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
David Lamparter
1ee6df3363 pimd: actually return msec in timer_remain_msec()
... really old TODO sitting there.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
David Lamparter
1e9044be8d *: clean up ifp-by-local-address function(s)
Most users of if_lookup_address_exact only cared about whether the
address is any local address.  Split that off into a separate function.

For the users that actually need the ifp - which I'm about to add a few
of - change it to prefer returning interfaces that are UP.

(Function name changed due to slight change in behavior re. UP state, to
avoid possible bugs from this change.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
Igor Ryzhov
4bb0e8f0c0 pimd: use correct VRF when processing interface address add
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-16 18:09:09 +03:00
Igor Ryzhov
608c887069 *: unify if_is_loopback/if_is_loopback_or_vrf
We should always treat the VRF interface as a loopback. Currently, this
is not the case, because in some old pre-VRF code we use if_is_loopback
instead of if_is_loopback_or_vrf. To avoid any future problems, the
proposal is to rename if_is_loopback_or_vrf to if_is_loopback and use it
everywhere. if_is_loopback is renamed to if_is_loopback_exact in case
it's ever needed, but currently it's not used anywhere.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-16 18:07:11 +03:00
Donald Sharp
045e023549
Merge pull request #10032 from opensourcerouting/build-fix-20211111
build: assorted build system improvements, 2021-11 edition
2021-11-13 10:10:59 -05:00
Jafar Al-Gharaibeh
3357afaa74
Merge pull request #10036 from donaldsharp/finally_frr
Finally frr
2021-11-12 21:35:27 -06:00
Donald Sharp
7cc91e67a3 *: Convert quagga_signal_X to frr_signal_X
Naming functions/data structures more appropriately for
the project we are actually in.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-11 14:41:27 -05:00
David Lamparter
f642358837 build: fix duplicate yang.c file inclusions
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-11 15:49:40 +01:00
David Lamparter
e9f7a9655e build: remove some useless intermediate libraries
These really serve no purpose other than slowing our build down.  If
there's a benefit to any of these, they can be readded.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-11 15:46:01 +01:00
Donald Sharp
7a8ce9d56d *: use compiler.h MIN/MAX macros instead of everyone having one
We had various forms of min/max macros across multiple daemons
all of which duplicated what we have in compiler.h.  Convert
everyone to use the `correct` ones

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-11 09:39:52 -05:00
Donald Sharp
e1d1b1dec7 pimd: Remove default from enum based switch
enum based switches should never use default.  It makes
it very hard to fix and find issues when the enum is
changed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-10 17:35:22 -05:00
Chirag Shah
97495b70b8 pimd: fix msdp mesh grp with wildcard member addr
frr-reload fails to recognize wildcard "*" for
member address in frr.conf/runing-config as cli
syntax expects in v4 address format.

Ticket: #2816923

Testing:

Without fix:
running config:
ip msdp mesh-group foo1 member *
Frr reoad failure log:
2021-11-02 11:05:04,317  INFO: Loading Config object from vtysh show running
line 5: % Unknown command: ip msdp mesh-group foo1 member *

Traceback (most recent call last):
  File "/usr/lib/frr/frr-reload.py", line 1950, in <module>

With fix:
--------
running config displays:
ip msdp mesh-group foo1 member 0.0.0.0

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-11-08 06:50:55 -08:00
Donald Sharp
38c848c9bd pimd: remove usage of inet_ntop
We should not be using inet_ntop. and should be using
the appropriate %pI4 instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-05 18:05:21 -04:00
Russ White
e27eaa0d9f
Merge pull request #9900 from SaiGomathiN/sai-pimjoin
pimd: Change in PIM join and mroute
2021-11-05 15:17:01 -04:00
Mobashshera Rasool
5428f5ac64 pimd: STAR inherited Flag not properly set in certain scenarios
Problem Statement:
==================
Mroutes are not recovered after shut/no shut of DUT to RP links

One interface is not added in OIL List in intermediate router,
hence traffic never received at LHR and mroutes not created for (S,G).

Root Cause Analysis:
====================
Generally (*,G) PIM Join is received first and then (S,G) joins are received.
This issue occurs when (S,G) join comes first and then the (*,G) Join.
When (S,G) PIM Join is received, ifchannel is created and channel_oil
OIF flag is set to PIM_OIF_FLAG_PROTO_PIM. Now when (*,G) join is received
the flag PIM_OIF_FLAG_PROTO_STAR is not inherited due to wrong check present in
function pim_upstream_inherited_olist_decide.

Fix:
===================
When (*,G) PIM Join is received, it should always add PIM_OIF_FLAG_PROTO_STAR
flag for all the (S,G) channel oils no matter what order the (*,G) or (S,G)
is received.

Fixes: #9918

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-10-29 02:57:34 -07:00
Jafar Al-Gharaibeh
36e83b73de
Merge pull request #9083 from mobash-rasool/pim-upst-3
pimd: In Prune Pending state, the holdtime change is not taking effect
2021-10-26 23:17:56 -05:00
Sai Gomathi
c29fec4d3a pimd: modification in mroute
Problem:
-------
(*,G) created on transit node where same groups are defined as SSM
At present FRR has SSM checks for IGMP report, but SSM check is missing for PIM join.

Fix:
----
Whenever there is a modification in prefix list for SSM range, then we need to browse the ifchannels (PIM joins)
and groups coming in SSM range with (and *,G) should be removed from ifchannel database and also withdraw those routes
from upstream routers.

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-10-26 07:36:24 -07:00
Sai Gomathi
34abbcc4b1 pimd: modifications in PIM joins
Problem :
=======
(*,G) created on transit node where same groups are defined as SSM
At present FRR has SSM checks for IGMP report, but SSM check is missing for PIM join.

Fix :
===
When an interface receives the PIM (*,G)join with G as SSM group, then PIMd supposed to discard that join.
There is no need to maintain PIM state for this group.

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-10-26 07:35:55 -07:00
David Lamparter
a243d1db93 *: convert zclient callbacks to table
This removes a giant `switch { }` block from lib/zclient.c and
harmonizes all zclient callback function types to be the same (some had
a subset of the args, some had a void return, now they all have
ZAPI_CALLBACK_ARGS and int return.)

Apart from getting rid of the giant switch, this is a minor security
benefit since the function pointers are now in a `const` array, so they
can't be overwritten by e.g. heap overflows for code execution anymore.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-20 13:28:46 +02:00
Igor Ryzhov
f60a11883c lib: allow to create interfaces in non-existing VRFs
It allows FRR to read the interface config even when the necessary VRFs
are not yet created and interfaces are in "wrong" VRFs. Currently, such
config is rejected.

For VRF-lite backend, we don't care at all about the VRF of the inactive
interface. When the interface is created in the OS and becomes active,
we always use its actual VRF instead of the configured one. So there's
no need to reject the config.

For netns backend, we may have multiple interfaces with the same name in
different VRFs. So we care about the VRF of inactive interfaces. And we
must allow to preconfigure the interface in a VRF even before it is
moved to the corresponding netns. From now on, we allow to create
multiple configs for the same interface name in different VRFs and
the necessary config is applied once the OS interface is moved to the
corresponding netns.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-19 15:29:51 +03:00
David Lamparter
c5726f0314
Merge pull request #9676 from donaldsharp/import_register 2021-10-13 22:28:03 +02:00
Donatas Abraitis
bf5335cf34 pimd: Do not explicitly set the thread pointer to NULL
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF
semantics.  This is espacially true for the functions we
end up calling the thread for.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-04 19:29:06 +03:00
Russ White
5393318d81
Merge pull request #9682 from adrianomarto/mesh-group-fix
pimd: fixing command "no ip msdp mesh-group member"
2021-09-28 10:21:17 -04:00
Adriano Marto Reis
4687748973 pimd: fixing command "no ip msdp mesh-group member"
Deleting a mesh-group member no longer deletes the mesh-group.

Complete bug description at:
https://github.com/FRRouting/frr/issues/9664

Signed-off-by: Adriano Marto Reis <adrianomarto@gmail.com>
2021-09-28 12:43:52 +10:00
Donald Sharp
ed6cec97d7 *: Add resolve via default flag 2021-09-27 12:38:08 -04:00
David Lamparter
200f56710a pimd: fix UAF/heap corruption in BSM code
This `XFREE()` call is in plainly in the wrong spot.  `rp_all` (the
224.0.0.0/4 entry) isn't supposed to be free'd ever, and the
conditional above makes quite clear that it remains in use.

It may be possible to exploit this as a heap corruption bug, maybe even
as RCE.  I haven't tried; I randomly noticed this while working on the
BSM code.  Luckily this code is only run by the CLI for the clear
command, so the surface is very small.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-27 10:37:23 +02:00
Donald Sharp
b0a13ffb36 pimd: Prevent uninited usage of nexthop
pim_msdp_peer_rpf_check creates an nexthop to do
a rpf search against and doesn't initialize it
sucht that the pim_nexthop_lookup function is
making decisions against the nexthop just
created that was uninitialized.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:54:54 -04:00
Donald Sharp
7e469b9476
Merge pull request #9489 from opensourcerouting/pim-restruct-20210825
pimd: move IGMP memberships from socket to iface, + some cleanups
2021-09-16 12:32:45 -04:00
David Lamparter
3e386e98b3
Merge pull request #9480 from SaiGomathiN/pim-coverity
pimd: Fixing coverity issues
2021-08-27 10:53:35 +02:00
David Lamparter
5421bf8f1d pimd: fuse source_new() and add_source_by_addr()
This makes a lot more sense semantically (and matches the way groups are
handled.)  Also allows placing additional restrictions on source
creation (e.g. limit on number of sources or ACLs.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27 10:46:53 +02:00
David Lamparter
a1a4295ade pimd: reformat after dropping indent levels
Intentionally separate here because the previous patch does a whole
bunch of "move stuff up 1 level of indentation", and reviewing that is
easier when you can use the ignore-whitespace option on diff.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27 10:46:53 +02:00
David Lamparter
dda4d23cca pimd: IGMP memberships are not querier specific
IGMP group/source memberships are a property of the interface;  the
particular IP address that the querier used to collect the data is
irrelevant.

... and IGMP packets get delivered only once to pimd anyway, since we
receive them on the "global" per-VRF IGMP socket.  (The one in igmp_sock
is only used for sending queries.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27 10:42:53 +02:00