Commit Graph

1064 Commits

Author SHA1 Message Date
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
Mladen Sablic
21313cbfda pimd: show ip igmp statistics command
Command showing IGMP Rx statistics, useful for analyzing IGMP
activity on interfaces.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-05-04 17:05:19 +02:00
Jafar Al-Gharaibeh
31569f0bbc
Merge pull request #2159 from donaldsharp/msdp_crash
pimd: Fix some msdp crashes when some fundamentals change
2018-05-03 09:40:23 -05:00
Donald Sharp
ec2f0e53c4 pimd: Fix some msdp crashes when some fundamentals change
When the underlying networking subsystem is fundamentally
changed via some system controls.  If we have msdp running
there exists a possibility that we need to stop some running
timers to prevent a crash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-01 23:40:26 -04:00
Donald Sharp
e55a43d491 pimd: Remove expensive lookup for if a device is a vrf device
Interfaces know if they are a vrf device or not and this data
is passed up to the protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-30 07:56:24 -04:00
Donald Sharp
7f432a28e0 pimd: Cleanup pim_if_is_loopback
The interface itself knows if it is a vrf device or
not, so let's just use a check for that in the decision
if a interface is a loopback or not.

Additionally modify function to return a bool.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-30 07:53:01 -04:00
Mladen Sablic
71e55fb257 pimd: adding querying of state to mtrace
Adding to mtracebis querying with group address. Same change
to vtysh mtrace command. Support for querying (S,G) and (*,G)
state in mtrace router code. Further improvments to mtrace router
code with closer complience to IETF draft. More references in
comments to the draft. Man page has been updated accordingly.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-04-24 18:47:50 +02:00
Quentin Young
25521d49a7 pimd: avoid writing to negative fd
Coverty #1465483

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-18 12:16:19 -04:00
Quentin Young
ef7eec745d
bgpd, pim: remove undebug
This 'undebug' syntax is only used in 5 commands and serves no apparent
purpose.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-02 16:03:11 -04:00
Lou Berger
97610b589f
Merge pull request #1921 from donaldsharp/pim_stuff
Pim stuff
2018-03-30 12:03:33 -04:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Renato Westphal
73b3323c37
Merge pull request #1957 from qlyoung/fix-mtrace-unaligned-pointer-access
pimd: fix unaligned pointer access
2018-03-23 12:33:11 -03:00
Donald Sharp
33762ff980
Merge pull request #1931 from msablic/pim_mtrace_router
pimd: mtrace router code improvments and fixes
2018-03-22 18:41:20 -04:00
Mladen Sablic
7fb82673ca pimd: mtrace router code improvments and fixes
Mtrace router code has been fixed for the case where no PIM
interface exists towards the source and next-hop is returned.

fwd_ttl is set to one, for correct reporting of mcast ttl.

Also, NO_MULTICAST error is returned when there is no PIM.

And prev_hop is set to source, for case when connected to source,
to help termination of hop-by-hop queries.

Dependency of logging on PIM, when sending mtrace packet, has been
removed.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-03-22 22:05:28 +01:00
Quentin Young
f75ecf8dc2
pimd: fix unaligned pointer access
Can't take the address of members of packed structures due to potential for
alignment faults on some platforms.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-22 13:33:20 -04:00
Donald Sharp
993b143225 pimd: Fix leaked fd and prevent null pointer deref
When the pim_nexthop_lookup fails, close the opened fd
as part of the failure condition.

Additionally pim_nexthop_lookup assumes that we've
actually already looked up a nexthop in the past.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-19 09:18:10 -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
Donald Sharp
78c16071f9 pimd: Just call the actual function
We do not really need a level of abstraction to call a particular function.
Just call it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-17 20:54:04 -04:00
Donald Sharp
46fe6fd557
Merge pull request #1885 from msablic/pim_mtrace_client
pimd: improvments to mtrace
2018-03-15 17:21:05 -04:00
Mladen Sablic
04a2eef368 pimd: improvments to mtrace
mtracebis has been updated, so it behaves more like the original
mtrace command.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-03-14 11:51:35 +01:00
Philippe Guibert
3bc34908e8 lib: privileges are granted to vty netns command
Vty commands that link netns context to a vrf is requiring some
privileges. The change consists in retrieving the privileges at the
vrf_cmd_init() called by the relevant daemon. Then use it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-13 16:32:58 +01:00
Mladen Sablic
f83f396624 pimd: mtrace only IGMP sockets
Feature of mtrace only IGMP sockets on pim sm and pim
ssm interfaces. Modifed IGMP socket creation and show
igmp interface command output.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-03-08 09:40:48 +01:00
Lou Berger
3a6351a3d9 pimd: another change to keep indent.py happy
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:09:19 -05: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
95d962bf1d pimd: Cleanup TODO file
The TODO file had become a dumping ground of changes made
to the protocol.  That when we modified the underlying code
we would need to update the TODO file again due to it's nature.

There is no point in keeping the list of items that we've done
as that commit messages will indicate the new features.  So
pull out all the Finished work and rework the Todo numbers
used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-26 21:33:02 -05:00
Donald Sharp
4e8b02f4df *: Rename ZEBRA_FLAG_INTERNAL -> ZEBRA_FLAG_ALLOW_RECURSION
The ZEBRA_FLAG_INTERNAL flag is used to signal to zebra that
the route being added, the nexthops for it can be recursively
resolved.  This name keeps throwing me off when I read it
so let's rename to something that allows the developer to
understand what is going on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-26 21:26:33 -05:00
Donald Sharp
f9159fbc10
Merge pull request #1804 from msablic/pim_mtrace_doc
pimd: added mtrace caveat
2018-02-27 08:10:43 -05:00