Commit Graph

334 Commits

Author SHA1 Message Date
Chirag Shah
a779978810 bgpd: debug convert to snprintf
Change sprintf to snprintf

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-01-10 11:15:36 -08:00
Chirag Shah
d8744f7247 bgpd: add rmac field in route_add debug
For evpn routes, nexthop and RMAC fileds are synced
in route add to zebra.

In case of EVPN routes display RMAC field in route add
debug log.

Reviewed By:CCR-9381
Testing Done:

BGP:   nhop [1]: 27.0.0.11 if 30 VRF 26   RMAC 00:02:00:00:00:2e

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-01-10 11:15:36 -08:00
Donald Sharp
a44dcdee55
Merge pull request #5332 from mjstapp/remove_zapi_label_flag
*: revise zapi nexthop encoding
2019-12-06 13:19:34 -05:00
Mark Stapp
68a02e06e5 *: revise zapi nexthop encoding
Use a per-nexthop flag to indicate the presence of labels; add
some utility zapi encode/decode apis for nexthops; use the zapi
apis more consistently.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-06 10:17:20 -05:00
Quentin Young
6f4f49b237 bgpd: remove bgp_attr_dup
yeah

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-05 11:05:32 -05:00
Donatas Abraitis
c8d6f0d6c4 bgpd: Replace magic number 1 for TTL to BGP_DEFAULT_TTL
For readability and maintainability purposes.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-27 10:48:17 +02:00
Chirag Shah
14e814ea75 bgpd: evpn pip parse vrr mac
In L3VNI add callback parse, vrr rmac value.

For non-zero vrr mac value, use it as anycast RMAC
and svi mac as individual rmac value.

If advertise-pip is disable or vrr rmac is not present
use svi mac as anycast rmac value for all routes.

Ticket:CM-26190
Reviewed By:
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:30 -08: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
Philippe Guibert
1276ce3833 bgpd: withdraw fib entry on appropriate table identifier
There are cases where the table identifier is set on a bgp entry, mainly
due to route-map, and associate fib entry needs to be removed.
This change encompasses also the route-map reconfiguration that leads to
removing the previous entry, whereas bgp update had been triggered (
this happens when software inbound reconfiguration is handled).

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-10-10 16:06:51 +02:00
Philippe Guibert
951745bdab bgpd: ability to export prefixes entries to a kernel table identifier
this table identifier can be used for policy routing. incoming entries
are locally exported to that local table identifier.
note that so that the user applies the new table identifier to all
entries, the user should flush local tables first.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-10-10 16:06:51 +02:00
Donald Sharp
3835984f1c bgpd: bgp pointer may be null
The bgp pointer may not be actually found.  The debug
message that was using it could get the same value
another way.  Convert over

Fixes Coverity Scan Issue:

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-03 08:57:55 -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
Donald Sharp
138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Philippe Guibert
f449d22396 bgp, zebra, lib: add protocol support for iptables
in addition to support for tcpflags, it is possible to filter on any
protocol. the filtering can then be based with iptables.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-07-08 08:36:45 +02: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
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
Faicker Mo
8f2b2139bf bgpd: Set bgp default nexthop value of IPv6
Set the bgp default nexthop value of IPv6 to the local ipv6 addr of the
tcp connection like IPv4. Fixed the problem of route with empty nexthop
advertised to the peer when zebra is not running.

* bgp_zebra.c: (bgp_zebra_nexthop_set) Set IPv6 bgp default nexthop value.

Signed-off-by: Faicker Mo <faicker.mo@ucloud.cn>
2019-05-31 11:37:04 +08:00
Sri Mohana Singamsetty
979dd989c4
Merge pull request #4413 from donaldsharp/bgp_distance_comes_closer
Bgp distance comes closer
2019-05-30 09:45:43 -07:00
Donald Sharp
38a8c751a4 bgpd: Always send down correct admin distance
In all cases that we are sending routes down to zebra send the
correct admin distance.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-29 08:56:03 -04:00
Chirag Shah
1ee069db0f bgpd: fix debug to have proper nhop display
Display nexthop based on route type.

Ticket:CM-25129
Testing Done:

evpn route:
*  [2]:[0]:[0]:[48]:[aa:aa:aa:aa:01:1a]:[32]:[45.0.2.111]
    36.0.0.25              0 64000 5560 i

old:
BGP: Tx route add VRF 46 45.0.2.111/32 metric 0 tag 0 flags 0x1409 nhnum 1
BGP:   nhop [1]: 2400:1d:: if 50 VRF 46

New:
BGP: import evpn prefix [2]:[aa:aa:aa:aa:01:1a]:[45.0.2.111]/224 as
ip prefix 45.0.2.111/32 in vrf vrf1

BGP: bgp_zebra_announce: p=45.0.2.111/32, bgp_is_valid_label: 2
BGP: Tx route add VRF 46 45.0.2.111/32 metric 0 tag 0 flags 0x1409 nhnum 1
BGP:   nhop [1]: 36.0.0.25 if 50 VRF 46

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-05-28 14:05:36 -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
Anuradha Karuppiah
76d07c7aa1 bgpd: maintain flood mcast group per-l2-vni
If PIM-SM if used for BUM flooding the multicast group address can be
configured per-vxlan-device. BGP receives this config from zebra via
the L2 VNI add/update.

Sample output -
root@TORS1:~# vtysh -c "show bgp l2vpn evpn vni 1000" |grep Mcast
  Mcast group: 239.1.1.100
