Commit Graph

1092 Commits

Author SHA1 Message Date
F. Aragon
431f21d38e
pimd: uninitialized memory access fix
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-24 23:51:15 +02:00
Russ White
59c97d9839
Merge pull request #2697 from mjstapp/routemap_const
libs, daemons: use const in route-map apply
2018-07-23 17:42:04 -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
Mark Stapp
123214efb8 libs, daemons: use const in route-map apply
Use 'const prefix *' in route-map apply apis; led to some
corresponding changes in several daemons.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-07-23 10:34:35 -04:00
Jafar Al-Gharaibeh
96b3001abc
Merge pull request #2635 from donaldsharp/more_pim_neighbor
More pim neighbor
2018-07-19 10:47:10 -05:00
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
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
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
Donald Sharp
ff5d90c2e9 pimd: Fix up > 80 columns
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 16:00:48 -04:00
Donald Sharp
53bc94b070 pimd: Make code consistent in regards to lookup
In places where we do a pim_ecmp_nexthop_search, also
use pim_ecmp_nexthop_lookup instead of the single path
case of pim_nexthop_lookup.

This is in preparation of more serious surgery to fix
the weird api of pim_find_or_track_nexthop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 10:15:02 -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
Donald Sharp
8a5134aaa6 pimd: Refactor function to use pim_ecmp_nexthop_lookup
The pim_ecmp_fib_looikup_if_vif_index does practically
the same work as pim_ecmp_nexthop_lookup, refactor to
use that function so that we do not have more code
that must parse the results from zclient_lookup_nexthop.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 10:13:28 -04:00
Donald Sharp
ab9ac14351 pimd: When doing nexthop-lookups don't allocate perm memory
When doing nexthop lookups do not permanently allocate
memory in zebra and pim to track the nexthop specified
on the cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 09:02:07 -04:00
Donald Sharp
1996712744 pimd: Figure neighbors -vs- paths when doing RPF
When we are looking up a RPF with a ecmp path, there
are situations where we are failing to find a path change
because we were not considering the actual number of neighbors
we have available to us at the start of the loop.

Example:

Suppose 2 way ecmp with a neighbor on each path.  We have
multiple upstreams that are strewn across both paths.
If we loose a pim neighbor on one of the paths we would
initiate a rescan of the upstreams.  If the neighbor
we lost happened to be the last ecmp path we rescanned
we would not successfully find a new path and leave
the upstream stranded.

This code change looks at the number of available neighbors
that we have -vs- the number of paths we have and chooses
the smaller of the two for figuring out what to do.

There probably exist other failure scenarios as well that
I am missing here and quite frankly the current code muddies
the water between a RPF lookup failure -vs- a RPF lookup succeeded
and there are no paths.  Further work is needed here imo.

Additionally this idea of a pim_ecmp_nexthop_lookup and
pim_ecmp_nexthop_search is bogus.  They are the same function and
should be merged at some point in time.

Ticket: CM-21599
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 09:02:07 -04:00
Donald Sharp
57695eb6ef pimd: There is no reason a IGMP src should need a neighbor
There is no reason that a IGMP src should need a upstream
pim neighbor when doing a RPF lookup.

