Commit Graph

239 Commits

Author SHA1 Message Date
Mark Stapp
96b663a381 ospfd: replace inet_ntoa
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 13:37:25 -04:00
Donatas Abraitis
2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03:00
Kaushik
e6baea10a4 ospfd : Resolving conflict in distribute-list update during MaxAge LSA.
1. Fix for duplicating calls of ospf_external_lsa_refresh()
   in ospf_distribute_list_update_timer().
2. Added the comment and change from PR 6981.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-12 06:24:30 -07:00
Renato Westphal
beb91114ec
Merge pull request #6789 from volta-networks/feat_ldp_igp_sync
ldpd: Add support for LDP-IGP Synchronization
2020-09-11 15:55:04 -03:00
lynne
132a782eb8 ospfd: ldp-igp-sync feature: adding ospf support
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-09-09 14:38:44 -04:00
Kaushik
e641623d90 ospfd : Fix in lsa refresh when redist is done with route-map using access-list.
1. Minor change in distribute-list update timer based on lsa flag.

Co-authored-by: harios <hari@niralnetworks.com>
Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-02 02:44:25 -07:00
Olivier Dugeon
d81b8e0e1a ospfd: Add Label Manager for Segment Routing
Segment Routing Global Block is now using the Label Manager to reserved
label range. Label Manager connection uses the synchronous mode and dedicated
thread timer is used to establish the connection in safe manner without
blocking OSPFd is the Label Manager is not available.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-08-20 14:33:00 +02:00
Jakub Urbańczyk
aa530b627d ospfd: send ARP requests using zebra
Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-12 23:20:52 +02:00
Aaron LI
1a08238236 ospfd: Fix Zebra route add message truncation issue
The `INET_ADDRSTRLEN` is 16 and is only enough to format an IPv4 address.
So when there is a prefix (`/xx`), the debug output may get truncated.
Use `PREFIX2STR_BUFFER` macro instead to fix the issue.

Signed-off-by: Aaron LI <aly@aaronly.me>
2020-07-30 08:16:18 -07:00
Donald Sharp
3eb15671ee
Merge pull request #6731 from opensourcerouting/style-string-prep
*: string coding style
2020-07-15 20:06:55 -04:00
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Santosh P K
1febb13de7 ospf: Default-information originate with routemap
Default originate with route-map was broken. Routemap
was not getting applied for redistribute route but was
getting applied default route itself. No default route
was originated even when routemap was satisfied.

Signed-off-by: Santosh P K <sapk@vmware.com>
2020-07-07 04:53:14 -07:00
Olivier Dugeon
43e7abb555 ospfd: Move Segment Routing Zebra functions
For coherency, move and rename functions that send MPLS labels configurations
from ospf_sr.c to ospf_zebra.c:
 - ospf_zebra_update_prefix_sid()
 - ospf_zebra_delete_prefix_sid()
 - ospf_zebra_send_adjacency_sid()

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:35:47 +02:00
Olivier Dugeon
b61264a8a3 ospfd: OSPF Segment Routing improvement
- Improve parsing of Router Information, especially when a router
   stops advertising Segment Routing capabilities
 - Finish conversion to '%pFX' and '%pI4'

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:35:44 +02:00
rgirada
04e94d3929 ospfd: Restoring the original tag in external lsas
Description:
When a routemap applied to set a tag, all the permitted routes are
refreshed with new tag, but when a different route map applied with
a different action still the same tag persits in the external route.
The actual tag received from zebra is expected to be set back to the
routes here. Corrected this behaviour by restoring a original tag
received from zebra.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-05-17 22:02:34 -07:00
rgirada
87e6e11ee8 ospfd: Route-tag is not set to external lsas when applying with rmap
Description:
Route-tag is not set to external lsas originated by ospf when a routemap
applied by setting a specific tag. When applying a route-map on redistribution,
external lsas will be refreshed if there is any change in the route parametrs
after applying routemap. But changing tag is not handled here.
Added the apripriate fix to correct this.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-05-17 21:40:48 -07:00
Donatas Abraitis
c4efd0f423 *: Do not cast to the same type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08 17:15:06 +03:00
Donald Sharp
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Donald Sharp
6e3e2c6d5f ospfd: Cleanup set but unused variables
There existed some variables set but never used.  Clean this up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-27 09:41:58 -05:00
Donatas Abraitis
975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02: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
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
Mark Stapp
ae4080c5a2 ospfd: add redist message detail to debug
Add the specific message being processed when ospfd receives
a redistribution from zebra.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-14 13:45:14 -04:00
David Lamparter
d5eac1e0ca ospfd: clean up default route logic
What a mess...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-02 11:29:03 +02:00
David Lamparter
bcbe98cca0 ospfd: unset default route external_info
Need to clear out the external_info for the "always" default route that
we installed in ospf_redistribute_default_set().

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-02 11:29:03 +02:00
David Lamparter
e410fd7f29 Revert "ospfd: remove default origin max age lsa"
This reverts commit 313919d6e3.

