]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
6 years agovtysh: cleanup SUID handling
David Lamparter [Sun, 27 Aug 2017 18:38:54 +0000 (20:38 +0200)]
vtysh: cleanup SUID handling

Eliminate several more SUID problems (VTYSH_LOG, history file) and make
the whole SUID approach more robust.  Still possibly unsafe to use, but
much better.

[v2: wrap seteuid/setegid calls]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agoMerge pull request #1054 from dslicenc/eigrp-connected
David Lamparter [Sun, 27 Aug 2017 17:21:55 +0000 (19:21 +0200)]
Merge pull request #1054 from dslicenc/eigrp-connected

eigrpd: add correct interface metrics when interface comes up

6 years agoMerge pull request #1046 from qlyoung/fix-cli-ambiguous
David Lamparter [Sun, 27 Aug 2017 17:20:14 +0000 (19:20 +0200)]
Merge pull request #1046 from qlyoung/fix-cli-ambiguous

fix handling of ambiguous cli

6 years agoMerge pull request #1034 from dwalton76/bgpd-mpls-fec-allocate
David Lamparter [Sun, 27 Aug 2017 17:18:58 +0000 (19:18 +0200)]
Merge pull request #1034 from dwalton76/bgpd-mpls-fec-allocate

Bgpd mpls fec allocate

6 years agoeigrpd: add correct interface metrics when interface comes up
Don Slice [Sat, 26 Aug 2017 19:51:43 +0000 (15:51 -0400)]
eigrpd: add correct interface metrics when interface comes up

Problem noticed where we were not sending the correct metric values
to our peers for connected interfaces.  Found that we were not storing
these values on the structure used to send the update packets.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
6 years agoMerge pull request #1049 from opensourcerouting/openbsd-warnings
Donald Sharp [Sat, 26 Aug 2017 12:05:36 +0000 (08:05 -0400)]
Merge pull request #1049 from opensourcerouting/openbsd-warnings

fix warnings on OpenBSD

6 years agoisisd: bpf: ETHER_HDR_LEN -> ETH_ALEN
David Lamparter [Fri, 25 Aug 2017 23:52:12 +0000 (01:52 +0200)]
isisd: bpf: ETHER_HDR_LEN -> ETH_ALEN

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agozebra: remove RT_ROUNDUP warning
David Lamparter [Fri, 25 Aug 2017 23:41:07 +0000 (01:41 +0200)]
zebra: remove RT_ROUNDUP warning

This warning is at odds with how the world works.  Also, the code is
correct on all platforms we care about.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agolib: prefix: fix char value size
David Lamparter [Fri, 25 Aug 2017 23:38:10 +0000 (01:38 +0200)]
lib: prefix: fix char value size

There are 16 bytes here, not 8.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agobgpd: encap: fix extension sizing
David Lamparter [Fri, 25 Aug 2017 23:27:22 +0000 (01:27 +0200)]
bgpd: encap: fix extension sizing

Variably-sized struct tails are done as [0], not [1].  The latter
triggers compiler warnings and mis-sizes "sizeof(struct) + n"
expressions.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years ago*: fix compiler warnings
David Lamparter [Fri, 25 Aug 2017 23:14:25 +0000 (01:14 +0200)]
*: fix compiler warnings