Ticket: CM-21599
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-07 09:02:07 -04:00
Quentin Young
e8ec11787b
Merge pull request #2618 from pacovn/PVS-Studio_library_warnings
pimd: standard library usage (PVS-Studio)
2018-07-06 11:23:29 -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
F. Aragon
09ed14e887
pimd: standard library usage (PVS-Studio)
fread() function was not used properly.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-06 01:09:00 +02:00
F. Aragon
2ffc213bf8
ospfd pimd: null check (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-06 00:49:24 +02:00
Jafar Al-Gharaibeh
262c829d7e
Merge pull request #2624 from donaldsharp/PIM_ZOMILY_ZOM
pimd: Use generated interface name
2018-07-04 18:42:51 -05:00
Donald Sharp
db20e34f09 pimd: Use generated interface name
When we have a generated interface name, use it instead of the actual
pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-03 21:31:11 -04:00
Quentin Young
4adc8f6852
Merge pull request #2620 from pacovn/PVS-Studio_null_check_2
bgpd lib ospfd pimd ripngd: null chk (PVS-Studio)
2018-07-03 17:38:09 -04:00
F. Aragon
b575a12c87
bgpd lib ospfd pimd ripngd: null chk (PVS-Studio)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-03 15:39:50 +02: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
71a7b1f82f
Merge pull request #2556 from pacovn/Coverity_1465491_Untrusted_value_as_argument_3
pimd: untrusted argument (3) (Coverity 1465491)
2018-06-26 19:59:27 -04:00
paco
d1b21b9616
pimd: return check (Coverity 1465490)
Unless someone intentionally changes MCAST_ALL_ROUTERS ("224.0.0.2") with a
wrong IP, this should never fail, so the fix is using "(void)" at the left
of the function call, as an explicit way of indicating we discard the
return value on purpose.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-26 19:34:04 +02:00
paco
813099f0fc
pimd: untrusted argument (3) (Coverity 1465491)
Additional fix over d94023d85c (PR #2546)

Removed all pointer arithmetic used for the checks, while keeping same
coverage. I hope this removes the Coverity warning (If this don't fix it, I'll
make Coverity work with a fork and try there as many times as necessary)

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-26 17:14:36 +02:00
paco
d94023d85c
pimd: untrusted argument (2) (Coverity 1465491)
Additional fix over 18e994a043 (PR #2457)

Previous correction was not enough for fixing the Coverity warning. Now we
ensure we don't overflow the buffer.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-25 17:37:48 +02:00
Quentin Young
0a8990d5f8
Merge pull request #2501 from pacovn/infer_unused1
bgpd isisd ldpd lib ospfd pimd: redundancy (infer, grouped)
2018-06-21 15:12:33 -04:00
paco
a2b6e694b1
bgpd isisd ldpd lib ospfd pimd: redundancy (infer)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-20 22:25:28 +02:00
Donald Sharp
c573cddd2a pimd: Remove unused code
pim does not even use route-maps, remove the
unneded code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 21:21:36 -04:00
Donald Sharp
7096e93875 bgpd, lib, pimd: Remove unused variable.
route_map_mark_updated has a `int del_later` variable
that is passed in but never used.  Just remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19 20:44:15 -04:00
Donald Sharp
b49bc6b010
Merge pull request #2487 from pacovn/cppcheck_redundant_memset
ospfd, pimd: redundant memset (cppcheck)
2018-06-18 15:15:46 -04:00
paco
1a36dd60fd
ospfd, pimd: redundant memset (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 18:01:59 +02:00
paco
18e994a043
pimd: Untrusted val as argument (Coverity 1465491)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-15 14:46:25 +02:00
Martin Buck
56c1568b3d pimd: Fix connected route nexthop fix from 66f5152f
Fix a couple of problems in my 1st fix for PIM nexthops reachable via a
connected route:

Use NEXTHOP_TYPE_IPV4_IFINDEX instead of NEXTHOP_TYPE_IPV4 since we add an
IPv4 address to an already known ifindex.

Assign nexthop_tab[num_ifindex].protocol_distance and .route_metric before
incrementing num_ifindex.

Revert the default: to individual switch case statement conversion in
zclient_read_nexthop() as requested by donaldsharp in #2347

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2018-06-08 18:29:04 +02:00
Russ White
52cd2dfebc
Merge pull request #2347 from gromit1811/pim-connected-nexthop-fix
pimd: Fix nexthop determination when sending towards RP
2018-06-08 07:12:26 -04:00
Donald Sharp
4795fff748 pimd: Fix ecmp_enable and ecmp_rebalance_enable
These commands were being accepted in all vrf's and
affecting all vrf's behavior globally, since they were
global variables.

Modify the code to make these two commands work
on a per-vrf basis.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-07 10:23:32 -04:00
Donald Sharp
d6bc1e1450
Merge pull request #2371 from gromit1811/pim-rp-lookup-messages-fix
pimd: Fix debug messages
2018-06-05 07:40:53 -04:00
Martin Buck
1a81b790a9 pimd: Comment spelling fix
Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2018-06-05 10:58:36 +02:00
Martin Buck
66f5152f98 pimd: Fix nexthop determination when sending towards RP
When sending a PIM join upwards on the RP-based tree, it may get dropped on
the last hop before the RP if the RP is reachable via a connected route
(i.e. there's no associated nexthop). pimd needs to put the nexthop IP
address into the PIM join payload and fails to do that if that route has a
nexthop of 0.0.0.0. So whenever we look up a route to determine the nexthop
or we receive a nexthop tracking update from Zebra, use the destination
address as the nexthop address for connected routes.

Fixes #2326.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2018-06-05 09:58:33 +02:00
Martin Buck
5271457d94 pimd: Fix debug messages
Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2018-06-04 14:27:48 +02:00
Donald Sharp
c37e1f598b pimd: hash_get w/ hash_alloc_intern cannot fail
The assignment of sa with the usage of hash_get and hash_alloc_intern
can never fail.  No need to look for a failure case.

Found by Coverity SA.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-30 09:42:24 -04:00
Donald Sharp
48d331e7dd pimd: Clean up rpf_hash *after* upstream cleanup
Cleanup the pim->rpf_hash after upstream cleanup is done
since upstream cleanup uses the rpf_hash to cleanup itself.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:39:09 -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
399495806c pimd: Cleanup all pim_ifp pointers on termination
Properly cleanup pim_ifp pointers on termination

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:36:24 -04: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
Donald Sharp
845d9af76a pimd: Cleanup msdp shutdown
Shutdown pim msdp code a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:36:24 -04:00
Donald Sharp
172e45dc30 pimd: Cleanup the deletion event a tiny bit
The pim_upstream_free command was leaving slag by
not deleting data associated with the upstream
data structure.  Modify the code to explicitly free
all data associated with an upstream on a pim instance
deletion event.  Additionally the end result is that
the pim_upstream_free command is not needed anymore

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11 18:36:24 -04:00