Commit Graph

299 Commits

Author SHA1 Message Date
vdhingra
909f3d56ae lib: rmap dep table is not correct in case of exact-match clause
User pass the string match large-community 1 exact-match from CLI.
Now route map lib has got the string as "1 exact-match". It passes the string
to call back for compilation. BGP will parse this string and came to know
that for "1" it has to do exact match. Routemap lib has to save "1" in it’s
dependency table. Here routemap is saving this as a “1 exact-match”
which is wrong. The solution is used the compiled data.

Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-15 05:45:27 -07:00
Donald Sharp
7d7acfc779 eigrpd: Fix SA issue with setting but not using
We assign a value to the eigrp data structure and then
immediately overwrite it in the for loop.  No need to
do a eigrp_lookup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-03 19:22:27 -04:00
David Lamparter
0cf6db21ec *: frr_elevate_privs -> frr_with_privs
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03 17:18:35 +02:00
Donatas Abraitis
1076e2c2b2
Merge pull request #4888 from donaldsharp/rmap_cleanup
Rmap cleanup
2019-09-03 17:42:51 +03:00
Donald Sharp
cda7187d27 *: Convert some route map functions to return the enum
Conver these functions:
route_map_add_match
route_map_delete_match
route_map_add_set
route_map_delete_set

To return the `enum rmap_compile_rets` and ensure all functions
that use this code handle all the enumerated possible returns.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-03 08:19:22 -04:00
Donald Sharp
88a3b65e19 eigrpd: When iterating over all eigrp instances, narrow to correct vrf
When iterating over all eigrp instances, narrow to the correct
vrf that we are working on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:47:40 -03:00
Donald Sharp
cae06ae04a eigrpd: Convert cli to be able to use [vrf NAME]
Modify the cli to allow us to specify the [vrf NAME]
and also get rid of the usages of VRF_DEFAULT that we can.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:47:03 -03:00
Donald Sharp
e78ebbd5c3 eigrpd: Convert eigrp_packet.c to not use VRF_DEFAULT
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:42:31 -03:00
Donald Sharp
d0ac2662ac eigrpd: Convert eigrp_network.c to not use VRF_DEFAULT
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:42:20 -03:00
Donald Sharp
4cfff48a25 eigrpd: Update eigrp_filter.c to use VRF_DEFAULT
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:42:12 -03:00
Donald Sharp
2d4592e4c3 eigrpd: Convert eigrp_hello.c to not use VRF_DEFAULT
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:42:05 -03:00
Donald Sharp
2ea6b572b5 eigrpd: Convert eigrp_neighor.c to not use VRF_DEFAULT
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:41:54 -03:00
Donald Sharp
17c0e58653 eigrpd: Remove VRF_DEFAULT from eigrp_fsm.c
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:41:46 -03:00
Donald Sharp
0da93ecfd7 eigrpd: Update eigrp_topology.c to not use VRF_DEFAULT
Push out the pass in of struct eigrp to all functions
in eigrp_topology.c so we do not lookup the eigrp pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:41:37 -03:00
Donald Sharp
0e64ed0228 eigrpd: Convert eigrp_zebra.c to use appropriate vrf_id
Use the appropriate vrf_id in eigrp_zebra based off of the
struct eigrp *eigrp.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:41:28 -03:00
Donald Sharp
e944996140 eigrpd: Add router eigrp AS [vrf NAME] and various stuff
Add the ability to parse `router eigrp AS [vrf NAME]` and
modify eigrp_lookup to actually handle a vrf_id for us.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 22:41:05 -03:00
Donald Sharp
128ed7604d eigrpd: Create a socket per vrf for communication
Setup EIGRP to use a socket per vrf for communication
amongst it's peers.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 21:45:14 -03:00
Donald Sharp
c20fa244a1 eigrpd: Add various vrf handling functions
Basic enable/disable/add/delete vrf handling functions.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 21:26:47 -03:00
Donald Sharp
daa64bdf49 eigrpd: Use the eigrp->vrf_id where we can immediately transform
For those places where we can immediately transform the usage
of VRF_DEFAULT to eigrp->vrf_id do so.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 21:26:23 -03:00
Donald Sharp
c371cd6bf0 eigrpd: Add vrf_id to struct eigrp
Initial setup of adding a vrf_id to the `struct eigrp`.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-06 21:10:02 -03:00
Rafael Zalamena
3e9759686c eigrpd: implement configuration reload
Reload configuration on SIGHUP using the northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-08-03 14:52:48 -03:00
Rafael Zalamena
f25c244b75 eigrpd: migrate old CLI to northbound
Move all configuration commands to the new CLI code (`eigrp_cli.c`),
implement the northbound and do all the necessary wiring to get it
working.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-08-03 14:52:45 -03:00
Lakshman Krishnamoorthy
b68885f9b7 lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOP
Introducing a 3rd state for route_map_apply library function: RMAP_NOOP