root@TORS1:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Lou Berger
817489896f
Merge pull request #3762 from pguibert6WIND/do_not_alloc_lists_fs_by_def
bgpd: do not allocate lists on fs entries of bgp entries.
2019-04-16 11:24:48 -04:00
Philippe Guibert
f592523460 bgpd: use listnode_add_force to force allocation of entries if needed
force allocation of entries in order to save memory and then save memory
for people that do not use flowspec.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-03-29 15:04:51 +01:00
Tuetuopay
d074383c62
Merge branch 'master' into evpn-session-vrf 2019-03-28 18:41:38 +01:00
Philippe Guibert
3e3708cbd3 bgpd: do not allocate lists on fs entries of bgp entries.
bgp entries in bgp_extra_path structure will be allocated as lists, only
when needed, that is to say when bgp fs entries will be received and
installed on the underlying system.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-03-28 16:57:59 +01:00
Tuetuopay
f920dd6dc9 bgpd, zebra: Redo checks to advertise_all_vni
This replaces manual checks of the flag with a wrapper macro to convey
the meaning "is evpn enabled on this vrf?"

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-22 13:37:06 +01:00
Tuetuopay
e2f3a930c5 bgpd: Allow non-default instance to be EVPN one
This makes the instance bearing the advertise-all-vni config option
register to zebra as the EVPN one, forwarding it the option.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:14 +01:00
Don Slice
401d56cc52 bgpd: fix redistribution into vrf when networking is restarted
Found that previous fix for this issue caused collatoral damage and
reverted that fix.  This fix clears the vrf_bitmaps when the vrf is
disabled/deleted and then re-applies the redist config when the vrf
is re-enabled.

Ticket: CM-24231
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-03-14 15:17:47 +00:00
Don Slice
fc2408ec18 bgpd: move bgp_update_redist_vrf_bitmaps to bgp_zebra.c for wider use beyond bgp_vty
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2019-03-14 15:05:38 +00:00
Don Slice
7e20406f03 Revert "bgpd: fix updating redist bitmask when vrf_id changes"
This reverts commit 48c74f8825.
2019-03-14 15:03: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
Sri Mohana Singamsetty
29da198289
Merge pull request #3882 from vivek-cumulus/refine_evpn_route_add
Refine install of EVPN-based routes to remove some special handling
2019-03-01 09:15:26 -08:00
vivek
2b83602b24 *: Explicitly mark nexthop of EVPN-sourced routes as onlink
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface. Howver, in the model that
is supported in the implementation and commonly deployed, there is no
explicit Overlay IP address associated with the next hop in the tenant
VRF; the underlay IP is used if (since) the forwarding plane requires
a next hop IP. Therefore, the next hop has to be explicit flagged as
onlink to cause any next hop reachability checks in the forwarding plane
to be skipped.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

Use existing mechanism to specify the nexthops as onlink when installing
these routes from bgpd to zebra and get rid of a special flag that was
introduced for EVPN-sourced routes. Also, use the onlink flag during next
hop validation in zebra and eliminate other special checks.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-27 12:54:24 +00:00
vivek
e1e71450a0 zebra, bgpd: Use L3 interface for VRF's VNI in route install
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

Use the L3 interface exchanged between zebra and bgp in route install.
This patch in conjunction with the earlier one helps to eliminate some
special code in zebra to derive the next hop's interface.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-27 12:25:53 +00:00
vivek
0483af6e4c zebra, bgpd: Exchange L3 interface for VRF's VNI
In the case of EVPN symmetric routing, the tenant VRF is associated with
a VNI that is used for routing and commonly referred to as the L3 VNI or
VRF VNI. Corresponding to this VNI is a VLAN and its associated L3 (IP)
interface (SVI). Overlay next hops (i.e., next hops for routes in the
tenant VRF) are reachable over this interface.

https://tools.ietf.org/html/draft-ietf-bess-evpn-prefix-advertisement
section 4.4 provides additional description of the above constructs.

The implementation currently derives this L3 interface for EVPN tenant
routes using special code that looks at route flags. This patch
exchanges the L3 interface between zebra and bgpd as part of the L3-VNI
exchange in order to eliminate some this special code.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-27 11:52:34 +00:00
Renato Westphal
dc94fe42a4 bgpd: add missing checks for vpnv6 nexthop lengths
A few code paths weren't handling the vpnv6 nexthop lenghts as
expected, which was leading to problems like imported vpnv6 routes
not being marked as valid when they should. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-26 19:02:24 -03: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
Quentin Young
0a22ddfbb1 *: remove null check before XFREE
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00:00
Chirag Shah
a80161574c bgpd: advertise svi ip as macip zebra parse api
Ticket:CM-23782

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-02-06 19:57:40 -08:00
rgirada
b4897fa524 bgpd: Added changes to track route-map usage
Made changes and updated the routemap applied counter in the following flows.
1.Increment when route map attached to a list.
2.Decrement when route map removed / modified from a  list.
3.Increment/decrement when route map create/delete callback triggered.
4.Besides ,This counter need not be updated when a route map is got updated.
  i.e changing/adding a match value to the existing routemap.

In BGP , same update api called for all three add/delete/update operation .
But this counter have to be updated only for routemap addition.
Addressed this specific change by identifying the routemap operation based
on routemap pointer.

Signed-off-by: RajeshGirada <rgirada@vmware.com>
2019-02-04 05:27:56 -08:00
Donald Sharp
2b697c3d47
Merge pull request #3414 from pguibert6WIND/iprule_any_flowspec_handling_2
Iprule any flowspec handling
2019-01-29 14:01:38 -05:00
Philippe Guibert
ce3c06147c bgpd: display the list of iprules attached to a fs entry
the list of iprules is displayed in the 'show bgp ipv4 flowspec detail'
The list of iprules is displayed, only if it is installed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-01-29 14:15:10 +01:00