Specifically, gcc 4.2.1 on OpenBSD 6.0 warns about these;  they're bogus
(gcc 4.2, being rather old, isn't quite as "intelligent" as newer
versions; the newer ones apply more logic and less warnings.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agolib: remove static variable from cli matcher
Quentin Young [Fri, 25 Aug 2017 18:08:16 +0000 (14:08 -0400)]
lib: remove static variable from cli matcher

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agolib: fix rare bug in ambiguous command resolution
Quentin Young [Fri, 25 Aug 2017 17:39:13 +0000 (13:39 -0400)]
lib: fix rare bug in ambiguous command resolution

In certain situations, the CLI matcher would not handle ambiguous
commands properly. If it found an ambiguous result in a lower subgraph,
the ambiguous result would not correctly propagate up to previous frames
in the resolution DFS as ambiguous; instead it would propagate up as a
non-match, which could subsequently be overridden by a partial match.

Example CLI space:

  show ip route summary
  show ip route supernet-only
  show ipv6 route summary

Entering `show ip route su` would result in an ambiguous resolution for
the `show ip route` subgraph but would propagate up to the `show ip`
subgraph as a no-match, allowing `ip` to partial-match `ipv6` and
execute that command.

In this example entering `show ip route summary` would disambiguate the
`show ip` subgraph. So this bug would only appear when entering input
that caused ambiguities in at least two parallel subgraphs.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoMerge pull request #1045 from opensourcerouting/clippy-coverity
Donald Sharp [Fri, 25 Aug 2017 17:51:46 +0000 (13:51 -0400)]
Merge pull request #1045 from opensourcerouting/clippy-coverity

clippy: disable unneeded autogenerated code

6 years agoclippy: disable unneeded autogenerated code
David Lamparter [Fri, 25 Aug 2017 16:54:13 +0000 (18:54 +0200)]
clippy: disable unneeded autogenerated code

Coverity is generating a lot of warnings about unused stuff being
around.  Disabling these bits is most easily done by just putting a few
preprocessor directives into the template.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agoMerge pull request #1037 from donaldsharp/eigrp_split_horizon
Donnie Savage [Thu, 24 Aug 2017 19:39:46 +0000 (15:39 -0400)]
Merge pull request #1037 from donaldsharp/eigrp_split_horizon

Eigrp split horizon and ipv4 to prefix changes approved

6 years agoMerge pull request #1040 from donaldsharp/sgrpt
Jafar Al-Gharaibeh [Thu, 24 Aug 2017 16:41:38 +0000 (11:41 -0500)]
Merge pull request #1040 from donaldsharp/sgrpt

Sgrpt

6 years agopimd: Cleanup S,GRPt prune handling on Mroute Loss
Donald Sharp [Thu, 24 Aug 2017 13:55:19 +0000 (09:55 -0400)]
pimd: Cleanup S,GRPt prune handling on Mroute Loss

1) Clean up display of S,GRPt prune state to be more meaningful
2) Upon receipt of a S,GRPt prune make sure we transition to
   the correct state
3) Upon loss of a S,GRPt prune make sure we transition to
   the correct state as well as immediately send a *,G
   join upstream to propagate the loss of the prune.
4) Removal of a weird S,G state being installed upon
   loss of a S,G RPt prune.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agopimd: Cleanup a debug for vrf
Donald Sharp [Thu, 24 Aug 2017 13:53:05 +0000 (09:53 -0400)]
pimd: Cleanup a debug for vrf

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1038 from donaldsharp/zserv
Renato Westphal [Thu, 24 Aug 2017 13:26:31 +0000 (10:26 -0300)]
Merge pull request #1038 from donaldsharp/zserv

zebra: Fix compiler warnings

6 years agoMerge pull request #1031 from opensourcerouting/small-bits
Donald Sharp [Thu, 24 Aug 2017 12:58:46 +0000 (08:58 -0400)]
Merge pull request #1031 from opensourcerouting/small-bits

small bits

6 years agolib: Fix nexthop num
Donald Sharp [Thu, 24 Aug 2017 12:30:08 +0000 (08:30 -0400)]
lib: Fix nexthop num

If we assign MULTIPATH_NUM to be 256, this causes issues
for us since 256 is bigger than a u_char.  So let's make
the api's multipath_num to be a u_int16_t and pass it
around as a word.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Fix distance comparison
Donald Sharp [Thu, 24 Aug 2017 11:34:21 +0000 (07:34 -0400)]
eigrpd: Fix distance comparison

The distance comparison for when we received an
internal and we already had an internal was
overriding the metrics of the connected.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Fix compiler warning introduced
Donald Sharp [Thu, 24 Aug 2017 00:26:19 +0000 (20:26 -0400)]
eigrpd: Fix compiler warning introduced

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Remove 'struct prefix_ipv4' from eigrp_network.c
Donald Sharp [Wed, 23 Aug 2017 19:39:30 +0000 (15:39 -0400)]
eigrpd: Remove 'struct prefix_ipv4' from eigrp_network.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Remove 'struct prefix_ipv4' from eigrp_interface.c
Donald Sharp [Wed, 23 Aug 2017 19:38:29 +0000 (15:38 -0400)]
eigrpd: Remove 'struct prefix_ipv4' from eigrp_interface.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Refactor eigrp_network_[un]set to use prefix
Donald Sharp [Wed, 23 Aug 2017 19:35:27 +0000 (15:35 -0400)]
eigrpd: Refactor eigrp_network_[un]set to use prefix

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Refactor eigrp_topoloy_table_lookup_ipv4
Donald Sharp [Wed, 23 Aug 2017 19:31:02 +0000 (15:31 -0400)]
eigrpd: Refactor eigrp_topoloy_table_lookup_ipv4