Traditionally route map MATCH rule apis  were designed to return
a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH.
(Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR).
Depending on this response, the following statemachine decided the
course of action:

State1:
If match cmd returns RMAP_MATCH then, keep existing behaviour.
If routemap type is PERMIT, execute set cmds or call cmds if applicable,
otherwise PERMIT!
Else If routemap type is DENY, we DENYMATCH right away

State2:
If match cmd returns RMAP_NOMATCH, continue on to next route-map. If there
are no other rules or if all the rules return RMAP_NOMATCH, return DENYMATCH

We require a 3rd state because of the following situation:

The issue - what if, the rule api needs to abort or ignore a rule?:
"match evpn vni xx" route-map filter can be applied to incoming routes
regardless of whether the tunnel type is vxlan or mpls.
This rule should be N/A for mpls based evpn route, but applicable to only
vxlan based evpn route.
Also, this rule should be applicable for routes with VNI label only, and
not for routes without labels. For example, type 3 and type 4 EVPN routes
do not have labels, so, this match cmd should let them through.

Today, the filter produces either a match or nomatch response regardless of
whether it is mpls/vxlan, resulting in either permitting or denying the
route.. So an mpls evpn route may get filtered out incorrectly.
Eg: "route-map RM1 permit 10 ; match evpn vni 20" or
"route-map RM2 deny 20 ; match vni 20"

With the introduction of the 3rd state, we can abort this rule check safely.
How? The rules api can now return RMAP_NOOP to indicate
that it encountered an invalid check, and needs to abort just that rule,
but continue with other rules.

As a result we have a 3rd state:
State3:
If match cmd returned RMAP_NOOP
Then, proceed to other route-map, otherwise if there are no more
rules or if all the rules return RMAP_NOOP, then, return RMAP_PERMITMATCH.

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-07-22 08:08:13 -07:00
Russ White
f85d5e3d97
Merge pull request #4619 from opensourcerouting/eigrpd-yang
yang: import EIGRP YANG model
2019-07-09 11:27:02 -04:00
Rafael Zalamena
5b768c945e yang/eigrp: change active-time timer to seconds
Based on feedback.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-09 10:16:24 -03:00
Quentin Young
2951a7a4c2 *: s/TRUE/true/, s/FALSE/false/
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-01 17:26:05 +00: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
Pawel Dembicki
e296eae4f3 eigrpd: Fix endianness issue in packets
Net prefixes in eigrp update packets is created and read
without check host endianness.

This patch use ntohl and htonl to read and write ip prefix
from and to packet.

Tested: x86, powerpc

Signed-off-by: Pawel Dembicki <p.dembicki@wb.com.pl>
2019-06-14 13:04:07 +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
Igor Ryzhov
db68438337 eigrpd: fix invalid command definitions
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-06-07 16:21:17 +03:00
Lakshman Krishnamoorthy
2789041a46 Revert of PR 4078 and PR 4315
Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-06-03 15:43:02 -07:00
Naveen Thanikachalam
e2c8d6ce90 lib: Changes made to dependencies of a r-map do not take effect.
Say, more than one sequence of a route-map uses the same named entity
in its match clause. After that entity is removed from any one of the
route-map sequences, any further changes made to that entity doesn't
dynamically take effect.
A reference counter, that allows the named entity to keep a count of
the route-maps dependent on it,  has been introduced to address this issue.

Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com>
2019-05-31 10:05:19 -07:00
Lakshman Krishnamoorthy
eadd168781 lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOP
Introducing a 3rd state for route_map_apply library function: RMAP_NOOP

Traditionally route map MATCH rule apis  were designed to return
a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH.
(Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR).
Depending on this response, the following statemachine decided the
course of action:

Action: Apply route-map match and return the result (RMAP_MATCH/RMAP_NOMATCH)
State1: Receveived RMAP_MATCH
THEN: If Routemap type is PERMIT, execute other rules if applicable,
otherwise we PERMIT!
Else: If Routemap type is DENY, we DENYMATCH right away

State2: Received RMAP_NOMATCH, continue on to next route-map, otherwise,
return DENYMATCH by default if nothing matched.

