]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
5 years agobgpd: Further refine hash lookup to store hash value
Donald Sharp [Wed, 9 Jan 2019 01:23:11 +0000 (20:23 -0500)]
bgpd: Further refine hash lookup to store hash value

Further refine the previous commit to store the hash value in
both the `struct community_list` as well as the `struct rmap_community`
structures.  This allows us to know a priori what our hash value
is.  This change cuts another couple of seconds of convergence
off to ~55 seconds and further reduces cpu load of bgp:

   16      40061.706    433732       92    330102      129   1242965 RWTEX TOTAL

Down from ~43 seconds previously.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Add a hash for quick lookup in community_list_lookup
Donald Sharp [Wed, 26 Dec 2018 18:21:10 +0000 (13:21 -0500)]
bgpd: Add a hash for quick lookup in community_list_lookup

The community_list_lookup function in a situation where you have
a large number of communities and route-maps that reference them
becomes a very expensive operation( effectively a linked list walk
per route per route-map you apply per peer that has a routemap that
refereces a community, ecommunity or lcommunity.  This is a very
expensive operation.

In my testbed, I have a full bgp feed that feeds into 14 namespace
view based bgp processes and finally those 14 feed into a final
namespace FRR instance that has route-maps applied to each
incoming peer for in and out:

!
router bgp 65033
 bgp bestpath as-path multipath-relax
 neighbor 192.168.41.1 remote-as external
 neighbor 192.168.42.2 remote-as external
 neighbor 192.168.43.3 remote-as external
 neighbor 192.168.44.4 remote-as external
 neighbor 192.168.45.5 remote-as external
 neighbor 192.168.46.6 remote-as external
 neighbor 192.168.47.7 remote-as external
 neighbor 192.168.48.8 remote-as external
 neighbor 192.168.49.9 remote-as external
 neighbor 192.168.50.10 remote-as external
 neighbor 192.168.51.11 remote-as external
 neighbor 192.168.52.12 remote-as external
 neighbor 192.168.53.13 remote-as external
 neighbor 192.168.54.14 remote-as external
 !
 address-family ipv4 unicast
  neighbor 192.168.42.2 prefix-list two-in in
  neighbor 192.168.42.2 route-map two-in in
  neighbor 192.168.42.2 route-map two-out out
  neighbor 192.168.43.3 prefix-list three-in in
  neighbor 192.168.43.3 route-map three-in in
  neighbor 192.168.43.3 route-map three-out out
  neighbor 192.168.44.4 prefix-list four-in in
  neighbor 192.168.44.4 route-map four-in in
  neighbor 192.168.44.4 route-map four-out out
  neighbor 192.168.45.5 prefix-list five-in in
  neighbor 192.168.45.5 route-map five-in in
  neighbor 192.168.45.5 route-map five-out out
  neighbor 192.168.46.6 prefix-list six-in in
  neighbor 192.168.46.6 route-map six-in in
  neighbor 192.168.46.6 route-map six-out out
  neighbor 192.168.47.7 prefix-list seven-in in
  neighbor 192.168.47.7 route-map seven-in in
  neighbor 192.168.47.7 route-map seven-out out
  neighbor 192.168.48.8 prefix-list eight-in in
  neighbor 192.168.48.8 route-map eight-in in
  neighbor 192.168.48.8 route-map eight-out out
  neighbor 192.168.49.9 prefix-list nine-in in
  neighbor 192.168.49.9 route-map nine-in in
  neighbor 192.168.49.9 route-map nine-out out
  neighbor 192.168.50.10 prefix-list ten-in in
  neighbor 192.168.50.10 route-map ten-in in
  neighbor 192.168.50.10 route-map ten-out out
  neighbor 192.168.51.11 prefix-list eleven-in in
  neighbor 192.168.51.11 route-map eleven-in in
  neighbor 192.168.51.11 route-map eleven-out out
  neighbor 192.168.52.12 prefix-list twelve-in in
  neighbor 192.168.52.12 route-map twelve-in in
  neighbor 192.168.52.12 route-map twelve-out out
  neighbor 192.168.53.13 prefix-list thirteen-in in
  neighbor 192.168.53.13 route-map thirteen-in in
  neighbor 192.168.53.13 route-map thirteen-out out
  neighbor 192.168.54.14 prefix-list fourteen-in in
  neighbor 192.168.54.14 route-map fourteen-in in
  neighbor 192.168.54.14 route-map fourteen-out out
 exit-address-family
!

This configuration on my machine before this change takes about 2:45 to converge
and bgp takes:

Total thread statistics
   16     151715.050    493440      307   3464919      335   7376696 RWTEX TOTAL

CPU time as reported by 'show thread cpu'.

After this change BGP takes 58 seconds to converge and uses:
Total thread statistics
-------------------------
   16      42954.284    350319      122    295743      157   1194820 RWTEX TOTAL

almost 43 seconds of CPU time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Use `struct rmap_community` when we use community_list_lookup
Donald Sharp [Wed, 26 Dec 2018 18:01:06 +0000 (13:01 -0500)]
bgpd: Use `struct rmap_community` when we use community_list_lookup

The community_list_lookup function is being changed in a future
commit.  As such we want to use the `struct rmap_community` data
structure for storing compiled information about communities,ecommunities
or lcommunities.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3565 from rhonda/patch-1
Donald Sharp [Tue, 8 Jan 2019 21:40:45 +0000 (16:40 -0500)]
Merge pull request #3565 from rhonda/patch-1

debianpkg: use getent instead of egrepping files

5 years agodebianpkg: use getent instead of egrepping files
Rhonda D'Vine [Fri, 4 Jan 2019 10:34:13 +0000 (11:34 +0100)]
debianpkg: use getent instead of egrepping files

User data might not be stored in the files in etc. getent is the
dedicated tool to extract those information, regardless of where the
user data is stored

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
5 years agoMerge pull request #3569 from donaldsharp/recursive_nexthops
Mark Stapp [Tue, 8 Jan 2019 17:15:10 +0000 (12:15 -0500)]
Merge pull request #3569 from donaldsharp/recursive_nexthops

Small cleanup of zebra_rnh.c code

5 years agoMerge pull request #3552 from donaldsharp/zebra_combined_meta_peanuts
Mark Stapp [Tue, 8 Jan 2019 16:59:45 +0000 (11:59 -0500)]
Merge pull request #3552 from donaldsharp/zebra_combined_meta_peanuts

zebra: Consolidate meta_queue_map into route_info

5 years agoMerge pull request #3531 from marauderlabs/docs-fix
Quentin Young [Tue, 8 Jan 2019 16:04:46 +0000 (11:04 -0500)]
Merge pull request #3531 from marauderlabs/docs-fix

doc: Fix typos and grammar

5 years agoMerge pull request #3566 from pguibert6WIND/fix_vrf_netns_broken
Donald Sharp [Tue, 8 Jan 2019 15:48:16 +0000 (10:48 -0500)]
Merge pull request #3566 from pguibert6WIND/fix_vrf_netns_broken

zebra: fix vrf netns broken

5 years agoMerge pull request #3582 from opensourcerouting/freebsd-route-fix
Donald Sharp [Tue, 8 Jan 2019 15:41:52 +0000 (10:41 -0500)]
Merge pull request #3582 from opensourcerouting/freebsd-route-fix

zebra: fix FreeBSD breakage

5 years agozebra: update local ns_id field
Philippe Guibert [Mon, 7 Jan 2019 08:55:10 +0000 (09:55 +0100)]
zebra: update local ns_id field

ns_id field must be synced with ns_id from netns service.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
5 years agozebra: fix another FreeBSD warning message
Rafael Zalamena [Tue, 8 Jan 2019 12:37:22 +0000 (10:37 -0200)]
zebra: fix another FreeBSD warning message

When an empty netmask a wrong end size is calculated, lets handle this
corner case to avoid spurious warning messages.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoMerge pull request #3575 from LabNConsulting/working/master/no-bgp-attr-255
Donald Sharp [Tue, 8 Jan 2019 12:35:11 +0000 (07:35 -0500)]
Merge pull request #3575 from LabNConsulting/working/master/no-bgp-attr-255

bgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined

5 years agozebra: fix FreeBSD warning on fresh OS boot
Rafael Zalamena [Tue, 8 Jan 2019 12:32:28 +0000 (10:32 -0200)]
zebra: fix FreeBSD warning on fresh OS boot

Handle corner case where a warning log message is issued on interface
address netmask handling with sockaddr type AF_LINK: it may come empty
or with match all (all 0xFF).

In the first case all lengths are zero and we only need to copy the
first bytes, second case it comes with a zero index and all 0xFF bytes.

In any case we only need to figure out a few of the first bytes instead
of all data.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoMerge pull request #3562 from donaldsharp/sharp_multiple_installs
Lou Berger [Tue, 8 Jan 2019 11:55:27 +0000 (06:55 -0500)]
Merge pull request #3562 from donaldsharp/sharp_multiple_installs

Sharp multiple installs

5 years agozebra: implement FreeBSD route attr handling
Rafael Zalamena [Tue, 8 Jan 2019 10:14:28 +0000 (08:14 -0200)]
zebra: implement FreeBSD route attr handling

When porting routing socket macro data handling to functions, the
attribute function was forgotten. The only difference between the
attribute and address handler is the family type check.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agodoc: Fix typos and grammar
Anand [Tue, 8 Jan 2019 04:41:14 +0000 (04:41 +0000)]
doc: Fix typos and grammar

Signed-off-by: Anand <anandakumar.u@gmail.com>
5 years agobgp_rfapi_basic_sanity_config2: delayed timeouts not supported without VNC attr
Lou Berger [Mon, 7 Jan 2019 22:16:37 +0000 (22:16 +0000)]
bgp_rfapi_basic_sanity_config2: delayed timeouts not supported without VNC attr

Signed-off-by: Lou Berger <lberger@labn.net>
5 years agobgp_rfapi_basic_sanity: delayed timeouts not supported without VNC attr
Lou Berger [Mon, 7 Jan 2019 20:00:34 +0000 (20:00 +0000)]
bgp_rfapi_basic_sanity: delayed timeouts not supported without VNC attr

Signed-off-by: Lou Berger <lberger@labn.net>
5 years agobgpd: Modify End of Rib notification to INFO
Donald Sharp [Sat, 22 Dec 2018 00:16:52 +0000 (19:16 -0500)]
bgpd: Modify End of Rib notification to INFO

The End of Rib notification in BGP is useful to know no matter
the circumstances.  So change this from a debug message to
an info and cleanup the message a bit and add vrf we are in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined
Lou Berger [Mon, 7 Jan 2019 16:32:54 +0000 (11:32 -0500)]
bgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined

Signed-off-by: Lou Berger <lberger@labn.net>
5 years agoMerge pull request #3572 from manuhalo/fix_isisd_p2p
Donald Sharp [Mon, 7 Jan 2019 14:26:38 +0000 (09:26 -0500)]
Merge pull request #3572 from manuhalo/fix_isisd_p2p

isisd: fix point-to-point network type config

5 years agoisisd: fix point-to-point network type config
Emanuele Di Pascale [Mon, 7 Jan 2019 11:29:29 +0000 (12:29 +0100)]
isisd: fix point-to-point network type config

`isis network point-to-point` was being rejected from the configuration
file as it was being processed before the reception of the UP zebra
notification for the interface. This meant that the `circ_type` was set
at CIRCUIT_T_UNKNOWN, which led the northbound callback to fail. This
check was removed as it was not really necessary; when the zebra
notification is received, the correct circuit type will be enforced,
but now the point-to-point config will be saved and correctly applied
when zebra recognizes the interface as a broadcast one.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
5 years agozebra: dup addr detect fix clear mac command
Chirag Shah [Sat, 15 Dec 2018 02:34:06 +0000 (18:34 -0800)]
zebra: dup addr detect fix clear mac command

For neigh check duplicate flag as it can be inherited from
duplicate detected MAC (count could be 0).

Ticket:CM-23316

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
5 years agozebra: evpn dup addr detect fix unfreeze action
Chirag Shah [Mon, 17 Dec 2018 22:36:27 +0000 (14:36 -0800)]
zebra: evpn dup addr detect fix unfreeze action

Below are cases where EVPN duplicate detection
Freeze and Unfreeze required fixes:

Auto recovery needs to check neighbor's duplicate flag
to take action, as neigh could be marked duplicate
via inherited from MAC where IP detection count could be 0.

MAC duplicate detection needs to set flag to true
if freeze action is configured.

Local MAC add update should not send update to bgp
if MAC is in frozen state.

Remote MAC-IP update should not process neigh update if MAC
is detected as duplicate during remote update.

Ticket:CM-23344
Testing Done:
Trigger duplicate detection via both local and remote update trigger,
Validate clear command and other changes expected behavior.

Auto-recovery takes appropriate action on inherited IPs.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
5 years agoMerge pull request #3529 from donaldsharp/some_integration
Jafar Al-Gharaibeh [Fri, 4 Jan 2019 19:20:22 +0000 (14:20 -0500)]
Merge pull request #3529 from donaldsharp/some_integration

Cleanup of some PIM, very early start of MLAG integration info zebra

5 years agopimd: Allow pim to display what it believes the mlag role is.
Donald Sharp [Fri, 21 Dec 2018 14:55:08 +0000 (09:55 -0500)]
pimd: Allow pim to display what it believes the mlag role is.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Store the router mlag role
Donald Sharp [Fri, 21 Dec 2018 14:30:54 +0000 (09:30 -0500)]
pimd: Store the router mlag role

When we are told about the mlag role, store it for later usage.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Remove pimg
Donald Sharp [Fri, 21 Dec 2018 14:23:36 +0000 (09:23 -0500)]
pimd: Remove pimg

The pimg data structure is only used in one spot to send the default
vrf id to zebra upon startup.  Add the default vrf id to the struct pim_router
data structure and remove the pimg pointer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Remove pim_msdp_config_write as it was never used
Donald Sharp [Fri, 21 Dec 2018 14:19:26 +0000 (09:19 -0500)]
pimd: Remove pim_msdp_config_write as it was never used

This function was never used, additionally rename the _helper
function to this name.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Move register_probe_time to pim_router
Donald Sharp [Fri, 21 Dec 2018 13:59:38 +0000 (08:59 -0500)]
pimd: Move register_probe_time to pim_router

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Move packet_process variable to pim_router
Donald Sharp [Fri, 21 Dec 2018 13:57:22 +0000 (08:57 -0500)]
pimd: Move packet_process variable to pim_router

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Move register_suppress_time into struct pim router
Donald Sharp [Fri, 21 Dec 2018 13:54:07 +0000 (08:54 -0500)]
pimd: Move register_suppress_time into struct pim router

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Convert rpf_cache_refresh_delay_msec into pim_router struct
Donald Sharp [Fri, 21 Dec 2018 13:50:34 +0000 (08:50 -0500)]
pimd: Convert rpf_cache_refresh_delay_msec into pim_router struct

Move the rpf_cache_refresh_delay_msec into the pim_router since
it should own the data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Move the infinite_assert_metric global to pim_router
Donald Sharp [Thu, 20 Dec 2018 16:18:14 +0000 (11:18 -0500)]
pimd: Move the infinite_assert_metric global to pim_router

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Convert qpim_t_periodic into the `struct pim_router` structure
Donald Sharp [Thu, 20 Dec 2018 15:45:33 +0000 (10:45 -0500)]
pimd: Convert qpim_t_periodic into the `struct pim_router` structure

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Move debugs into pim_router structure
Donald Sharp [Thu, 20 Dec 2018 15:39:59 +0000 (10:39 -0500)]
pimd: Move debugs into pim_router structure

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Create a `struct pim_router` and move thread master into it
Donald Sharp [Thu, 20 Dec 2018 15:34:04 +0000 (10:34 -0500)]
pimd: Create a `struct pim_router` and move thread master into it

Create a `struct pim_router` and move the thread master into it.
Future commits will further move global varaibles into the pim_router
structure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Add test and show commands for mlag
Donald Sharp [Tue, 18 Dec 2018 13:48:00 +0000 (08:48 -0500)]
zebra: Add test and show commands for mlag

Add a 'test zebra mlag <none|master|slave>` and
a `show zebra mlag` comamnd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: Add mlag_role2str function
Donald Sharp [Fri, 21 Dec 2018 14:46:48 +0000 (09:46 -0500)]
lib: Add mlag_role2str function

Add a generic mlag_role2str function for lib since multiple daemons
will be using this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agopimd: Add the reading of capabilities on startup.
Donald Sharp [Tue, 18 Dec 2018 13:13:25 +0000 (08:13 -0500)]
pimd: Add the reading of capabilities on startup.

Just add the ability to notice the capabilities on startup,
but don't do anything with it yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib, zebra: On startup send mlag role as part of the capabilities
Donald Sharp [Tue, 18 Dec 2018 13:09:29 +0000 (08:09 -0500)]
lib, zebra: On startup send mlag role as part of the capabilities

On startup send the mlag role as part of the capabilities to
the end protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Add a retrieve the mlag role function
Donald Sharp [Tue, 18 Dec 2018 13:01:50 +0000 (08:01 -0500)]
zebra: Add a retrieve the mlag role function

Add the ability to retrieve the current role of mlag for this machine.

If mlag is not setup we will always return MLAG_ROLE_NONE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Add some small infrastructure to get the mlag code in zebra started
Donald Sharp [Tue, 18 Dec 2018 12:44:23 +0000 (07:44 -0500)]
zebra: Add some small infrastructure to get the mlag code in zebra started

Add a zebra_mlag.h and a zebra_mlag.c startup/shutdown code to zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: Add a basic mlag.h file
Donald Sharp [Tue, 18 Dec 2018 12:35:28 +0000 (07:35 -0500)]
lib: Add a basic mlag.h file

This is the start of a series of commits that will allow FRR to
be integrated into mlag.

Zebra and Pim will both need mlag state for the router.  As such we will
need to provide a abstract about this state through the zapi.

This is the start of the common header that both Pim and Zebra will
be using.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Remove zebra_delete_rnh from being a public function
Donald Sharp [Fri, 4 Jan 2019 16:04:38 +0000 (11:04 -0500)]
zebra: Remove zebra_delete_rnh from being a public function

The zebra_delete_rnh function is not needed to be exposed
to the entire world.  Limit it's scope.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Abstract zebra_delete_rnh
Donald Sharp [Fri, 4 Jan 2019 16:02:35 +0000 (11:02 -0500)]
zebra: Abstract zebra_delete_rnh

The deletion of a rnh is always proceeded by the same checks
to see if it is done.  Just let zebra_delete_rnh do this test.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3561 from opensourcerouting/northbound-freebsd-fix
Quentin Young [Thu, 3 Jan 2019 16:48:31 +0000 (11:48 -0500)]
Merge pull request #3561 from opensourcerouting/northbound-freebsd-fix

lib: fix segfault on freebsd when using vsnprintf() incorrectly

5 years agodoc: Update documentation to new functionality
Donald Sharp [Thu, 3 Jan 2019 14:57:06 +0000 (09:57 -0500)]
doc: Update documentation to new functionality

Update sharp.rst to reflect new functionality in the `sharp install ..`
command.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agosharpd: Add code to allow install/uninstall repeatedly
Donald Sharp [Thu, 3 Jan 2019 14:49:15 +0000 (09:49 -0500)]
sharpd: Add code to allow install/uninstall repeatedly

Add a bit of test code to allow the tester to install/uninstall
the routes via:

sharp install routes A.B.C.D nexthop Y.Z.M.D 1000000 repeat 100

This will install 1000000 routes wait for them to be finished
then uninstall them then start installation over 100 times.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
5 years agoMerge pull request #3558 from opensourcerouting/silence-ioctl-warning
Russ White [Thu, 3 Jan 2019 02:43:18 +0000 (21:43 -0500)]
Merge pull request #3558 from opensourcerouting/silence-ioctl-warning

zebra: silence harmless ioctl warning when retrieving interface speed

5 years agoMerge pull request #3560 from opensourcerouting/fix-sh-bgp-community
Russ White [Thu, 3 Jan 2019 02:42:50 +0000 (21:42 -0500)]
Merge pull request #3560 from opensourcerouting/fix-sh-bgp-community

bgpd: fix parsing of community number in the "show bgp community" command

5 years agoMerge pull request #3549 from chiragshah6/mdev
Russ White [Thu, 3 Jan 2019 02:39:58 +0000 (21:39 -0500)]
Merge pull request #3549 from chiragshah6/mdev

bgpd: evpn command to restrict to default vrf

5 years agolib: fix segfault on freebsd when using vsnprintf() incorrectly
Renato Westphal [Thu, 3 Jan 2019 00:32:13 +0000 (22:32 -0200)]
lib: fix segfault on freebsd when using vsnprintf() incorrectly

FreeBSD's libc segfaults when vsnprintf() is called with a null
format string. Add a null check before calling vsnprintf() to
resolve this problem.

Fixes #3537

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agobgpd: fix parsing of community number in the "show bgp community" command
Renato Westphal [Wed, 2 Jan 2019 21:25:02 +0000 (19:25 -0200)]
bgpd: fix parsing of community number in the "show bgp community" command

Fixes #3545.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agosharpd: Abstract the route install/delete functions a bit
Donald Sharp [Wed, 2 Jan 2019 19:38:15 +0000 (14:38 -0500)]
sharpd: Abstract the route install/delete functions a bit

Abstract the route install/delete functions a bit to allow me to
expand on them in the with future commits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: silence harmless ioctl warning when retrieving interface speed
Renato Westphal [Wed, 2 Jan 2019 18:47:51 +0000 (16:47 -0200)]
zebra: silence harmless ioctl warning when retrieving interface speed

zebra uses the SIOCETHTOOL ioctl with the ETHTOOL_GSET command to
fetch the speed of interfaces from the kernel. The only problem is
that ETHTOOL_GSET returns EOPNOTSUPP when the given interface is a
virtual interface. This leads to zebra emitting warnings like this
at startup:

ZEBRA: IOCTL failure to read interface lo speed: 95 Operation not supported
ZEBRA: IOCTL failure to read interface dummy0 speed: 95 Operation not supported
ZEBRA: IOCTL failure to read interface ovs-system speed: 95 Operation not supported

Silence these warnings by ignoring EOPNOTSUPP errors, since we know
they are harmless. This is similar to how we handle EINVAL errors
from the BSD SIOCGIFMEDIA ioctl (commit c69f2c1ff).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #3553 from opensourcerouting/fix-interface-vrf-update-msg
Quentin Young [Wed, 2 Jan 2019 18:50:47 +0000 (13:50 -0500)]
Merge pull request #3553 from opensourcerouting/fix-interface-vrf-update-msg

zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message

5 years agoMerge pull request #3550 from donaldsharp/sharp_nhg
Renato Westphal [Wed, 2 Jan 2019 16:42:34 +0000 (14:42 -0200)]
Merge pull request #3550 from donaldsharp/sharp_nhg

Sharp nhg

5 years agoMerge pull request #3534 from opensourcerouting/netlink-length-duplicated
Quentin Young [Wed, 2 Jan 2019 15:53:49 +0000 (10:53 -0500)]
Merge pull request #3534 from opensourcerouting/netlink-length-duplicated

zebra: remove duplicated code

5 years agozebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
Renato Westphal [Wed, 2 Jan 2019 15:05:53 +0000 (13:05 -0200)]
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message

Unlike the other interface zapi messages, ZEBRA_INTERFACE_VRF_UPDATE
identifies interfaces using ifindexes and not interface names. This
is a problem because zebra always sends ZEBRA_INTERFACE_DOWN
and ZEBRA_INTERFACE_DELETE messages before sending
ZEBRA_INTERFACE_VRF_UPDATE, and the ZEBRA_INTERFACE_DELETE callback
from all daemons set the interface index to IFINDEX_INTERNAL. Hence,
when decoding a ZEBRA_INTERFACE_VRF_UPDATE message, the interface
lookup would always fail since the corresponding interface lost
its ifindex. Example (ospfd):

OSPF: Zebra: Interface[rt1-eth2] state change to down.
OSPF: Zebra: interface delete rt1-eth2 vrf default[0] index 8 flags 11143 metric 0 mtu 1500
OSPF: [EC 100663301] INTERFACE_VRF_UPDATE: Cannot find IF 8 in VRF 0

To fix this problem, use interface names instead of ifindexes to
indentify interfaces like the other interface zapi messages do.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agosharpd: Allow sharpd to accept nexthop group as part of route install
Donald Sharp [Mon, 31 Dec 2018 22:49:47 +0000 (17:49 -0500)]
sharpd: Allow sharpd to accept nexthop group as part of route install

When installing routes via sharpd 'sharp install route... ' command
add the ability to specify a nexthop-group to use.  This will
allow sharpd to create ECMP routes into zebra.

Nexthop-group:
!
nexthop-group JANELLE
  nexthop 192.168.209.1
  nexthop 192.168.210.1
!

The install:

donna.cumulusnetworks.com# sharp install routes 10.0.50.0 nexthop-group JANELLE 10
donna.cumulusnetworks.com# end
donna.cumulusnetworks.com# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route

K>* 0.0.0.0/0 [0/106] via 10.0.2.2, enp0s3, 00:20:38
C>* 10.0.2.0/24 is directly connected, enp0s3, 00:20:38
D>* 10.0.50.0/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.1/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.2/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.3/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.4/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.5/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.6/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.7/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.8/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
D>* 10.0.50.9/32 [150/0] via 192.168.209.1, enp0s8, 00:00:02
  *                      via 192.168.210.1, enp0s9, 00:00:02
C>* 192.168.209.0/24 is directly connected, enp0s8, 00:20:38
C>* 192.168.210.0/24 is directly connected, enp0s9, 00:20:38
donna.cumulusnetworks.com#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agosharpd/vtysh: Allow sharpd to use nexthop-groups
Donald Sharp [Mon, 31 Dec 2018 22:48:36 +0000 (17:48 -0500)]
sharpd/vtysh: Allow sharpd to use nexthop-groups

Allow the sharp daemon to understand and use nexthop-groups.

This commit is merely to allow sharpd to understand them
when accepted in a future commit

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agosharp: Modify route install to take nexthop groups
Donald Sharp [Mon, 31 Dec 2018 22:28:13 +0000 (17:28 -0500)]
sharp: Modify route install to take nexthop groups

Modify the route_add function to take nexthop groups.  Future commits
will allow sharpd to use nexthop groups as the install mechanism
for routes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Consolidate meta_queue_map into route_info
Donald Sharp [Wed, 2 Jan 2019 14:15:30 +0000 (09:15 -0500)]
zebra: Consolidate meta_queue_map into route_info

The route_info data structure already had a mapping of route type
to admin distance.  Consolidate the meta_queue_map information
into this route_info data structure.  This is to reduce the number
of places we need to remember to touch when adding a new routing
protocol.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3543 from donaldsharp/eigrp_router_id_is_the_bee
Renato Westphal [Wed, 2 Jan 2019 00:39:03 +0000 (22:39 -0200)]
Merge pull request #3543 from donaldsharp/eigrp_router_id_is_the_bee

Eigrp router id cleanup

5 years agoMerge pull request #3540 from donaldsharp/staic
Renato Westphal [Wed, 2 Jan 2019 00:36:59 +0000 (22:36 -0200)]
Merge pull request #3540 from donaldsharp/staic

staticd: Do not ready prefix for printing till it's decoded

5 years agoMerge pull request #3246 from pguibert6WIND/distribute_vrf_aware
Renato Westphal [Wed, 2 Jan 2019 00:34:59 +0000 (22:34 -0200)]
Merge pull request #3246 from pguibert6WIND/distribute_vrf_aware

Distribute vrf aware

5 years agobgpd: evpn command to restrict to default vrf
Chirag Shah [Mon, 31 Dec 2018 21:18:21 +0000 (13:18 -0800)]
bgpd: evpn command to restrict to default vrf

Certain EVPN configuartions should only be applied
under DEFAULT VRF bgpd instance.

reject the cli for non default bgp instance

Ticket:CM-18950

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
5 years agoMerge pull request #3546 from opensourcerouting/ospf-show-neighbor-fix
Donald Sharp [Mon, 31 Dec 2018 14:26:37 +0000 (09:26 -0500)]
Merge pull request #3546 from opensourcerouting/ospf-show-neighbor-fix

ospfd: fix wrong argv index in the "show ip ospf neighbor" command

5 years agoospfd: convert a couple of "show" commands to DEFPY
Renato Westphal [Mon, 31 Dec 2018 13:11:15 +0000 (11:11 -0200)]
ospfd: convert a couple of "show" commands to DEFPY

DEFPY commands are easier to maintain and less susceptible to
bugs. In the long term we should try to merge the plethora of
"show ip ospf neighbor" commands (total of 14) into a single DEFPY.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoospfd: fix wrong argv index in the "show ip ospf neighbor" command
Renato Westphal [Mon, 31 Dec 2018 13:02:49 +0000 (11:02 -0200)]
ospfd: fix wrong argv index in the "show ip ospf neighbor" command

Fixes Issue #3544.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoeigrpd: Allow eigrp to set/unset the router-id as a value.
Donald Sharp [Mon, 31 Dec 2018 00:59:52 +0000 (19:59 -0500)]
eigrpd: Allow eigrp to set/unset the router-id as a value.

This code addition allows eigrp to set/unset the router-id
value.  At this point I am not 100% sure that we do all the necessary
rework when a router-id changes.  But on startup if read in before
a network statement we should be ok.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoeigrpd: eigrp usage of uint32_t to struct in_addr for router_id data
Donald Sharp [Mon, 31 Dec 2018 00:54:25 +0000 (19:54 -0500)]
eigrpd: eigrp usage of uint32_t to struct in_addr for router_id data

In eigrp we were using a uint32_t to hold the `struct in_addr` data
for the router id values.  This caused us to do unnecessary conversions
pre and post for in/out.  Let's just use the standard `struct in_addr`

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoeigrpd: Write eigrp config even if no network statements yet
Donald Sharp [Mon, 31 Dec 2018 00:44:27 +0000 (19:44 -0500)]
eigrpd: Write eigrp config even if no network statements yet

Let's write the eigrp config even if we have no network statements
as that the other functions return safely if nothing to do here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: replace zlog_err with flog_err
Rafael Zalamena [Sat, 29 Dec 2018 09:14:14 +0000 (07:14 -0200)]
zebra: replace zlog_err with flog_err

Change the logging mechanism for truncated netlink error messages.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agostaticd: Do not ready prefix for printing till it's decoded
Donald Sharp [Fri, 28 Dec 2018 02:46:01 +0000 (21:46 -0500)]
staticd: Do not ready prefix for printing till it's decoded

The static daemon is setting up the prefix for printing
before it is decoded when we get notified about our
route.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib, rip, ripng, babel, eigrp: add ctx pointer to distribute api
Philippe Guibert [Tue, 4 Dec 2018 14:45:57 +0000 (15:45 +0100)]
lib, rip, ripng, babel, eigrp: add ctx pointer to distribute api

a distribute_ctx context pointer is returned after initialisation to the
calling daemon. this context pointer will be further used to do
discussion with distribute service. Today, there is no specific problem
with old api, since the pointer is the same in all the memory process.
but the pointer will be different if we have multiple instances. Right
now, this is not the case, but if that happens, that work will be used
for that.
distribute-list initialisation is split in two. the vty initialisation
is done at global level, while the context initialisation is done for
each routing daemon instance.
babel daemon is being equipped with a routing returning the main babel
instance.
also, a delete routine is available when the daemon routing instance is
suppressed.
a list of contexts is used inside distribute_list. This will permit
distribute_list utility to handle in the same daemon to handle more than
one context. This will be very useful in the vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
5 years agolib: enforce vrf_name_to_id by returning default_vrf when name is null
Philippe Guibert [Tue, 20 Nov 2018 09:30:47 +0000 (10:30 +0100)]
lib: enforce vrf_name_to_id by returning default_vrf when name is null

in order to enforce the vrf_id to return, from a vrf name, a check is
done on the vrf_name_to_id callback.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
5 years agoMerge pull request #3535 from kareiva/master
Quentin Young [Thu, 27 Dec 2018 21:25:26 +0000 (16:25 -0500)]
Merge pull request #3535 from kareiva/master

Fix typos in BGPd sample configuration file

5 years agoFix typos in BGPd sample configuration file
Simonas [Thu, 27 Dec 2018 07:13:55 +0000 (09:13 +0200)]
Fix typos in BGPd sample configuration file

5 years agozebra: remove duplicated code
Rafael Zalamena [Wed, 26 Dec 2018 18:57:46 +0000 (16:57 -0200)]
zebra: remove duplicated code

Remove duplicated netlink error message length check.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoMerge pull request #3527 from opensourcerouting/ldpd-bsd-fixes
Donald Sharp [Sat, 22 Dec 2018 01:20:48 +0000 (20:20 -0500)]
Merge pull request #3527 from opensourcerouting/ldpd-bsd-fixes

ldpd: *BSD fixes

5 years agoldpd: fix startup on OpenBSD
Rafael Zalamena [Fri, 21 Dec 2018 22:59:18 +0000 (20:59 -0200)]
ldpd: fix startup on OpenBSD

We must open the PF_KEY socket before dropping privileges, otherwise the
socket creation will fail with permission problems.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agozebra: fix compilation on OpenBSD
Rafael Zalamena [Fri, 21 Dec 2018 19:03:05 +0000 (17:03 -0200)]
zebra: fix compilation on OpenBSD

OpenBSD doesn't define RTM_LOCK anymore:
https://marc.info/?l=openbsd-tech&m=153018811429193&w=2

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoldpd: add support for FreeBSD IP_BINDANY
Rafael Zalamena [Fri, 21 Dec 2018 14:27:44 +0000 (12:27 -0200)]
ldpd: add support for FreeBSD IP_BINDANY

Add yet another way to setsockopt a socket to listen to a foreign
address.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoMerge pull request #3499 from donaldsharp/topotest_inheritance
Rafael Zalamena [Thu, 20 Dec 2018 17:52:03 +0000 (15:52 -0200)]
Merge pull request #3499 from donaldsharp/topotest_inheritance

Topotest inheritance

5 years agoMerge pull request #3327 from adeg/feature/bgp-lu-auto-labels
Renato Westphal [Thu, 20 Dec 2018 15:59:28 +0000 (13:59 -0200)]
Merge pull request #3327 from adeg/feature/bgp-lu-auto-labels

bgpd, zebra: auto assign labels to regular labeled-unicast prefixes

5 years agobgpd, zebra: auto assign labels from label pool to regular prefixes in BGP labeled...
Anton Degtyarev [Wed, 14 Nov 2018 03:14:04 +0000 (06:14 +0300)]
bgpd, zebra: auto assign labels from label pool to regular prefixes in BGP labeled unicast

This commit is the last missing piece to complete BGP LU support in bgpd. To this moment, bgpd (and zebra) supported auto label assignment only for prefixes leaked from VRFs to vpn and for MPLS SR prefixes. This adds auto label assignment to other routes types in bgpd. The following enhancements have been made:
* bgp_route.c:bgp_process_main_one() now sets implicit-null local_label to all local, aggregate and redistributed routes.
* bgp_route.c:bgp_process_main_one() now will request a label from the label pool for any prefix that loses the label for some reason (for example, when the static label assignment config is removed)
* bgp_label.c:bgp_reg_dereg_for_label() now requests labels from label pool for routes which have no associated label index
* zebra_mpls.c:zebra_mpls_fec_register() now expects both label and label_index from the calling function, one of which must be set to MPLS_INVALID_LABEL or MPLS_INVALID_LABEL_INDEX, based on this it will decide how to register the provided FEC.

Signed-off-by: Anton Degtyarev <anton@cumulusnetworks.com>
5 years agoMerge pull request #3516 from qlyoung/doc-ip-nht-resolve-via-default
Renato Westphal [Thu, 20 Dec 2018 12:05:01 +0000 (10:05 -0200)]
Merge pull request #3516 from qlyoung/doc-ip-nht-resolve-via-default

doc: add `ip nht resolve-via-default`

5 years agoMerge pull request #3517 from qlyoung/doc-exclude-snmptrap
Renato Westphal [Thu, 20 Dec 2018 12:04:13 +0000 (10:04 -0200)]
Merge pull request #3517 from qlyoung/doc-exclude-snmptrap

doc: exclude snmptrap.rst from build

5 years agoMerge pull request #3515 from mjstapp/fix_rib_wq_timer
Donald Sharp [Wed, 19 Dec 2018 20:33:56 +0000 (15:33 -0500)]
Merge pull request #3515 from mjstapp/fix_rib_wq_timer

zebra: reduce rib workqueue retry timeout

5 years agodoc: exclude snmptrap.rst from build
Quentin Young [Wed, 19 Dec 2018 18:08:42 +0000 (18:08 +0000)]
doc: exclude snmptrap.rst from build

This doc is .. include::'d in snmp.rst and needs to be ignored as part
of the main toctree build. This patch squashes a Sphinx build warning.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: add `ip nht resolve-via-default`
Quentin Young [Wed, 19 Dec 2018 17:55:05 +0000 (17:55 +0000)]
doc: add `ip nht resolve-via-default`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agoMerge pull request #3513 from mjstapp/fix_dplane_q_include
Quentin Young [Wed, 19 Dec 2018 17:11:24 +0000 (12:11 -0500)]
Merge pull request #3513 from mjstapp/fix_dplane_q_include

zebra: include lib/queue.h in zebra dataplane

5 years agoMerge pull request #3492 from donaldsharp/no_set_community
Russ White [Wed, 19 Dec 2018 16:57:01 +0000 (11:57 -0500)]
Merge pull request #3492 from donaldsharp/no_set_community

bgpd: Allow 'no set community`

5 years agozebra: reduce rib workqueue retry timeout
Mark Stapp [Wed, 19 Dec 2018 16:51:41 +0000 (11:51 -0500)]
zebra: reduce rib workqueue retry timeout

Reduce the zebra rib workqueue retry timeout, used when the queue
towards the zebra dataplane has reached its limit. Lowering the
value was reported to improve update throughput on some platforms.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agoMerge pull request #3502 from donaldsharp/socket_to_me_baby
Russ White [Wed, 19 Dec 2018 16:48:42 +0000 (11:48 -0500)]
Merge pull request #3502 from donaldsharp/socket_to_me_baby

BSD route socket refactoring/cleanup

5 years agozebra: Fixup spaces/tabs issue found by CI in rt_socket.c
Donald Sharp [Wed, 19 Dec 2018 00:32:14 +0000 (19:32 -0500)]
zebra: Fixup spaces/tabs issue found by CI in rt_socket.c

Cleanup the space/tabs issues found by CI in rt_socket.c so
it stops complaining at us.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Make label processing guaranteed to be unique
Donald Sharp [Wed, 19 Dec 2018 00:34:22 +0000 (19:34 -0500)]
zebra: Make label processing guaranteed to be unique

The label processing for socket installs was not ensuring
that each nexthop would not accidently use the last
nexthops value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>