Allow eigrp_topology_table_lookup_ipv4 to use
'struct prefix'

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h
Donald Sharp [Wed, 23 Aug 2017 18:36:06 +0000 (14:36 -0400)]
eigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Convert pe->destination_ipv4 to pe->destination
Donald Sharp [Wed, 23 Aug 2017 18:19:45 +0000 (14:19 -0400)]
eigrpd: Convert pe->destination_ipv4 to pe->destination

Convert the destination_ipv4 to a struct prefix and just
call it destination.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Use FSM for interface pe already known.
Donald Sharp [Wed, 23 Aug 2017 17:26:50 +0000 (13:26 -0400)]
eigrpd: Use FSM for interface pe already known.

There exists a case where a switch already has
a eigrp_prefix_entry for a interface that is
coming up.

In this situation, we need to use the FSM
to let the connected route take precedence
instead of blindly just updating the world
about it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: No need to create TLV type
Donald Sharp [Tue, 22 Aug 2017 23:48:23 +0000 (19:48 -0400)]
eigrpd: No need to create TLV type

There is no need to create a TLV type to pass in for the
FSM message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Remove union from FSM msg
Donald Sharp [Tue, 22 Aug 2017 23:19:10 +0000 (19:19 -0400)]
eigrpd: Remove union from FSM msg

Remove the union of passing the TLV and just pass the metric in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Improve external route distance comparison
Donald Sharp [Tue, 22 Aug 2017 20:24:23 +0000 (16:24 -0400)]
eigrpd: Improve external route distance comparison

If the new nexthop is external while the previous
best was Internal or Connected, it should always loose.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: make fsm msg data_type an enum
Donald Sharp [Tue, 22 Aug 2017 20:19:23 +0000 (16:19 -0400)]
eigrpd: make fsm msg data_type an enum

We need to eventually be able to handle multiple
data types to figure out if the distance is better
worse.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Refactor FSM calling
Donald Sharp [Tue, 22 Aug 2017 19:43:30 +0000 (15:43 -0400)]
eigrpd: Refactor FSM calling

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Fix memory leak in FSM
Donald Sharp [Tue, 22 Aug 2017 19:39:18 +0000 (15:39 -0400)]
eigrpd: Fix memory leak in FSM

The FSM was never freeing the msg.  Since we
do not have a special queue for it, just don't
allocate the memory.  In the future we can put
this back.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Cleanup list accessors
Donald Sharp [Tue, 22 Aug 2017 18:53:14 +0000 (14:53 -0400)]
eigrpd: Cleanup list accessors

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Remove unnecessary check
Donald Sharp [Tue, 22 Aug 2017 18:42:43 +0000 (14:42 -0400)]
eigrpd: Remove unnecessary check

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoeigrpd: Start split-horizon
Donald Sharp [Tue, 22 Aug 2017 18:40:24 +0000 (14:40 -0400)]
eigrpd: Start split-horizon

EIGRP was not handling split-horizon.  This code starts
down the path of properly considering it.  There still
exists situations where we are not properly handling it
though.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agozebra: Fix compiler warnings
Donald Sharp [Thu, 24 Aug 2017 12:02:27 +0000 (08:02 -0400)]
zebra: Fix compiler warnings

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #1022 from opensourcerouting/zapi_consolidation
Donald Sharp [Thu, 24 Aug 2017 10:03:55 +0000 (06:03 -0400)]
Merge pull request #1022 from opensourcerouting/zapi_consolidation

Zapi consolidation

6 years agolib: mark the old zebra API for route advertisement as deprecated
Renato Westphal [Wed, 23 Aug 2017 22:12:48 +0000 (19:12 -0300)]
lib: mark the old zebra API for route advertisement as deprecated

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoospf6d: fix regression detected by topotest
Renato Westphal [Mon, 21 Aug 2017 22:43:43 +0000 (19:43 -0300)]
ospf6d: fix regression detected by topotest