This is not the correct way to fix this.

- touching the LSDB to explicitly remove a MaxAge LSA is always wrong
  and results in desynchronization of the entire routing domain
- the LSDB code correctly handles replacing a MaxAge LSA with a newly
  issued one
- removing the old LSA resets the sequence numbers, which may cause
  other routers to reject the new LSA as old
- the function was horribly misnamed

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-02 11:29:03 +02:00
David Lamparter
fa3c7c7e95 ospfd: kill totally misnamed "timers"
Neither ospf_external_lsa_originate_timer() nor
ospf_default_originate_timer() are actually timers.  They're only
executed on router-ID changes to refresh a particular LSA type.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-08-02 11:29:03 +02: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
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04: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
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
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
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
Quentin Young
9f5dc3192e *: remove casts of XMALLOC / XCALLOC
No cast necessary for void *

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
rgirada
93d836e6fe ospfd: Added changes to track route-map usage
Made changes and updated the routemap applied counter in the following flows.
1.Increment the routemap applied counter when route map attached to a
  redistribution list. The counter will be updated if the routemap exists.
2.Decrement when route map removed / modified from a redistribution  list.
3.Increment/decrement when route map create/delete callback triggered.

Signed-off-by: RajeshGirada <rgirada@vmware.com>
2019-02-04 05:22:39 -08:00
Russ White
62b6a7e149
Merge pull request #3631 from opensourcerouting/zapi_fixes
Small zapi fixes
2019-01-21 20:25:08 -05:00
Renato Westphal
edc127627d lib: use the correct VRF ID when parsing INTERFACE_LINK_PARAMS messages
Bug found during code inspection.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-18 16:06:00 -02:00
Chirag Shah
313919d6e3 ospfd: remove default origin max age lsa
default-information originate does not work
if config is removed and re-added.

Ticket:CM-20026
Testing Done:
Validate default-information originate config
removed and re-added, check ospf lsa database, and peer
route cache entry for default route.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-01-15 21:06:58 -08:00
Renato Westphal
49db7a7b05 lib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages
Some daemons like ospfd and isisd have the ability to advertise a
default route to their peers only if one exists in the RIB. This
is what the "default-information originate" commands do when used
without the "always" parameter.

For that to work, these daemons use the ZEBRA_REDISTRIBUTE_DEFAULT_ADD
message to request default route information to zebra. The problem
is that this message didn't have an AFI parameter, so a default route
from any address-family would satisfy the requests from both daemons
(e.g. ::/0 would trigger ospfd to advertise a default route to its
peers, and 0.0.0.0/0 would trigger isisd to advertise a default route
to its IPv6 peers).

Fix this by adding an AFI parameter to the
ZEBRA_REDISTRIBUTE_DEFAULT_{ADD,DELETE} messages and making the
corresponding code changes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-14 11:41:33 -02: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
Olivier Dugeon
13894ce894
Merge pull request #3077 from rgirada/ospf_2980_fix
ospfd: Resolved the inconsistency behavior when “default-info origina…
2018-10-09 19:07:33 +02:00
rgirada
1fb93326ad ospfd: issue with the "default-information originate always" command #2980
Made changes such that message wont be sent to zebra to validate default
route existence  if user configured with “always”.