With reference to PR 4078 (https://github.com/FRRouting/frr/pull/4078),
we require a 3rd state because of the following situation:

The issue - what if, the rule api needs to abort or ignore a rule?:
"match evpn vni xx" route-map filter can be applied to incoming routes
regardless of whether the tunnel type is vxlan or mpls.
This rule should be N/A for mpls based evpn route, but applicable to only
vxlan based evpn route.

Today, the filter produces either a match or nomatch response regardless of
whether it is mpls/vxlan, resulting in either permitting or denying the
route.. So an mpls evpn route may get filtered out incorrectly.
Eg: "route-map RM1 permit 10 ; match evpn vni 20" or
"route-map RM2 deny 20 ; match vni 20"

With the introduction of the 3rd state, we can abort this rule check safely.
How? The rules api can now return RMAP_NOOP (or another enum) to indicate
that it encountered an invalid check, and needs to abort just that rule,
but continue with other rules.

Question: Do we repurpose an existing enum RMAP_OKAY or RMAP_ERROR
as the 3rd state (or create a new enum like RMAP_NOOP)?
RMAP_OKAY and RMAP_ERROR are used to return the result of set cmd.

We chose to go with RMAP_NOOP (but open to ideas),
as a way to bypass the rmap filter

As a result we have a 3rd state:
State3: Received RMAP_NOOP
Then, proceed to other route-map, otherwise return RMAP_PERMITMATCH by default.

Signed-off-by:Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-30 11:21:28 -07: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
Renato Westphal
338b8e914a *: setting the socket send/recv buffer sizes doesn't need elevated privs
The less code running under elevated privileges the better.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-04-08 13:11:28 -03:00
Quentin Young
9165c5f5ff *: remove trailing newlines from zlog messages
Zlog puts its own newlines on, and doing this makes logs look nasty.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-03-14 18:41:15 +00:00
David Lamparter
d3b05897ed
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
2019-03-06 15:54:44 +01:00
Quentin Young
5b94ec5024 *: remove unnecessary semicolon from switches
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:16 +00:00
Quentin Young
9f2d035447 *: remove useless return variables
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:16 +00:00
Philippe Guibert
aec0d75667 eigrp, rip, ripng, lib: unlink if_rmap from vrf
an interface rmap context can be created from a custom name string,
instead of a vrf. This ability permits to handle several instances of
interface route map in the same vrf. The naming convention will be
transparent on what the name is for in the daemon code.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-02-19 21:11:37 +01:00
Philippe Guibert
4b23867cad lib, rip, ripng, eigrp: rework if_rmap context
so as to handle ri/ripng/eigrp multiple instances, the need is to
encapsulate if_rmap hash table into a container context self to each
instance. This work then reviews the if_rmap api, mainly by adding a
if_rmap_ctx context, that is passed for each exchange between library
and the daemon.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-02-19 21:11:13 +01:00
Donald Sharp
84b5e534e6 eigrpd: Do not redelete the eigrp interface data structure
On interface down do not delete the eigrp interface data
structure.  Ensure that the address that we have setup the
eigrp data structure ontop of is what we are deleting.

Additionally add a test to show that this is no-longer
crashing eigrp.  Future commits will further modify
this test to actually ensure that the eigrp topo is
updated correctly and the rib has the correct data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-11 07:23:23 -05:00
Donald Sharp
051da24eef eigrpd: Correctly handle the ref-count in a couple of spots
The ref count for the eigrp topology table was incorrect in a couple
of spots.  Let's clean it up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-11 07:19:14 -05:00
Donald Sharp
b245781a6b eigrp: Make the eigrp_interface have a prefix instead of a *prefix
The prefix data structure was being freed yet still needed in the
future and it's a fundamental part of the eigrp_interface data
structure let's keep it there instead of having it be deleted
and then not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-11 07:16:35 -05:00
Donald Sharp
5edc2cf3ea eigrpd: Remove unnecessary test for pointer
If we are inside the for loop then eigrp *must* be valid.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-11 07:13:41 -05:00
Donald Sharp
c45db77d6f eigrpd: Don't crash on a no network A.B.C.D/M
This command was crashing.  This fixes the crash
we are still not behaving quite correctly on
handling routes we have learned from those peers
covered by the network statement.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-03 19:24:28 -05:00
Donald Sharp
1313365236 eigrpd: Allow A.B.C.D and A.B.C.D/M for topology specification
Allow eigrp to display interesting topo information to the
end user.

Fixes: #3705
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-03 17:45:08 -05:00
Donald Sharp
b0534a8920 eigrpd: Abstract display of an individual entry
Abstract the individual display of a entry in the eigrp
topology table.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-03 17:45:08 -05:00
Donald Sharp
95fc2ae791 eigrpd: Modify from int to boolean for display
Track based upon boolean instead of an int

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-03 17:45:08 -05:00