With the old API, ospf6d always needed to send a nexthop address and a
nexthop interface when advertising a route to zebra. In the case where
the nexthop address didn't exist (e.g. connected route), zebra would
take care of ignore it in the zread_ipv6_add() function.

Now, if we have a nexthop interface but not a nexthop address, we not
only can but we should send a nexthop of type NEXTHOP_TYPE_IFINDEX. zebra
won't fix bad nexthops anymore because the clients have a proper API to
send correct messages.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: use zapi_route to send/receive redistributed routes as well
Renato Westphal [Mon, 21 Aug 2017 01:10:50 +0000 (22:10 -0300)]
*: 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>
6 years agobgpd: unify ipv4/ipv6 zebra-tx functions
Renato Westphal [Mon, 21 Aug 2017 00:36:44 +0000 (21:36 -0300)]
bgpd: unify ipv4/ipv6 zebra-tx functions

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agonhrpd: unify ipv4/ipv6 zebra-tx functions
Renato Westphal [Mon, 21 Aug 2017 00:36:35 +0000 (21:36 -0300)]
nhrpd: unify ipv4/ipv6 zebra-tx functions

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoisisd: unify ipv4/ipv6 zebra-tx functions
Renato Westphal [Mon, 21 Aug 2017 00:29:35 +0000 (21:29 -0300)]
isisd: unify ipv4/ipv6 zebra-tx functions

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agobgpd: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:19:25 +0000 (21:19 -0300)]
bgpd: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #1026 from qlyoung/no-ospf6
David Lamparter [Wed, 23 Aug 2017 22:24:57 +0000 (00:24 +0200)]
Merge pull request #1026 from qlyoung/no-ospf6

ospf6d: add `no` forms for interface commands

6 years agolib: split off compiler magic into its own file
David Lamparter [Wed, 23 Aug 2017 18:22:31 +0000 (20:22 +0200)]
lib: split off compiler magic into its own file

Also make timed notices available via CONFDATE.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agobuild: fix libtool stupidity wrt. parallel install
David Lamparter [Wed, 23 Aug 2017 13:45:05 +0000 (15:45 +0200)]
build: fix libtool stupidity wrt. parallel install

there's no dependency between libraries and other things to be
installed, but libtool in its 90ies design wants to relink libraries
when installing them.  Add manual dependencies to work around this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agolib: prefix: try harder to not hash garbage
David Lamparter [Wed, 23 Aug 2017 16:51:18 +0000 (18:51 +0200)]
lib: prefix: try harder to not hash garbage

With prefix_ptr or prefix_ls, there can still be stuff in a struct
prefix that we shouldn't hash.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agobgpd: fix stats counting for IPv6
David Lamparter [Wed, 23 Aug 2017 16:21:30 +0000 (18:21 +0200)]
bgpd: fix stats counting for IPv6

Fixes: #991
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agopython/clippy: make output file writing less weird
David Lamparter [Wed, 23 Aug 2017 15:33:17 +0000 (17:33 +0200)]
python/clippy: make output file writing less weird

This should stomp out any parallel build issues in this regard.

Fixes: #971
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agolib: better warnings for install_element
David Lamparter [Wed, 23 Aug 2017 15:06:24 +0000 (17:06 +0200)]
lib: better warnings for install_element

Also fixes misuse of vector_slot() - that one doesn't check for access
beyond end of vector...

And print node names in grammar sandbox "printall".

Fixes: #543
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agoospf6d: properly update prefix list references
David Lamparter [Wed, 23 Aug 2017 14:54:15 +0000 (16:54 +0200)]
ospf6d: properly update prefix list references

Register add/delete hooks with the prefix list code to properly change
ospf6_area's prefix list in/out pointers.

There are 2 other uncached uses of prefix lists in the ASBR route-map
code and the interface code;  these should probably be cached too. (To
be fixed another day...)

Fixes: #453
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agolib: fix cosmetic issue with exit race
David Lamparter [Wed, 23 Aug 2017 14:23:17 +0000 (16:23 +0200)]
lib: fix cosmetic issue with exit race

if we're using --terminal, the daemon may in some cases exit fast enough
for the parent to see this; this resulted in a confusing/bogus "failed
to start, exited 0" message.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agolib: centralized memstats-at-exit
David Lamparter [Wed, 23 Aug 2017 14:18:49 +0000 (16:18 +0200)]
lib: centralized memstats-at-exit