Signed-off-by: rgirada <rgirada@vmware.com>
2018-10-09 02:52:27 -07:00
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
David Lamparter
fc81954dd1
Merge pull request #2978 from ton31337/fix/default_originate_after_second_enter
osfpd: Install default route after second try instantly
2018-09-21 22:57:28 +02:00
Donatas Abraitis
766b826f16 osfpd: Install default route after second try instantly
Signed-off-by: Donatas Abraitis donatas.abraitis@gmail.com
2018-09-20 14:30:42 +03:00
Donald Sharp
fc6eb7d827
Merge pull request #3006 from pacovn/static_analysis__shadow_variables1
bgpd isisd ospf6d ospfd: variable shadowing fixes
2018-09-13 08:37:22 -04:00
F. Aragon
f7813c7c7f
bgpd isisd ospf6d ospfd: variable shadowing fixes
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-12 16:44:36 +02:00
Donald Sharp
266469ebab ospfd: Cleanup some warnings that were not warnings
1) stream allocation cannot fail
2) some warnings were removed when functions safely ignored
the calling parameters being wrong.
3) some warnings were removed when functions did not consider
the state as an error since we did not return an error code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-06 20:50:58 +00:00
Chirag Shah
96065dc310 ospfd: interface speed change during intf add
The problem is seen where speed mismatch caused ECMP route
not being reflected with correct number paths (NHs).

During cold boot, some interface speed updated by zebra as
part of one shot timer and triggers interface add to clients.
In this case, ospf already have created interface (bond interface),
but speed was not updated, trigger to do interface speed change
as part of interface add, which will trigger all Router LSA to
use updated speed into cost calculation.

Ticket:CM-22170
Testing Done:
Bring up CLOS config with Spine and leafs. Leaf have CLAG pair,
with same VRR ip address.
At spine one of the bond connecting to leaf node was having
higher speed than the paired device, With this fix, at spine (DUT)
bond interface speed is equal from all peer nodes.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-08-24 15:26:42 -07:00
paco
162dbe419d
ospfd: null check (Coverity 1399284)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-25 17:18:17 +02:00
Mark Stapp
4259ea81e9 ospfd: use prefix2str in debugs in zebra module
Clean up a typo or two, and use prefix2str consistently.
2018-04-23 16:06:39 -04:00
Quentin Young
bcfdc78784 ospfd: remove interface param npd
OSPF_IF_PARAM_CONFIGURED(S, P) checks both the nullity of S and the
value of P; assuming either one from the value of this macro is
incorrect.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-13 17:17:42 -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
G. Paul Ziemba
5c780bc943 ospfd: debug detail for redistribute
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -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
4a7371e9e2 *: Track vrfs per nexthop not per route entry
Track the vfrs on a per nexthop basis instead
of on a per route entry basis.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-08 19:35:53 -05:00
Donald Sharp
d5b2119cb4 *: Send/receive the nexthop vrf_id
Modify the code to send and receive to/from zebra
the nexthops vrf_id.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12 09:22:07 -05: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
Chirag Shah
de1ac5fd63 ospfd: Make external routes in ospf VRF aware
Currently, ospf external routers are part of struct
ospf_master which is not vrf aware ospf instance.
All ospf external routes are injected/leaked into all
vrfs.

Moved ospf external routes db to struct ospf to make
vrf aware, such one external routes learnt in one vrf
is not leaked into another vrf.

Ticket:CM-18855
Testing Done:
Inject external route in non-default vrf x, validated
ospf database across the vrf x, validated ospf routes
for vrf x.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-21 11:23:08 -08:00
Chirag Shah
6021c6c059 ospfd: VRF aware Router-ID update
Ensure zebra received router-id isolated per vrf instance.
Store zebra received router-id within ospf instance.