adds a new all-daemon "debug memstats-at-exit" command.  Also saves
memstats to a file in /tmp, useful if a long-running daemon is having
weird issues (e.g. in a user install).

Fixes: #437
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agoospf6d: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:19:07 +0000 (21:19 -0300)]
ospf6d: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoospfd: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:18:58 +0000 (21:18 -0300)]
ospfd: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agonhrpd: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:18:50 +0000 (21:18 -0300)]
nhrpd: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoisisd: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:18:36 +0000 (21:18 -0300)]
isisd: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoeigrpd: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:17:59 +0000 (21:17 -0300)]
eigrpd: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoripd/ripngd: use the new API to send routes to zebra
Renato Westphal [Mon, 21 Aug 2017 00:17:09 +0000 (21:17 -0300)]
ripd/ripngd: use the new API to send routes to zebra

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozapi: add support for routes with multiple labels
Renato Westphal [Sun, 20 Aug 2017 22:57:36 +0000 (19:57 -0300)]
zapi: add support for routes with multiple labels

This will be necessary for the Segment Routing feature.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agobabeld: unify kernel_route_v4() and kernel_route_v6()
Renato Westphal [Sun, 20 Aug 2017 01:31:32 +0000 (22:31 -0300)]
babeld: unify kernel_route_v4() and kernel_route_v6()

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib/zserv: introduce address-family independent ZAPI message types
Renato Westphal [Sun, 20 Aug 2017 00:59:41 +0000 (21:59 -0300)]
lib/zserv: introduce address-family independent ZAPI message types

As noticed in 657cde1, the zapi_ipv[4|6]_route functions are broken in
many ways and that's the reason that many client daemons (e.g. ospfd,
isisd) need to send handcrafted messages to zebra.

The zapi_route() function introduced by Donald solves the problem
by providing a consistent way to send ipv4/ipv6 routes to zebra with
nexthops of any type, in all possible combinations including IPv4 routes
with IPv6 nexthops (for BGP unnumbered routes).

This patch goes a bit further and creates two new address-family
independent ZAPI message types that the client daemons can
use to advertise route information to zebra: ZEBRA_ROUTE_ADD and
ZEBRA_ROUTE_DELETE. The big advantage of having address-family independent
messages is that it allows us to remove a lot of duplicate code in zebra
and in the client daemons.

This patch also introduces the zapi_route_decode() function. It will be
used by zebra to decode route messages sent by the client daemons using
zclient_route_send(), which calls zapi_route_encode().

Later on we'll use this same pair of encode/decode functions to
send/receive redistributed routes from zebra to the client daemons,
taking the idea of removing code duplication to the next level.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: updates to zapi_route
Renato Westphal [Sun, 20 Aug 2017 00:25:12 +0000 (21:25 -0300)]
lib: updates to zapi_route

This patch introduces the following changes to the zapi_route structure
and associated code:
* Use a fixed-size array to store the nexthops instead of a pointer. This
  makes the zapi_route() function much easier to use when we have multiple
  nexthops to send. It's also much more efficient to put everything on
  the stack rather than allocating an array in the heap every time we
  need to send a route to zebra;

* Use the new 'zapi_nexthop' structure. This will allow the client daemons
  to send labeled routes without having to allocate memory for the labels
  (the 'nexthop' structure was designed to be memory efficient and doesn't
  have room for MPLS labels, only a pointer). Also, 'zapi_nexthop' is more
  compact and more clean from an API perspective;

* Embed the route prefix inside the zapi_route structure. Since the
  route's prefix is sent along with its nexthops and attributes, it makes
  sense to pack everything inside the same structure.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozserv: identify label type based on the client protocol
Renato Westphal [Sat, 19 Aug 2017 23:00:25 +0000 (20:00 -0300)]
zserv: identify label type based on the client protocol

This fixes a problem where the type of the BGP-LU labels was not
being set.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozserv: simplify handling of route delete requests
Renato Westphal [Sat, 19 Aug 2017 17:26:00 +0000 (14:26 -0300)]
zserv: simplify handling of route delete requests

Route attributes like tag, distance and metric are irrelevant when we
want to delete a route from a client daemon. The same can be said about
the nexthops of the route. Only the IP prefix and client protocol are
enough to identify the route we want to remove, considering that zebra
maintains at most one route from each client daemon for each prefix. Once
rib_delete() is called, it deletes the selected route with all of its
nexthops.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agobabeld/eigrpd/ldpd/nhrpd: add prefix length sanity checks
Renato Westphal [Sat, 19 Aug 2017 17:12:20 +0000 (14:12 -0300)]
babeld/eigrpd/ldpd/nhrpd: add prefix length sanity checks

Pulled from d917882.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra: add support for NEXTHOP_TYPE_IPV6_IFINDEX in zserv
Renato Westphal [Sat, 19 Aug 2017 16:01:00 +0000 (13:01 -0300)]
zebra: add support for NEXTHOP_TYPE_IPV6_IFINDEX in zserv

This is the v6 counterpart of commit c963c20.

Fixes a bug where ipv6 routes received from babeld were being ignored.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agobabeld/nhrpd: ignore ipv6 srcdest routes
Renato Westphal [Sat, 19 Aug 2017 15:09:38 +0000 (12:09 -0300)]
babeld/nhrpd: ignore ipv6 srcdest routes

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: remove leftovers from "router zebra"
Renato Westphal [Sat, 19 Aug 2017 14:38:47 +0000 (11:38 -0300)]
*: remove leftovers from "router zebra"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agovnc/eigrpd/isisd: check for the correct message types
Renato Westphal [Sat, 19 Aug 2017 14:28:21 +0000 (11:28 -0300)]
vnc/eigrpd/isisd: check for the correct message types

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: remove redundant zebra messages
Renato Westphal [Sat, 19 Aug 2017 14:20:42 +0000 (11:20 -0300)]
lib: remove redundant zebra messages

This also fixes a bug of ipv6 routes advertised by the VNC code being
ignored by zebra.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years ago*: reduce excessive indentation in a few places
Renato Westphal [Sat, 12 Aug 2017 16:03:29 +0000 (13:03 -0300)]
*: reduce excessive indentation in a few places

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #1030 from opensourcerouting/bgpd-fd-leak
Quentin Young [Wed, 23 Aug 2017 19:45:53 +0000 (15:45 -0400)]
Merge pull request #1030 from opensourcerouting/bgpd-fd-leak

bgpd: fix file descriptor leak

6 years agozebra: don't print 0.0.0.0:0 for FPM config
David Lamparter [Wed, 23 Aug 2017 13:48:36 +0000 (15:48 +0200)]
zebra: don't print 0.0.0.0:0 for FPM config

Fixes: #319
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agobgpd: fix file descriptor leak
Renato Westphal [Tue, 22 Aug 2017 23:09:26 +0000 (20:09 -0300)]
bgpd: fix file descriptor leak

Bug introduced by commit 37d361e7. Removing the call to bgp_close()
from bgp_delete() was a mistake.

Reported-by: Don Slice <dslice@cumulusnetworks.com>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #1028 from opensourcerouting/mpls_label_stack
Donald Sharp [Tue, 22 Aug 2017 22:25:23 +0000 (18:25 -0400)]
Merge pull request #1028 from opensourcerouting/mpls_label_stack

zebra: increase maximum label stack depth

6 years agozebra: increase maximum label stack depth
Renato Westphal [Tue, 22 Aug 2017 20:01:54 +0000 (17:01 -0300)]
zebra: increase maximum label stack depth

* Bump MPLS_MAX_LABELS from 2 to 16;
* Adjust the static_nh_label structure and the mpls_label2str() function;
* On OpenBSD, print an error message when trying to push more than one
  label at once (kernel limitation). While here, add support for MPLSv6
  FTNs in OpenBSD.

This is not the full package. We still can't pop multiple labels at once,
or do things like swap a label and push other ones. We'll address that
in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoospf6d: add `no` forms for interface commands
Quentin Young [Tue, 22 Aug 2017 16:29:53 +0000 (12:29 -0400)]
ospf6d: add `no` forms for interface commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agobgpd: 'show ip bgp regex' needs to be VRF aware
Daniel Walton [Tue, 22 Aug 2017 19:33:22 +0000 (19:33 +0000)]
bgpd: 'show ip bgp regex' needs to be VRF aware

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
6 years agobgpd: remove json option from 'sh ip bgp' commands that do not support it
Daniel Walton [Tue, 22 Aug 2017 19:11:31 +0000 (19:11 +0000)]
bgpd: remove json option from 'sh ip bgp' commands that do not support it

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
6 years agobgpd: Memory wasting in zebra by non used MPLS FECs
Daniel Walton [Tue, 22 Aug 2017 18:14:50 +0000 (18:14 +0000)]
bgpd: Memory wasting in zebra by non used MPLS FECs

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
6 years ago*: update git-reindent-branch.py
David Lamparter [Tue, 22 Aug 2017 16:49:23 +0000 (18:49 +0200)]
*: update git-reindent-branch.py