Ticket:CM-18657
Reviewed By:
Testing Done:
Validated follwoing sequence
- Create vrf1111
- Create ospf vrf1111 with no router-id
- Assign ip to vrf111
- ospf is assigned zebra assigned router-id which is vrf ip.
- upon remvoing vrf ip, the router-id retained as same until
ospfd restarted.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-06 13:15:41 -08: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
Donald Sharp
5b8d8894f8 Merge pull request #1298 from opensourcerouting/iface-rb-tree
Use rb-trees to store interfaces instead of linked-lists
2017-10-16 12:00:38 -04:00
Donald Sharp
a68730c62a ospfd: Fix memory leak
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-10 12:31:36 -04:00
Renato Westphal
ff880b78ef *: introduce new rb-tree to optimize interface lookup by ifindex
Performance tests showed that, when running on a system with a large
number of interfaces, some daemons would spend a considerable amount
of time in the if_lookup_by_index() function. Introduce a new rb-tree
to solve this problem.

With this change, we need to use the if_set_index() function whenever
we want to change the ifindex of an interface. This is necessary to
ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The
return value of all insert/remove operations in the interface rb-trees
is checked to ensure that an error is logged if a corruption is
detected.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03:00
Renato Westphal
8928a08f65 *: eliminate IFINDEX_DELETED in favor of IFINDEX_INTERNAL
IFINDEX_DELETED is not necessary anymore as we moved from a global
list of interfaces to a list of interfaces per VRF.

This reverts commit 84361d615.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:05:02 -03:00
Renato Westphal
bcc245799b lib: nuke the if_*_by_name_len() functions
Make use of strnlen() and strlcpy() so we can get rid of these
convoluted if_*_by_name_len() functions.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10 09:01:24 -03:00
Donald Sharp
acdf5e2510 *: Convert list_free usage to list_delete
list_free is occassionally being used to delete the
list and accidently not deleting all the nodes.
We keep running across this usage pattern.  Let's
remove the temptation and only allow list_delete
to handle list deletion.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:17 -04:00
Chirag Shah
43b8d1d8a1 ospfd: OSPFv2 VRF Changes II
Accomodate review comments

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:20 -07:00
Chirag Shah
b5a8894de6 ospfd: OSPFv2 VRF Support
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-03 09:15:19 -07:00
Renato Westphal
a74e593b35 *: fix segfault when sending more than MULTIPATH_NUM nexthops
This is a fallout from PR #1022 (zapi consolidation). In the early days,
the client daemons would allocate enough memory to send all nexthops
to zebra.  Then zebra would add all nexthops to the RIB and respect
MULTIPATH_NUM only when installing the routes in the kernel. Now things
are different and the client daemons can send at most MULTIPATH_NUM
nexthops to zebra, and failure to respect that will result in a buffer
overflow. The MULTIPATH_NUM limit in the new zebra API is a small price
we pay to avoid allocating memory for each route sent to zebra.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 11:21:09 -03:00
David Lamparter
09a484dd1d *: remove ZEBRA_FLAG_{BLACKHOLE,REJECT} from API
FLAG_BLACKHOLE is used for different things in different places. remove
it from the zclient API, instead indicate blackholes as proper nexthops
inside the message.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 01:21:43 +02:00
Renato Westphal
744899219f *: use zapi_route to send/receive redistributed routes as well
Some differences compared to the old API:
* Now the redistributed routes are sent using address-family
  independent messages (ZEBRA_REDISTRIBUTE_ROUTE_ADD and
  ZEBRA_REDISTRIBUTE_ROUTE_DEL). This allows us to unify the ipv4/ipv6
  zclient callbacks in the client daemons and thus remove a lot of
  duplicate code;

* Now zebra sends all nexthops of the redistributed routes to the client
  daemons, not only the first one. This shouldn't have any noticeable
  performance implications and will allow us to remove an ugly exception
  we had for ldpd (which needs to know all nexthops of the redistributed
  routes). The other client daemons can simply ignore the nexthops if
  they want or consult just the first one (e.g. ospfd/ospf6d/ripd/ripngd).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