- autodetect whether it's on master or stable/3.0
- grab .clang-format from master

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agoMerge pull request #1025 from qlyoung/no-ospf
David Lamparter [Tue, 22 Aug 2017 15:55:01 +0000 (17:55 +0200)]
Merge pull request #1025 from qlyoung/no-ospf

ospfd, ospf6d: cleanup some `no` commands

6 years agoMerge pull request #1023 from opensourcerouting/route-node-const
Donald Sharp [Tue, 22 Aug 2017 15:44:45 +0000 (11:44 -0400)]
Merge pull request #1023 from opensourcerouting/route-node-const

lib: fix const-check in route_node

6 years agoMerge pull request #1024 from opensourcerouting/minor_fixes
Quentin Young [Tue, 22 Aug 2017 15:21:02 +0000 (11:21 -0400)]
Merge pull request #1024 from opensourcerouting/minor_fixes

Minor fixes

6 years agoospfd, ospf6d: cleanup some `no` commands
Quentin Young [Tue, 22 Aug 2017 14:55:12 +0000 (10:55 -0400)]
ospfd, ospf6d: cleanup some `no` commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
6 years agoisisd: return proper error codes in some commands
Renato Westphal [Tue, 22 Aug 2017 14:18:10 +0000 (11:18 -0300)]
isisd: return proper error codes in some commands

CMD_ERR_AMBIGUOUS should only be used internally by the CLI.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra: redistribute srcdest routes to the client daemons
Renato Westphal [Tue, 22 Aug 2017 13:57:55 +0000 (10:57 -0300)]
zebra: redistribute srcdest routes to the client daemons

Somehow we missed these bits from the original srcdest patchset.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra: fix display of static routes pointing to nonexistent interfaces
Renato Westphal [Tue, 22 Aug 2017 13:52:07 +0000 (10:52 -0300)]
zebra: fix display of static routes pointing to nonexistent interfaces

Bug introduced a couple of weeks ago by myself. Only happens when the
route has an IP nexthop + a nexthop interface.

Example:
debian(config)# ip route 10.0.1.0/24 172.16.1.10 fake1
debian(config)# do sh run
Building configuration...
[snip]
!
ip route 10.0.1.0/24 172.16.1.10 unknown
!
end

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: fix const-check in route_node
David Lamparter [Tue, 22 Aug 2017 13:27:08 +0000 (15:27 +0200)]
lib: fix const-check in route_node

route_node->lock is "const" if --enable-dev-build is used.  This is done
to deter people from messing with internals of the route_table...
unfortunately, the inline'd route_[un]lock_node runs into this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
6 years agoMerge pull request #939 from jbonor/optimization
Lou Berger [Tue, 22 Aug 2017 13:01:20 +0000 (09:01 -0400)]
Merge pull request #939 from jbonor/optimization

Optimization

6 years agoMerge pull request #1012 from donaldsharp/eigrp_send_version
David Lamparter [Tue, 22 Aug 2017 12:59:22 +0000 (14:59 +0200)]
Merge pull request #1012 from donaldsharp/eigrp_send_version

eigrpd: Setup eigrp to send FRR version

6 years agoMerge pull request #1016 from opensourcerouting/cli-minor
Donald Sharp [Tue, 22 Aug 2017 12:54:18 +0000 (08:54 -0400)]
Merge pull request #1016 from opensourcerouting/cli-minor

minor cli foo (hashtable stats, pseudowire show)

6 years agoMerge pull request #1021 from opensourcerouting/privs-terminate
Lou Berger [Mon, 21 Aug 2017 20:55:33 +0000 (16:55 -0400)]
Merge pull request #1021 from opensourcerouting/privs-terminate

zprivs terminate