Renato Westphal
5fef910e71 ospfd: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
34b054ba6d *: remove leftovers from "router zebra"
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
d00061ea32 *: reduce excessive indentation in a few places
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Chirag Shah
97a69b318c ospfd: Fix conflict router-id, memory leaks
Remove assert in path of router_id_update:
Upon configuring same router-id as neighbor's
assert would cause a crash. Log a warning message
and neighborship would not come up.

Address memory leaks

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-08-10 15:12:19 -07:00
Chirag Shah
dfac5d3960 ospf6d: adjust changes per PR 870 review
called list_delete instead of list_free
Moved MTYPE_STATIC in ospfd/zebra.c
Revert changes in ospf6_zebra.c where malloc is called for
multiple nexthops.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-07-31 14:34:06 -07:00
Chirag Shah
7f586094bf ospfd: Fix memory leaks
Verified  ospfd configuraiton with valgrind,

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-07-27 10:06:33 -07:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
David Lamparter
2d8270596a Merge remote-tracking branch 'frr/master' into newline-redux
Lots of conflicts from CMD_WARNING_CONFIG_FAILED...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.
2017-07-13 19:56:08 +00:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Donald Sharp
b440fe5c82 Merge remote-tracking branch 'origin/stable/3.0' 2017-06-29 10:10:15 -04:00
Chirag Shah
87c64b029d ospfd: correct typo in zebra trace
added comment around which bw value used.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-06-14 13:32:42 -07:00
Chirag Shah
3eb7a8495e ospfd: ospf bandwidth handling
Handle proper indent and insert missing not statement.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-06-12 13:17:28 -07:00
Chirag Shah
05b15adcc2 ospfd: ospf bandwidth handling
if bandwidth is not set from Zebra use speed as bandwidth
for ospf route.

Testing Done:
Verfied over bond which has aggregated speed of all member interfaces,
cost is reflected in ospf route and ip route.
Manually changed interface bandwidth which replaces speed as bw, instead
uses cli entered value as bw, verifid output of ospf route and ip route.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-06-12 09:55:56 -07:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Quentin Young
66e78ae64b *: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See
previous commit message.

To ensure that the behavior stays functionally correct, any assignments
with the result of a thread_add* function have been transformed to set
the pointer to null before passing it. These can be removed wherever the
pointer is known to already be null.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:22 +00:00
Quentin Young
ffa2c8986d *: remove THREAD_ON macros, add nullity check
The way thread.c is written, a caller who wishes to be able to cancel a
thread or avoid scheduling it twice must keep a reference to the thread.
Typically this is done with a long lived pointer whose value is checked
for null in order to know if the thread is currently scheduled.  The
check-and-schedule idiom is so common that several wrapper macros in
thread.h existed solely to provide it.

This patch removes those macros and adds a new parameter to all
thread_add_* functions which is a pointer to the struct thread * to
store the result of a scheduling call. If the value passed is non-null,
the thread will only be scheduled if the value is null. This helps with
consistency.

A Coccinelle spatch has been used to transform code of the form:

  if (t == NULL)
    t = thread_add_* (...)

to the form

  thread_add_* (..., &t)

The THREAD_ON macros have also been transformed to the underlying
thread.c calls.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:19 +00:00
David Lamparter
3012671ffa *: use hooks for sending SNMP traps
This means there are no ties into the SNMP code anymore other than the
init call at startup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:36 +01:00
Donald Sharp
fa787f911c lib, ospfd: Refactor if_lookup_by_name_len
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:32:09 -04:00
Christian Franke
dc9ffce878 *: Consistently support 32-bit route tags
This patch improves zebra,ripd,ripngd,ospfd and bgpd so that they can
make use of 32-bit route tags in the case of zebra,ospf,bgp or 16-bit
route-tags in the case of ripd,ripngd.

It is based on the following patch:

    commit d25764028829a3a30cdbabe85f32408a63cccadf
    Author: Paul Jakma <paul.jakma@hpe.com>
    Date:   Fri Jul 1 14:23:45 2016 +0100

    *: Widen width of Zserv routing tag field.

But also contains the changes which make this actually useful for all
the daemons.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-10-07 21:05:05 -04:00