Commit Graph

761 Commits

Author SHA1 Message Date
Vincent JARDIN
3981b5c7f3 ospf6d: fix clang warning, NULL() calls
Avoid show() methods from being a NULL function when it is called.
Meanwhile, I did const'ify the handlers so only its debug field can be changed.

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-10-08 23:06:57 +02:00
Chirag Shah
dd2395e1c6 ospf6d: fix ospf6d crash during sigterm/shutdown
During signterm (shutdown) ospf6_clean calls route_remove
for brouter_table, during route_remove brouter_table remove
hook function is invoked which in turns calls router_remove
is any of the LSA has max age or cost is infinity,
which leads to stack corruption trying to delete same
route node.
Similar to 'no router ospf6' or 'no area ..' command
where lsdb is cleanedup then brouter route table
clean up is called.

Clean some of route trace to have route related fields.

Ticket:CM-17932

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-06 10:01:46 -07:00
Renato Westphal
8034beff9f *: use argv[]->text instead of argv[]->arg when appropriate
Incomplete commands like "debug ospf6 route mem" were being ignored. The
changes in ripd and ripngd are intended to make the code easier to read,
no bugs were fixed in these two daemons.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-05 22:54:42 -03:00
Donald Sharp
affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **.  This is to allow the list pointer to be nulled.

I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.

Let's make the api explicit in it setting the list pointer
to null.

Cynical Prediction:  This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:13 -04:00
Chirag Shah
6f7af48c12 ospf6d: add debug ospf6 route memory to config
vty config write to display 'debug ospf6 route memory'.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-04 14:35:54 -07:00
Quentin Young
33fb59c328 ospf6d: fix heap use after free
During the loop we save a pointer to the next route in the table in case
brouter is deleted during the course of the loop iteration. However when
we call ospf6_route_remove this can trigger ospf6_route_remove on other
routes in the table, one of which could be pointed at by said pointer.
Since ospf6_route_next locks the route that it returns, it won't
actually be deleted, instead the refcount will go to 1. In the next loop
iteration, nbrouter becomes brouter, and calling ospf6_route_next on
this one will finally decrement the refcount to 0, resulting in a free,
which causes subsequent reads on brouter to be UAF. Since the route will
have OSPF6_ROUTE_WAS_REMOVED set, provided the memory was not
overwritten before we got there, we'll continue on to the next one so it
is unlikely this will cause a crash in production.

Solution implemented is to check if we've deleted the route and continue
if so.

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

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-21 11:21:09 -03:00
Chirag Shah
27ae9bcd9d ospf6d: OSPFv3 interface bandwidth handling
if bandwidth is not set from Zebra  use speed as
   bandwidth for ospfv3 route cost.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-09-18 15:59:38 -07:00
Donald Sharp
2026b8afac ospf6d: Fix the cli parsing
We were not properly positioning get_argv command.

Fixes: #1182
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-14 16:03:37 -04:00
Donald Sharp
ab0f1135b5 ospf6d: Note when we calculated spf
Fixes: #1181
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-14 16:03:26 -04:00
Donald Sharp
e017797b3b ospf6d: Fix crash in prefix-list handling
Commit 427f8e61bb introduced prefix list callbacks
to handle when a prefix list is changed.  Unfortunately
if you have ospf6 running but not configured it crashes.

Modify ospf6d to not crash when we are not properly configured
yet for prefix-lists handling.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-13 09:46:28 -04:00
Renato Westphal
b3c18264e4 Merge pull request #1079 from qlyoung/fix-style-a
*: fix style
2017-08-31 13:22:55 -03:00
Jafar Al-Gharaibeh
959768e8d0 Merge pull request #1044 from donaldsharp/combination
Coverity Cleanup of Stuff
2017-08-31 10:25:55 -05:00
Quentin Young
60466a63f2
*: fix style
Fixes style nits introduced by recent pull requests.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-30 11:27:11 -04:00
Donald Sharp
32592ffb4f Merge pull request #1056 from opensourcerouting/oldbits-0
"pathspace" options, vtysh-suid-cleanups, "vty_frame()"
2017-08-29 17:48:36 -04:00
David Lamparter
ff6bda17b5 ospf6d: fix prefix list name SEGV
Oops, I tested this with prefix lists configured and failed to notice it
blows up when nothing is set...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 21:08:55 +02:00
Donald Sharp
ee4958897b Merge pull request #1060 from opensourcerouting/oldbits-2
zebra: clean up blackhole support
2017-08-29 09:07:19 -04:00
David Lamparter
a8b828f3c3 *: remove empty "interface XYZ" config blocks
Using the previously-added vty_frame() support, this gets rid of all the
pointless empty "interface XYZ" blocks that get added for any interface
that shows up in the system (e.g. dummys, tunnels, etc.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 08:36:03 +02:00
Quentin Young
5d1a2ee87b
ospf6d, ospfd: add no ospf6 router-id ...
* Deprecate `router-id A.B.C.D` for ospf6d
* Add `ospf6 router-id A.B.C.D`
* Add `no ospf6 router-id [A.B.C.D]`
* Add deprecation notices for previously deprecated ospf commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-28 13:50:21 -04:00
David Lamparter
09a484dd1d *: remove ZEBRA_FLAG_{BLACKHOLE,REJECT} from API
FLAG_BLACKHOLE is used for different things in different places. remove
it from the zclient API, instead indicate blackholes as proper nexthops
inside the message.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28 01:21:43 +02:00
Donald Sharp
9ca25fedba *: Add RMAP_COMPILE_SUCCESS to enum
Add the RMAP_COMPILE_SUCCESS and switch over to using it.
Refactoring allows a removal of a if statement to just
use the switch statement already in place.  Additionally
the reworking cleans up memory freeing in a couple of spots.
In one spot we no longer will leak memory too.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-25 10:48:30 -04:00
Renato Westphal
0af35d90a1 *: fix assorted issues detected by Coverity Scan
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-24 21:49:39 -03:00
Donald Sharp
27c5d4de93 Merge pull request #1031 from opensourcerouting/small-bits
small bits
2017-08-24 08:58:46 -04:00
Donald Sharp
cbe6eca6a6 Merge pull request #1022 from opensourcerouting/zapi_consolidation
Zapi consolidation
2017-08-24 06:03:55 -04:00
Renato Westphal
b30f3b91d4 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>
2017-08-23 20:25:45 -03:00
Renato Westphal
744899219f *: use zapi_route to send/receive redistributed routes as well
Some differences compared to the old API:
* Now the redistributed routes are sent using address-family
  independent messages (ZEBRA_REDISTRIBUTE_ROUTE_ADD and
  ZEBRA_REDISTRIBUTE_ROUTE_DEL). This allows us to unify the ipv4/ipv6
  zclient callbacks in the client daemons and thus remove a lot of
  duplicate code;

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

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 20:25:45 -03:00
David Lamparter
bd59f16782 Merge pull request #1026 from qlyoung/no-ospf6
ospf6d: add `no` forms for interface commands
2017-08-24 00:24:57 +02:00
David Lamparter
427f8e61bb 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>
2017-08-24 00:18:53 +02:00
Renato Westphal
5afa1c6be2 ospf6d: use the new API to send routes to zebra
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 18:58:35 -03:00
Renato Westphal
34b054ba6d *: remove leftovers from "router zebra"
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Renato Westphal
d00061ea32 *: reduce excessive indentation in a few places
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23 17:45:17 -03:00
Quentin Young
d23d6de866
ospf6d: add no forms for interface commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-22 16:07:30 -04:00
David Lamparter
1d84515ca9 Merge pull request #1025 from qlyoung/no-ospf
ospfd, ospf6d: cleanup some `no` commands
2017-08-22 17:55:01 +02:00
Quentin Young
3257307337
ospfd, ospf6d: cleanup some no commands
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-22 10:55:12 -04:00
David Lamparter
add57540ba Merge pull request #1009 from donaldsharp/show_cmds
Show cmds
2017-08-21 14:30:41 +02:00
Donald Sharp
63b02a77ca Merge pull request #929 from opensourcerouting/hooks-doc-irdp
hook improvements, more hooks, doc example, IRDP cleanup
2017-08-21 07:47:17 -04:00
Donald Sharp
87f6dc504d *: Add 'show debugging' command from vtysh
Allow vtysh to query every daemon about its
debugging status in one go.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-21 07:23:59 -04:00
Donald Sharp
3b4e6bd594 ospf6d: Remove ospf6d version string
This version string has not been updated in over 11 years.
I cannot see any viable reason that we should use or update
or anything with this value, remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-19 21:21:00 -04:00
David Lamparter
0395137477 *: centralize some exit cleanup into libfrr
Start creating a counterpart to frr_init and frr_late_init.
Unfortunately, some daemons don't do any exit handling, this doesn't
change that just yet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-15 13:25:44 +02:00
Donald Sharp
fc73dd4bdf Merge pull request #911 from opensourcerouting/non-recursive-2
more non-recursive build, fix cross-compile, & doc build mangling
2017-08-09 14:38:07 -04:00
ßingen
c811f101e7 ospf6: Fix DEBUG compiling error
struct ospf6_lsa doesn't have next nor prev, so it was raising a
compiling error if DEBUG is set.

Signed-off-by: ßingen <bingen@voltanet.io>
2017-08-09 12:07:34 +02:00
David Lamparter
afca06902e build: non-recursive ospf*
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-04 11:09:50 +02:00
David Lamparter
f28762d235 Merge pull request #870 from chiragshah6/mdev
Fix various memory leaks in OSPFd and OSPF6d
2017-08-04 08:46:38 +02:00
Chirag Shah
dfac5d3960 ospf6d: adjust changes per PR 870 review
called list_delete instead of list_free
Moved MTYPE_STATIC in ospfd/zebra.c
Revert changes in ospf6_zebra.c where malloc is called for
multiple nexthops.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-07-31 14:34:06 -07:00
Donald Sharp
68bfcc0539 ospf6d: New version of GCC with new warnings
GCC 7.1.1 returned warnings about buffer sizes
not being big enough to handle the full string
that could be generated.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-27 18:19:31 -04:00
Chirag Shah
d107621dbc ospf6d: Fix memory leaks
Free route node upon asbr redistribute route cleanup from
external_id_table route tale.
Free route node when route_remove is called and
node->info is set to null.
Decrement route node lock in route_lookup api as it
is incremented as part of node_lookup api.
use local variable for nexthop vs. malloc in zebra parse
routine.

two of the memory leaks related to nexthops per route were not freed.
two of the memory leak detected per frr service restart

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-07-27 09:49:42 -07:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
Daniel Walton
62d86b87fc ospf6d: crash in ospf6_lsdb_show
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2017-07-18 13:19:47 +00:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
e553b498f1 Merge pull request #820 from opensourcerouting/gcc7
fix new warnings emitted by GCC 7
2017-07-14 12:54:40 -04:00
David Lamparter
22106bbf68 Merge remote-tracking branch 'frr/master' into table-hash-ospf6-lsdb-refactor
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 17:30:56 +02:00
David Lamparter
20a6c6f31f *: fix GCC 7 warnings/issues
The label initializer & nhrpd variable are just to shut up GCC 7,
the other two are actual bugs.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 16:59:44 +02:00
David Lamparter
acd738fc7f *: fix GCC 7 switch/case fallthrough warnings
Need a comment on these.

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

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
David Lamparter
625e016d14 *: remove VTYNL, part 6 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
cdda201036 *: remove VTYNL, part 5 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
55f70b671f *: remove VTYNL, part 4 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
26a429fe8e *: remove VTYNL, part 2 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
6b18e3b2e0 ospf6d: VNL -> VTYNL
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.
2017-07-13 19:56:08 +00:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
David Lamparter
83eba583d7 lib: move \n vs. \r\n handling into vty code
Instead of having an ?: expression embedded in every single caller of
vty_out, just expand \n to \r\n in the vty code if neccessary.

(Deprecation warnings will be enabled in the next commits which will do
the search-and-replace over the codebase.)

[This reverts commit 4d5f445 "lib: add vty_outln()"]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:20 +02:00
David Lamparter
98f65ee0b1 ospf6d: rewrite ospf6_lsdb_lookup_next()
Again, replace open-coded table searches with API usage.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-11 15:05:39 +02:00
David Lamparter
954306f70c ospf6d: rewrite LSDB iteration
rip out this pile of open-coded goo and replace it with uses of the API
that table.h provides.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-11 15:05:39 +02:00
David Lamparter
49dd8e3758 ospf6d: use macro for LSDB walks
... to make it easier to refactor all of the iteration uses.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-11 13:48:20 +02:00
David Lamparter
4cb260c33e lib: add some abstraction guards for table code
route_node->parent and route_node->link shouldn't be touched by user
code since that is a recipe for trouble once we have a hash table in
parallel.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-11 13:47:31 +02:00
Quentin Young
7111c1a0cd
*: fix excess docstring
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-05 15:33:00 -04:00
Donald Sharp
e49b20cecc ospf6d: Fix zclient cleanup on shutdown
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-30 10:33:30 -04:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Russ White
0bc44f61c9 Merge pull request #754 from qlyoung/fix-argv-arg
use argv->text where appropriate
2017-06-29 11:06:15 -04:00
Jafar Al-Gharaibeh
0eef52fd95 Merge pull request #759 from qlyoung/remove-vty-argparsers
*: remove VTY_GET_*
2017-06-29 09:36:06 -05:00
Don Slice
c4efd33d36 ospf6d: add buffer length check to ifmtu changes
Previous fix was missing the possibility of having to modify the io
buffer size if the kernel reports an new mtu value.  This fix adds
that check.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2017-06-28 08:37:32 -04:00
Quentin Young
facfee22f5 *: remove VTY_GET_*
CLI validates input tokens, so there's no need to do it in handler
functions anymore.

spatch follows
----------------

@getull@
expression v;
expression str;
@@
<...
- VTY_GET_ULL(..., v, str)
+ v = strtoull (str, NULL, 10)
...>

@getul@
expression v;
expression str;
@@
<...
- VTY_GET_ULONG(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getintrange@
expression name;
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER_RANGE(name, v, str, ...)
+ v = strtoul (str, NULL, 10)
...>

@getint@
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getv4@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_ADDRESS(..., v, str)
+ inet_aton (str, &v)
...>

@getv4pfx@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_PREFIX(..., v, str)
+ str2prefix_ipv4 (str, &v)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 19:04:41 +00:00
Quentin Young
7e045c3d42 *: use ->text and strmatch where appropriate
Still need to go fix all the places where we do a 1-char strncmp...

spatch follows
------------------

@asdf@
expression idx;
@@
<...
 strcmp (
- argv[idx]->arg,
+ argv[idx]->text,
  ...)
...>

@depends on asdf@
expression idx;
@@
<...
- !strcmp (argv[idx]->text,
+ strmatch (argv[idx]->text,
           ...)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) == 0
+ strmatch (argv[idx]->text, arg)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) != 0
+ !strmatch (argv[idx]->text, arg)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 17:46:42 +00:00
Don Slice
0c7ef48afe ospf6d: fix ifmtu settings when kernel changes values
Problem reported by customer that if an mtu value was set in the kernel,
quagga/frr would get very confused about what had been configured and
what had been learned.  This caused peers to not be successfully established.
Resolved by keeping a configuration value separate than the operational value
and set the operational accordingly.  If configured, it wins unless the config
defines a value that is higher than the kernel supports.

Ticket: CM-16876
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed By: CCR-6399
Testing Done: Manual testing successful, submitter tested, ospf-smoke completed
with no new failures.
2017-06-26 11:07:23 -04:00
Quentin Young
56b4067930 *: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b

The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-21 15:22:21 +00:00
David Lamparter
645bb0b10e Merge branch 'stable/3.0'
Dropped:
	redhat/README.rpm_build.md
	redhat/daemons
	redhat/frr.init
	redhat/frr.logrotate
	redhat/frr.spec.in

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-13 17:37:58 +02:00
Quentin Young
7de6a87b55 ospf6d: fix heap uaf
Fix #667

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-06 17:54:31 +00:00
David Lamparter
326452238a Merge branch 'stable/3.0'
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-06 17:37:41 +02:00
Quentin Young
cb63fd542a ospf6d: fix filter-list commands
incorrect indexes resulted in use of area id as the name of the prefix
list

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-04 19:05:14 +00:00
Quentin Young
dc207b2760 ospf6d: default to dotted quad instead of ret NULL
to fix coverity warning

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-25 04:09:52 +00:00
Donald Sharp
9e962de4b6 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-24 11:22:35 -04:00
David Lamparter
db64fac494 Merge pull request #582 from qlyoung/ospf6-df-areaid
ospf6d: remember format for ospf6 area id
2017-05-22 17:45:29 +02:00
Quentin Young
8f599166fb ospf6d: fix use-after-free
ospf6_route_remove may free the ospf6_route passed to it if the refcount
reaches zero, in which case zeroing the ->flag field constitutes a uaf

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-22 02:14:29 +00:00
Quentin Young
79c3f4f491 ospf6d: remember format for ospf6 area id
If the user enters a decimal, display a decimal.
If the user enters a dotted quad, display a dotted quad.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-19 16:51:23 +00:00
Donald Sharp
eefe02daa1 ospf6d: Make 'show zebra' 'show ipv6 ospf6 zebra'
The 'show zebra' command really shouldn't be owned
by ospf6.  This command is a specialized command
to show some basic information about ospf6 and zebra
so limit it to ospf6.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-18 13:14:14 -04:00
David Lamparter
57463530f3 Merge branch 'stable/3.0'
Conflicts:
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/interface.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:28:12 +02:00
Quentin Young
32f464d891 ospf6d: fix decimal area ID cli
Not all numbers are dotted quads

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-18 04:39:05 +00:00
David Lamparter
bac7b7b935 Merge pull request #537 from donaldsharp/vrf_stuff
Vrf stuff
2017-05-17 22:06:39 +02:00
Donald Sharp
934ec54171 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-17 08:51:25 -04:00
Donald Sharp
8801b8b0d0 ospf6d: Fix debug line always showing up in ospf6d
The command 'debug ospf6 lsa unknown' was
always showing up, upon starting of the ospf6 daemon.

Remove this from happening.  Also fix some help strings
while we are in there.

Ticket: CM-7913
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-17 08:48:46 -04:00
Donald Sharp
a6e895a9df Merge remote-tracking branch 'origin/stable/2.0' 2017-05-17 08:32:53 -04:00
Donald Sharp
5b0747d71d ospf6d: Allow unconfig of unknown lsa's
When we are receiving the 'no debug ospf6 lsa unknown ...'
Allow the removal of the originate examine and flooding
keywords.

Ticket: CM-12805
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 15:24:30 -04:00
Donald Sharp
2dbfa8a020 ospf6d: Fix debug line always showing up in ospf6d
The command 'debug ospf6 lsa unknown' was
always showing up, upon starting of the ospf6 daemon.

Remove this from happening.  Also fix some help strings
while we are in there.

Ticket: CM-7913
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 15:22:21 -04:00
Donald Sharp
439aa9fa39 ospf6d: Fix 'no area .. range...' command
The cli uplift had confused some parameters.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 08:28:58 -04:00
Donald Sharp
6df8536487 *: Consolidate vrf_hooks into vrf_init
We only needed to add/change the vrf callbacks when we initialize
the vrf subsystem.  As such it is not necessary to handle the callbacks
in any other way than through the init function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15 19:31:27 -04:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

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

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Quentin Young
d9090d56c0 ospf6d, zebra: remove unnecessary asserts
These pointers are now guaranteed to be null, so asserting the opposite
will crash.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:23 +00:00
Quentin Young
66e78ae64b *: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See
previous commit message.

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

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

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

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

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

to the form

  thread_add_* (..., &t)

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:19 +00:00
Donald Sharp
e1a1b2edde ospf6d: Allow some route-map commands to work
The generic callbacks need to be enabled in order
for some route-map commands to properly work.

I've tried to match up to what is programmed to work
within ospfv3.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-03 14:39:21 -04:00
Donald Sharp
09b3c32838 ospf6d: Fix redistribution debug knowledge
When redistributing into ospfv3 specify that the
route is add or delete correctly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-03 14:33:28 -04:00
Donald Sharp
30a24af092 ospf6d: Fix parse_type_spec
The function parse_type_spec was always looking in argv[0] of
for figuring out the type of the command.  Since the type location
could change, use the passed in idx_lsa.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-28 10:55:45 -04:00
Donald Sharp
373886aba9 ospf6d: Fix some issues with 'show ipv6 ospf6 data..'
1) linkstate-id was made optional in one case
2) The ipv4 address was being looked at in the wrong spot

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-28 10:55:45 -04:00
Renato Westphal
34288970c4 ospf6d: fix "no router ospf6"
The "no router ospf6" command wasn't working.

Regression introduced by commit 16cedbb.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-22 17:51:14 -03:00
Donald Sharp
b5024aa7ab Merge pull request #332 from opensourcerouting/snmp-fix
fix SNMP build
2017-04-04 16:39:56 -04:00
David Lamparter
ffc37fa151 Merge pull request #330 from dwalton76/ospf-no-log-adjacency-changes-detail
ospfd: "no log-adjacency-changes detail" disables log-adjacency-changes
2017-04-04 21:45:14 +02:00
David Lamparter
a263892613 build: fix CFLAGS for snmp modules
The SNMP modules include <net-snmp/net-snmp-config.h>, which won't be
found in off-searchpath directories without SNMP_CFLAGS.  Unfortunately
in my tests the files were on the search path even without the flags.

(SNMP_LIBS is not needed because only libfrrsnmp calls into net-snmp
functions.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 21:25:19 +02:00
Daniel Walton
7994b01d26 ospfd: "no log-adjacency-changes detail" disables log-adjacency-changes
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-04 18:13:43 +00:00
David Lamparter
422f8d0ca9 Merge branch 'master' 2017-04-04 20:04:07 +02:00
David Lamparter
3e7c8d040c Merge branch 'stable/2.0'
Fixed minor conflicts from "defaults" change on stable.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-04-04 19:01:47 +02:00
Donald Sharp
b3cfe637a6 Merge pull request #294 from opensourcerouting/modules
Loadable module support
2017-04-04 11:55:00 -04:00
Quentin Young
eaa1ae0db4 ospfd, ospf6d: fix distance commands
OSPF distance commands were broken in a variety of ways. Fix 'em.

* `distance ospf` and `distance ospf6` were accepted commands
* Inconsistent doc strings
* Make use of {keyword|tokens}
* Add ability to reset specific distance without specifying a value
  Ex: ~# no distance ospf6 intra

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-04-03 20:17:12 +00:00
David Lamparter
505e50567f *: apply DEFUN_NOSH for node-switch CLI commands
These have copies in vtysh that do the node-switch locally and are
listed in extract.pl's ignore list.  The ignore list however is
redundant since DEFUN_NOSH does the same thing...

ldpd is a bit hacky, but Renato is reworking this anyway.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-28 15:48:07 -04:00
David Lamparter
8efe88eacf *: track version & "defaults" in configs
[CF]: Move default name to autoconf and update tests

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2017-03-28 19:18:42 +02:00
David Lamparter
5986b66b82 *: snmp: convert into modules
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:36 +01:00
David Lamparter
3012671ffa *: use hooks for sending SNMP traps
This means there are no ties into the SNMP code anymore other than the
init call at startup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:36 +01:00
David Lamparter
46081234b4 build: split off libfrrsnmp
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-25 08:52:36 +01:00
Donald Sharp
baaea325e6 *: Refactor ifindex2ifname to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:43:21 -04:00
Donald Sharp
92a57eb206 *: Refactor if_get_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:38 -04:00
Donald Sharp
1306c09a1b *: Refactor if_lookup_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:23 -04:00
Donald Sharp
a90607a4ba lib, ospf6d: Refactor if_lookup_prefix
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:33:16 -04:00
Donald Sharp
7e2b760345 *: Remove non-vrf based ifindex lookup
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:26:53 -04:00
David Lamparter
dd8376febd lib: remove remaining struct zlog * args
These don't serve any purpose either.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
bf1013e6c4 lib: simplify protocol/log naming
The protocols enum serves no purpose other than adding potential for
bugs and making it complicated to add a new protocol... nuke.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:40 +01:00
David Lamparter
16077f2fc5 *: add frr_run()
Contains the fetch-and-run-thread logic, and vty startup (which is the
last thing happening before entering the main loop).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:39 +01:00
David Lamparter
eb05883f3e *: add frr_config_fork()
Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr.

This also makes multi-instance pid/config handling available as part of
the library.  It's only wired up in ospfd, but the code is in lib/.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-08 00:15:36 +01:00
David Lamparter
857b544649 *: centralize more into frr_init()
Move CLI/VTY/Memory accounting init into frr_*

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:33 +01:00
David Lamparter
4f04a76b71 *: add frr_init() infrastructure
Start centralising startup & option parsing into the library.

FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g.
for killing the ZLOG_* enum, and having the daemon name available)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-07 23:07:20 +01:00
Donald Sharp
b95e5c8c69 ospf6d: Fix write beyond data structure
Converting a 'struct prefix6' to a 'struct prefix'
and then doing a memcpy of the contents writes
beyond the end of the data structure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-01 08:40:46 -05:00
David Lamparter
dab8cd005f *: fix ambiguous commands
Some "show [ip] bgp ipv4 encap ..." commands remaining ambiguous.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-10 16:57:20 +01:00
Donald Sharp
7df2e1c379 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-07 13:20:12 -05:00
Donald Sharp
285a775ac7 ospf6d: Fix compile warnings
These compile issues were found by running ./buildtest.sh
on a fedora 25 box.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 08:29:56 -05:00
Donald Sharp
55c7280315 *: Convert libzebra -> libfrr
The library libzebra that is installed with FRR will
conflict with Quagga.  So let's rename it to libfrr.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 08:29:13 -05:00
Donald Sharp
1a35e2e565 Merge remote-tracking branch 'origin/stable/2.0' 2017-02-02 10:42:51 -05:00
David Lamparter
ff1c42fb9f *: fix warning fallout from set_socket_path
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-01 13:12:16 +01:00
Christian Franke
e322dbc73a Merge branch 'master' into feature/zebra-srcdest 2017-01-31 16:22:54 +01:00
Christian Franke
81a164e2d9 *: read and ignore srcdest routes on ZAPI
Since zebra might be sending srcdest routes down to the various daemons,
they need to understand the presence of the field at the very least.
Sadly, that's also the best we can do at this point since none of the
protocols has support for handling srcdest routes.  The only consistent
thing to do is to ignore them throughout.

If an administrator wants to have the srcdest route as non-srcdest in a
protocol, setting a non-srcdest static route (possibly blackhole) is
probably the best way to go.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30 13:47:04 +01:00
David Lamparter
d75f3b00e7 lib: send ZAPI IPv6 source prefix
This introduces ZAPI_MESSAGE_SRCPFX, and if set adds a source prefix
field to ZAPI IPv6 route messages sent from daemons to zebra.  The
function calls all have a new prefix_ipv6 * argument specifying the
source, or NULL.  All daemons currently supply NULL.

Zebra support for processing the field was added in the previous patch,
however, zebra does not do anything useful with the value yet.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30 13:47:04 +01:00
Donald Sharp
0df668666e ospf6d: Fix Ambiguous Commands
Ospf6d has ambiguous commands due to duplicated
functions that belong in lib/routemap.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-29 19:19:27 -05:00
Donald Sharp
40d1cbfbb3 *: Fix redistribute issue
Somewhere in the past we switched from
using the auto-generated redistribute statements
to a non-generated version.  This caused us to
loose new protocols to redistribute as they are
added.  Put it back.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-27 15:52:12 -05:00
Martin Winter
a766b038f5 ospf6d: Add vty_socket cli option to override the compiled-in location for the VTY Socket
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2017-01-26 00:41:32 +07:00
David Lamparter
cf672a8654 *: use monotime()
This is largely a bulk-replace made with coccinelle.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
afe4c21720 *: remove quagga_gettime() return value checks
The next patch will bulk-replace these, and monotime() has time_t as
return value, not an error indicator.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
6ced0e7f10 lib: time: remove recent_relative_time()
Replace with monotime() [which is not cached].

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
95ac0ac5ff ospf6d: time: remove unused/duplicate helpers
timersub() & timerclear() are in sys/time.h;
timerstring_local() is unused.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
b6f1faf045 Merge branch 'stable/2.0-for-merge'
Conflicts (CLI vs. atol()):
- bgpd/bgp_vty.c
- ospfd/ospf_vty.c
- zebra/zebra_vty.c

NB: pull req #65 (LabNConsulting/working/2.0/afi-safi-vty/c) was
excluded from this merge.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-13 15:24:25 +01:00
Donald Sharp
d504ec224a Merge remote-tracking branch 'origin/develop' 2017-01-11 08:25:17 -05:00
Quentin Young
b84aadae44 Merge branch 'master' into fix-proto_redistnum 2017-01-06 19:44:46 -05:00
Donald Sharp
6847b9bfb9 Merge pull request #39 from opensourcerouting/renato-assorted-fixes
Renato's assorted patches
2017-01-06 14:00:29 -05:00
Donald Sharp
3b14d86eed Merge remote-tracking branch 'origin/stable/2.0' 2017-01-06 09:58:21 -05:00
Renato Westphal
6bfae35e5c ospf6d: fix broken indentation in "show ipv6 ospf6 neighbor"
In the State/IfState column, we were reserving only 6 characters to
print the state of each neighbor, but this is not enough for cases like
"Loading" (7 characters) and "ExChange" (8 characters). Increase the
width of this field to 8 to fix the broken indendation.

ospf6d's output before this patch:
ubuntu# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime  State/IfState         Duration I/F[State]
2.2.2.2           1    00:00:35 ExChange/DR              00:01:15 rt1-eth0[BDR]
3.3.3.3           1    00:00:35 Loading/DR              00:01:15 rt1-eth1[BDR]
4.4.4.4           1    00:00:35   Full/DR              00:01:15 rt1-eth2[BDR]
5.5.5.5           1    00:00:35   None/DR              00:01:10 rt1-eth3[BDR]
6.6.6.6           1    00:00:35   Down/DR              00:01:15 rt1-eth4[BDR]
7.7.7.7           1    00:00:35 Attempt/DR              00:01:15 rt1-eth5[BDR]
8.8.8.8           1    00:00:35   Init/DR              00:01:10 rt1-eth6[BDR]
9.9.9.9           1    00:00:35 Twoway/DR              00:01:14 rt1-eth7[BDR]
10.10.10.10       1    00:00:35 ExStart/DR              00:01:10 rt1-eth8[BDR]

ospf6d's output with this patch:
ubuntu# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
2.2.2.2           1    00:00:36 ExChange/DR              00:00:44 rt1-eth0[BDR]
3.3.3.3           1    00:00:36  Loading/DR              00:00:39 rt1-eth1[BDR]
4.4.4.4           1    00:00:35     Full/DR              00:00:39 rt1-eth2[BDR]
5.5.5.5           1    00:00:36     None/DR              00:00:44 rt1-eth3[BDR]
6.6.6.6           1    00:00:36     Down/DR              00:00:39 rt1-eth4[BDR]
7.7.7.7           1    00:00:36  Attempt/DR              00:00:39 rt1-eth5[BDR]
8.8.8.8           1    00:00:36     Init/DR              00:00:39 rt1-eth6[BDR]
9.9.9.9           1    00:00:35   Twoway/DR              00:00:40 rt1-eth7[BDR]
10.10.10.10       1    00:00:36  ExStart/DR              00:00:39 rt1-eth8[BDR]

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-01-03 22:03:28 -02:00
Don Slice
54c8d91e5d ospf6d: resolve problem with area range lsid creation
The problem reported was that routers downstream from the ABR would have
prefixes in the IPv6 rib that should have been summarized.  Testing showed
that the prefixes were absent in the lsdb but not removed from the rib.

The problem (and others) stemmed from determining the link-state id to use
for the area-range statement only from other entries in the range-table. Since
the area range statement creates inter-prefix LSAs (summaries) which are in all
aspects identical to other inter-prefix LSAs, the number space for the lsid
needs to be unique across all inter-prefix LSAs, not just unique between area
range statements.  This fix removes the use of range-table specific lsids and
acquires the lsid just as any other inter-prefix LSA.

Ticket: CM-13626
Signed-off-by: Don Slice
Reviewed By: CCR-5489
Testing Done: Manual testing, repeated runs of the test that previously failed,
ospf-smoke
2017-01-03 15:14:56 -05:00
David Lamparter
ab0181eed3 build: rename (2 of ?): route_types macros
All of the autogenerated macros in lib/route_types.pl are now called
FRR_* instead of QUAGGA_*.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 18:34:29 +01:00
David Lamparter
b2f361571b build: rename (1 of ?): configure.ac + preproc
This replaces Quagga -> FRR in most configure.ac settings as well as
a handful of preprocessor macros in the source code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-20 17:57:47 +01:00
Quentin Young
6d681bd874 all: use ->text when parsing protocol argument
and match on full protocol name in proto_redistnum()

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-12-16 05:39:44 +00:00
David Lamparter
5304ba7e56 *: kill useless if(...) after VTY_DECLVAR_CONTEXT
VTY_DECLVAR_CONTEXT already contains a NULL check, vty warning message
and return statement.  These are not needed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:50:01 +01:00
David Lamparter
cdc2d76507 *: coccinelle-replace vty->index
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
David Lamparter
ae19c24047 ospfd, ospf6d: add qobj registrations
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-09 17:36:25 +01:00
David Lamparter
d5bd3e0a6f Merge branch 'stable/2.0'
Conflicts:
	bgpd/rfapi/bgp_rfapi_cfg.c
	bgpd/rfapi/vnc_debug.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-08 13:21:21 +01:00
Renato Westphal
6228a3b874 *: always set SO_SNDBUF and SO_RCVBUF using a best effort approach
If we fail to set any socket's buffer size, try again with a smaller value
and keep going until it succeeds. This is better than just giving up or,
even worse, abort the creation of a socket (ospf6d and ripd).

Fix broken ospf6d on FreeBSD.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-08 12:50:25 +01:00
Quentin Young
6fd800be4a Merge remote-tracking branch 'osr/master' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	lib/command_match.c
2016-12-06 19:51:33 +00:00
David Lamparter
d7d73ffc8f *: fix up DEFUNs without install_element calls
These now generate warnings which will break the build with -Werror.

Note this may have enabled commands that should be disabled, or the
other way around...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05 20:28:24 +01:00
Quentin Young
0b11464604 Merge remote-tracking branch 'osr_private_quagga/queue/osr/vtysh-generic' into vtysh-grammar 2016-12-02 19:02:06 +00:00
David Lamparter
0b84f29490 *: make DEFUN installations file-local
This moves all install_element calls into the file where the DEFUNs are
located.  This fixes several small related bugs:

- ospf6d wasn't installing a "no interface FOO" command
- zebra had a useless copy of "interface FOO"
- pimd's copy of "interface FOO" was not setting qobj_index, which means
  "description LINE" commands would fail with an error

The next commit will do the actual act of making "foo_cmd" static.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 17:25:56 +01:00
Quentin Young
3a2d747c2e all: Fix all underfull doc strings
Additionally:
* Add [ip] to a couple bgp show commands
* Quick refactor of a couple ISIS commands
* Quick refactor of a couple OSPF6 commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-29 23:07:11 +00:00
David Lamparter
ddae30158d *: add #include "command.h" where needed
Headers using struct cmd_token should directly include command.h so the
struct is actually defined.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-29 14:15:05 +01:00
David Lamparter
28c2525098 Merge commit '34d5ef459140ee7e'
(some build fixups for vtysh-grammar)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 18:10:21 +01:00
David Lamparter
82992fed8c Merge branch 'vtysh-grammar'
Conflicts:
	isisd/isisd.c
	lib/Makefile.am
	lib/thread.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-28 17:56:29 +01:00
David Lamparter
34d5ef4591 vtysh: fix some macro breakage
vtysh's extract.pl script doesn't cope with install_element(var, ) where
"var" is not one of the FOO_NODE constants.  Also, the future defun_lex
tool doesn't deal well with preprocessor expansions in the same regard.

This tries simplifying out some of these.  lib/distribute.c needs
further thinking.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-23 08:32:30 +01:00
Quentin Young
98cfd06b41 lib, ospf6d: Change SECONDS_STR to be more generic
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-17 20:39:41 +00:00
Quentin Young
99a522c71b ospfd, ospf6d: Clean up and unify doc strings
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-17 20:19:27 +00:00
David Lamparter
24f5e2fc62 build: massively remove needless checks
Since we have autoconf results from a wide swath of target platforms, we
can go remove checks that have the same result on all systems.

This also removes several "fallback" implementations of functions that,
at some point in the history, weren't available on all target platforms.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-15 14:23:17 +09:00
Quentin Young
d7fa34c1bc all: Fix underfull doc strings, part 2
Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-08 01:46:04 +00:00
Quentin Young
16cedbb01f all: Fix underfull doc strings, part 1
Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-04 23:03:03 +00:00
Quentin Young
39e92c066f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_encap.c
	bgpd/bgp_route.c
	lib/command.c
	lib/command.h
	ospf6d/ospf6d.c
	vtysh/vtysh.c
2016-10-21 19:27:49 +00:00
Christian Franke
e531bbe2f0 ospf6d: fix off-by-one on display of spf reasons
The loop should only iterate to array_size - 1.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-20 20:28:26 -04:00
Quentin Young
0a538fc98f Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	isisd/isis_routemap.c
	zebra/rt_netlink.c
2016-10-20 16:31:49 +00:00
Maitane Zotes
baff583e8b ospf6d: implement admin distance
Until today the admin distance cannot be configured for any IPv6
routing protocol. This patch implements it for ospf6.

Signed-off-by: Maitane Zotes <maz@open.ch>
Signed-off-by: Roman Hoog Antink <rha@open.ch>
2016-10-19 22:28:45 -04:00
Paul Jakma
e95c4d17a7 *: Fix duplicate commands from view/enable node consolidation 2016-10-19 22:28:45 -04:00
Donald Sharp
b2575bc05b *: Consolidate routemap initialization
Consolidate the routemap initialization into one
function.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-10-19 10:55:59 -04:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Renato Westphal
6fbde29daf ospf6d: fix a few vty help strings
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-10-13 00:59:24 +00:00
Renato Westphal
b2d4d0393a *: rename all instances of OSPFv6 to OSPF6 or OSPFv3
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-10-13 00:59:19 +00:00
Donald Sharp
0b1442e37b *: Consolidate all double VIEW_NODE and ENABLE_NODE's
If a command is put into the VIEW_NODE, it is going into the
ENABLE_NODE as well.  This is especially true for show commands.
As such if a command is in both consolidate it down to VIEW_NODE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-07 21:05:06 -04:00
Christian Franke
464015fa32 ospf6d: add support for route tags
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-10-07 21:05:05 -04:00
Daniel Walton
82f97584fb all: removed all DEFUN command stomps
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-06 19:56:13 +00:00
Quentin Young
ccb8e0c7fb ospfd, ospf6d, ripd: Fix miscellaneous syntax errors
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-10-04 01:13:44 +00:00
Daniel Walton
6de69f8305 all: added some missing <>s within []s
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 15:31:48 +00:00
Daniel Walton
8749a04cc2 ospf6d: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 13:39:56 +00:00
Daniel Walton
093d7a3a34 ospf6d: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 13:38:08 +00:00
Daniel Walton
14b16482c4 ospf6d: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 05:09:42 +00:00
Daniel Walton
4e626c014a ospf6d: clean up command string in CHECK ME comments
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 02:48:58 +00:00
Daniel Walton
1d68dbfe66 ospf6d: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-30 01:27:05 +00:00
Daniel Walton
67656e9b65 all: added CHECK ME for DEFUNs that look at argc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 17:48:57 +00:00
Daniel Walton
9ccf14f739 Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 14:10:48 +00:00
Daniel Walton
92300491f6 zebra: CHECK ME fixes
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 03:00:04 +00:00
Daniel Walton
51c2641415 ospf6d: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:56:31 +00:00
Christian Franke
0fc452dc57 Make route flags a 32bit field
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-23 12:12:43 -04:00
Paul Jakma
d91788284e lib: Check prefix length from zebra is sensible
* zclient.c: prefix length on router-id and interface address add
  messages not sanity checked.  fix.

* */*_zebra.c: Prefix length on zebra route read was not checked, and
  clients use it to write to storage.  An evil zebra could overflow
  client structures by sending overly long prefixlen.

Prompted by discussions with:

Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-23 12:12:17 -04:00
David Lamparter
bb4ac22a1f ospf6d: fix fallout from ifindex_t change
Only one of these variables is in fact an interface index...
(this fixes -Werror build.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-09-23 12:12:16 -04:00
Donald Sharp
b99c382167 Revert "Make route flags a 32bit field"
This reverts commit 85eda2c985.
2016-09-23 12:11:21 -04:00
Christian Franke
85eda2c985 Make route flags a 32bit field
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-23 09:51:43 -04:00
Daniel Walton
6147e2c694 convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:47:20 +00:00
Renato Westphal
a4b46f4c16 *: remove dead code
Since recently zebra uses only the ZEBRA_REDISTRIBUTE_* messages
to advertise redistributed routes to its clientes. Now the old
ZEBRA_IPV*_ROUTE_* messages are only used for client->zebra communication.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23 09:31:24 -04:00
Daniel Walton
f412b39a33 ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebra
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 03:55:26 +00:00
Daniel Walton
cc9de1ba25 ospf6d: argv update
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 00:45:56 +00:00
David Lamparter
4a1ab8e405 *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.

The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-19 16:31:04 -04:00
David Lamparter
fc7948fafe lib: migrate to new memory-type handling
Move over to the new allocation counting added in the previous commit.

(This commit is mostly mechanical.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
2016-09-19 18:35:50 +02:00
Daniel Walton
51f2d198c2 quagga-reload.py fails for "net add debug ospf6 lsa as-ext"
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-12773

- change "as-ext" to "as-external"
- drop "grp-mbr" option, it does not have a handler
- drop "type7" option, it does not have a handler
2016-09-08 13:16:25 +00:00
Donald Sharp
810a8dfc93 Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-08-19 12:18:35 -04:00
Paul Jakma
b892f1ddfe *: use an ifindex_t type, defined in lib/if.h, for ifindex values
(cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
2016-08-18 07:35:38 -04:00
Sid Khot
c05795b16b Fix for CM-12450 Ensure quagga logs at startup are sent to syslog (until log configuration is processed)
Ticket: CM-12450
Reviewed By: CCR-5112
Testing Done: Manual
2016-08-17 19:36:54 -07:00
Renato Westphal
288b91e0bd ospf6d: fix sendmsg on OpenBSD
When sending ancillary data on OpenBSD, we need to tell the compiler
that the ancillary data buffer should be aligned on the stack to the
minimum alignment of the first ancillary data object that will be sent.

Additionally, HAVE_SIN6_SCOPE_ID is not defined anywhere, check for
HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-07 21:05:26 -04:00
David Lamparter
1c6f50bf2d *: snmp: add a load of "static" specifiers
Make it easier to see which bits in *_snmp.c are actually referenced
from non-SNMP parts of the code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-28 07:27:47 -04:00
David Lamparter
d11f748b30 *: fixup snmp support
- HAVE_POLL is overloaded by net-snmp
- missing includes
- ospf6_snmp converted to vrf_iflist()

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-07-24 03:47:03 -04:00
Donald Sharp
275382273b Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-07-12 20:24:00 -04:00
Don Slice
2caa9b3957 all: add default log file if none are defined
Added a default log file named /var/log/quagga/Quagga.log to every daemon
to capture log entries if no log file is defined.  This also allows the
capture of logged information prior to reading each daemon's config file.
If a log file is defined manually, it will override this default file name.

Ticket: CM-10987
Signed-off-by: Don Slice
Reviewed By: Donald Sharp
Testing Done: Manual testing
2016-07-11 12:57:24 -07:00
Don Slice
3f6d6a5db8 zebra/ospf/ospf6: Fix several memory leaks on if up/down
Resolved several memory leaks caused by ifdown/ifup the vrf device or
a swp port.  For bgp/zebra/ospf/ospf6, bouncing the vrf device would cause
a linked list, Interface, and route-table to get leaked.  For ospf6,
bouncing the swp device also caused leaks of Connected and Prefix entries.

Ticket: CM-10841
Signed-off-by: Don Slice
Reviewed-By: Donald Sharp
Testing Done: Manual testing, bgp and ospf mins passed, smokes had fewer failures than base
2016-06-28 04:52:38 -07:00
radhika
2376c3f225 bfd: Fix for missing BFD client regs/deregs from quagga clients
Ticket: CM-11256
Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>
Testing: Unit, PTM smoke, OSPF smoke, BGP Smoke

Issue:
BFD client registrations are not being sent to PTM from BGP/OSPF clients when the quagga clients have no BFD configuration. This can create stale BFD sessions in PTM when BFD is removed from quagga configuration before quagga is restarted.

BFD client de-registrations from BGP/OSPF also go missing sometimes when quagga is restarted. This also will cause stale BFD sessions in PTM.

Root Cause:
BFD client registrations were being sent at the time of BGP/OSPF daemon initialization. But, they were being sent to zebra before the socket connection between zebra and BGP/OSPF was established. This causes the missing BFD client registrations.

BFD client de-registrations are sent from zebra when zebra detects socket close for BGP/OSPF daemons. Based on the timing, the de-registrations may happen after socket between PTM and zebra is closed. This will result in missing de-registrations.

Fix:
Moved sending of BFD client registration messages to zebra connected callback to make sure that they are sent after the BGP/OSPF daemons connect with zebra.

Added BFD client de-registrations for BGP/OSPF to be also sent when zebra daemon gets restart signal. They are sent from the signal handler only if it was not already handled in zebra client socket close callback.
2016-06-21 03:39:58 -07:00
Don Slice
70bd3c4369 ospfd/ospf6d/zebra: Change interface bandwidth range and auto-cost range to 100G
Prior to this change, interface bandwidth could not be defined above 10G. With
the use of higher speed interfaces, the ability to effectively define the path
links was highly impacted. Additionally, the default auto-cost reference-bandwidth
for ospf and ospfv3 was set to 100M, which relects a much earlier time.  Changed both
the range of interface bandwidth definitions and reference bandwidths to be up to
100G.  Set the default interface bandwidth (if not defined) to 10G to make the ratio
continue to cause a cost of 10 as before.  Manual testing as well as ospf-min and
ospf-smoke passed successfully.

Ticket: CM-10756
Signed-of-by: Don Slice
Reviewed-by: Donald Sharp
2016-06-13 09:06:45 -04:00
Feng Lu
322e59645d ospf6d, bgpd: avoid calling if_nametoindex
As the comments in if.h, it is better to call ifname2ifindex()
instead of if_nametoindex().

And ifname2ifindex() can work for VRF by appending a parameter
while if_nametoindex() can not.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 395828eea809e8b2b8c5824d3639cefedd7aa9f0)
2016-06-09 09:25:49 -04:00
David Lamparter
81382410ed ospf6d: use existing union, avoid strict-aliasing
There are preexisting fields u.lp.id and u.lp.adv_router in struct
prefix that do the same thing as these type-punning pointer derefs.
Use these and shut up the strict-aliasing warnings.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 0de0138a9146074f268245193e45c9376d998722)
2016-06-08 12:52:19 -04:00
David Lamparter
1cc5e6822b *: add missing includes
Some places, particularly headers, were spewing warnings since they
don't include neccessary other headers to get struct/enum definitions.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 388f8857eb81ef75014060976776523a58a99389)
2016-06-07 08:50:09 -04:00
David Lamparter
6c4f4e6e6a *: use void * for printing pointers
On higher warning levels, compilers expect %p printf arguments to be
void *.  Since format string / argument warnings can be useful
otherwise, let's get rid of this noise by sprinkling casts to void *
over printf calls.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-29 21:27:26 -04:00
David Lamparter
8f2c16aab0 *: use long long to print time_t
Since we can't assume time_t to be long, int, or even long long, this
consistently uses %lld/long long (or %llu/unsigned long long in a few
cases) to print time_t/susecond_t values.  This should fix a bunch of
warnings, on NetBSD in particular.

(Unfortunately, there seems to be no "PRId64" style printing macro for
time_t...)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit ef008d2f8dc8f7160d8a3d24a15f2fad79ef3242)
2016-05-29 21:08:04 -04:00
Donald Sharp
b06fd12526 Quagga: Fix code to use srandom/random
Quagga was using a mix of srand/rand and srandom/random.
Consolidate to use srandom/random which are the POSIX
versions of random number generators

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-05-29 20:24:55 -04:00
David Lamparter
9e8da292d1 build: get rid of INCLUDES, use AM_CPPFLAGS
INCLUDES in configure.ac was not used at all, and INCLUDES in
Makefile.am is supposed to be AM_CPPFLAGS these days.

Reduces warnings spewed during bootstrap/autoreconf.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Greg Troxel <gdt@ir.bbn.com>
Acked-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Paul Jakma <paul@jakma.org>
(cherry picked from commit 237aac56960575f6ad2451ba2796d94bd5ae4b33)
2016-06-03 15:46:59 -04:00
David Lamparter
1cbb5dfc29 build: remove INRIA, NRL and MUSICA IPv6 quirks
Valar dohaeris.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Acked-by: Greg Troxel <gdt@ir.bbn.com>
Acked-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Paul Jakma <paul@jakma.org>
2016-06-03 14:40:03 -04:00
Paul Jakma
1f9a9fffc1 Fix most compiler warnings in default GCC build.
Fix lots of warnings. Some const and type-pun breaks strict-aliasing
warnings left but much reduced.

* bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to
  (struct fifo), so just use that.  Makes it clearer the beginning of
  (struct bgp_advertise) is compatible with with (struct fifo), which seems
  to be enough for gcc.
  Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up
  type-punning breaks strict aliasing warnings.
* bgp_packet.c: Use BGP_ADV_FIFO_HEAD.
  (bgp_route_refresh_receive) fix an interesting logic error in
  (!ok || (ret != BLAH)) where ret is only well-defined if ok.
* bgp_vty.c: Peer commands should use bgp_vty_return to set their return.
* jhash.{c,h}: Can take const on * args without adding issues & fix warnings.
* libospf.h: LSA sequence numbers use the unsigned range of values, and
  constants need to be set to unsigned, or it causes warnings in ospf6d.
* md5.h: signedness of caddr_t is implementation specific, change to an
  explicit (uint_8 *), fix sign/unsigned comparison warnings.
* vty.c: (vty_log_fixed) const on level is well-intentioned, but not going
  to fly given iov_base.
* workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always
  true for address of static variable.  Correct but pointless warning in
  this case, but use a 2nd pointer to shut it up.
* ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2
  different 32 bit IDs into in (struct ospf6_route), and the resulting
  type-pun strict-alias breakage warnings this causes.  Need to use 2
  different fields to fix that warning?

general:

* remove unused variables, other than a few cases where they serve a
  sufficiently useful documentary purpose (e.g.  for code that needs
  fixing), or they're required dummies.  In those cases, try mark them as
  unused.
* Remove dead code that can't be reached.
* Quite a few 'no ...' forms of vty commands take arguments, but do not
  check the argument matches the command being negated.  E.g., should
  'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set?
  Or should it be required that the distance match the previously configured
  distance for the prefix?
  Ultimately, probably better to be strict about this.  However, changing
  from slack to strict might expose problems in command aliases and tools.
* Fix uninitialised use of variables.
* Fix sign/unsigned comparison warnings by making signedness of types consistent.
* Mark functions as static where their use is restricted to the same compilation
  unit.
* Add required headers
* Move constants defined in headers into code.
* remove dead, unused functions that have no debug purpose.

(cherry picked from commit 7aa9dcef80b2ce50ecaa77653d87c8b84e009c49)

Conflicts:
	bgpd/bgp_advertise.h
	bgpd/bgp_mplsvpn.c
	bgpd/bgp_nexthop.c
	bgpd/bgp_packet.c
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	lib/command.c
	lib/if.c
	lib/jhash.c
	lib/workqueue.c
	ospf6d/ospf6_lsa.c
	ospf6d/ospf6_neighbor.h
	ospf6d/ospf6_spf.c
	ospf6d/ospf6_top.c
	ospfd/ospf_api.c
	zebra/router-id.c
	zebra/rt_netlink.c
	zebra/rt_netlink.h
2016-05-26 18:57:39 +00:00
David Lamparter
d8adbe0983 ospf6d: fix uninitialized warning in SNMP
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit a4065069e6bdd0bc7475312530b0e9457f818e0d)
2016-05-26 15:33:32 +00:00
David Lamparter
7e6350359a snmp: fix warnings
batch-fix all warnings that come up when enabling AgentX SNMP support.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit dfee58f1d41a2e36c7f5f38a3ef5712224131824)
2016-05-26 15:33:29 +00:00
Yasuhiro Ohara
52cf4a5181 Bug in ospf6_lsa_compare()
This fix is probably correct on 32bit systems,
but i think it will not work on 64bit systems.
sizeof(signed long) would be 8 and therefore the
cast from u_int32_t will map all the values to
non-negative part of long int.

You would like to use int (like in ospfd) and
change the type of seqnuma, seqnumb to that.

The type int32_t would be even more proper, but
sizeof(int) is 4 on relevant platforms.

Signed-off: Ondrej Zajicek <santiago@crfreenet.org>
Acked-by: Feng Lu <lu.feng@6wind.com>
Acked-by: Yasuhiro Ohara <yasu@jaist.ac.jp>
(cherry picked from commit bdd8cd70a042473477f9144c9cedb8dde11ba2c1)
2016-05-26 01:14:44 +00:00
Paul Jakma
f58c5fbdc3 ospf6_lsdb: trivial, make it clear that showfunc is set before deref.
(cherry picked from commit 7bef33cbf5027189bd55e4890a07a6bef8277f93)
2016-05-26 01:08:36 +00:00
Paul Jakma
95bb83054b build: Remove the old PIC/PIE patch, let libtool sort it out
* Remove the old change from '08 to add in PIE arguments at automake level.
  Versions of libtool since then know how to deal with -fpie and do the right
  thing according to whether its building shared or executable objects.
  So just pass '-fpie' as CFLAG and let libtool do its thing.
2016-05-25 20:38:35 -04:00
David Lamparter
6b629fe36b *: assorted warning fixes
A few warnings slipped through the cracks...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-05-25 20:38:32 -04:00
Donald Sharp
79c5d9f333 ospf6d: Fix printf % code usage
Use correct % code in printf statement.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-05-19 10:42:12 -04:00
radhika
567b877d7f zebra - BFD client de-registration support
CM-10680
Issue: When BGP daemon is stopped, all the BGP BFD sessions are not getting deleted from PTM.
Root cause: BGP daemon stop causes BFD de-register message to be sent for every peer on which BFD is enabled. But, all the de-register messages from bgpd to zebra are not processed before the socket close. This results in some stale BGP BFD sessions.
Fix: Support for client de-register message has been added in PTM/BFD.  Changes in Quagga to support BFD client de-registrations:
−   The BFD clients de-registration is sent directly from zebra daemon when zebra client (bgpd, ospfd and ospf6d) socket close is detected.
−   Introduced a BFD flag for the zebra clients to prevent BFD de-registration messages from being sent to zebra daemon when the client is shutting down. This reduces the BFD messaging.

CM-10540
Issue: Invalid ptm status “fail” instead of “n/a” being displayed for VRF interfaces.
Root cause: ptm status is not being initialized to “unknown” status when VRF interface is added or changed. The uninitialized value is ‘0’ which is the value for “fail”
Fix: Initialized the ptm status to the correct value.

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Kanna Rajagopal <kanna@cumulusnetworks.com>

Ticket: CM-10680, CM-10540
Reviewed By: CCR-4653
Testing Done: PTM smoke, BGP smoke and ptmd_test.py:TestMultipleAddrsIntfOspfBgp
2016-05-08 20:11:18 -07:00
Donald Sharp
651415bd61 quagga: Fixup startup to allow consistency between sysV and systemd
We want the ability to start up quagga in a varied set of
environments.  This needs to be done in SysV and systemd
startups.  As such refactor the code to allow us to
allow end users to easily switch between the two

sysV:
edit the /etc/quagga/daemons file
service quagga [start|stop|reload|restart]

Systemd:
edit the /etc/quagga/daemons file
systemctl [start|stop|reload|restart] quagga

Ticket: CM-10634
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-04-27 16:04:48 -04:00
Donald Sharp
b2d7c082a2 quagga: Remove iflist global variable
The file if.c has a iflist that had the list of interfaces
in the default vrf.  Remove this variable and replace
with a vrf_iflist lookup on the default vrf where it
was used.

Additionally, modify ptm code to iterate over all vrf's
when enabling ptm.

Ticket: CM-10338
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
2016-04-08 13:15:59 -04:00
Donald Sharp
1e22a2af50 bgpd, lib, ospfd, ospf6d: Fix bfd interface lookup
bfd was receiving a callback with an interface name string
but was ignoring the passed in vrf to find the ifp pointer.
This commit fixes that code path in bfd.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
2016-03-24 06:03:02 -07:00
Don Slice
84361d615d quagga: delete interface from default table when moved to vrf
All daemons changed to flag an interface that has been moved to a vrf as DELETED instead of INTERNAL.
When they were flagged as IFINDEX_INTERNAL, ospf, rip, and isis would re-install them in the default
assuming that they were being "pre-defined" before the kernel definitions.

Ticket: CM-9265
Signed-off-by: Don Slice
Reviewed-by: Donald Sharp
2016-03-18 19:53:15 +00:00
Donald Sharp
419b65eed2 ospf6d: Stop sending hello's out loopback interface
Currently if you have this setup:

router ospf6
interface lo area 0.0.0.0

Ospf is scheduling and sending hello's out the loopback interface:
2016/03/18 15:26:12.463248 OSPF6: Could not send entire message
2016/03/18 15:26:22.463475 OSPF6: sendmsg failed: ifindex: 1: Network is unreachhable (101)

Adding a check to not schedule hello's for a loopback interface resolves this issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-03-18 12:40:12 -04:00
radhika
055c4dfcde Support for multi-client and client reg msg
Ticket: CM-7615, CM-7773
Reviewed By: CCR-3610, CCR-3708
Testing Done: Unit, BGP Smoke and OSPF Smoke

Changes (70790261926b17200c8c9377c4576cd3b486fcef) ported from 2.5

Issue (related to CM-7615): 1. CM-7615: There is mismatch in the client name between ptm display of client BFD sessions and the zebra logs. For example, if bgpd added BFD session, zebra logs will show the client as “bgp” but the ptm display will show it as “quagga”
2. Bigger problem is when 2 clients (for example OSPF and BGP) from Quagga register for same BFD session and only one client de-registers the BFD session. This results in BFD session deletion from PTM even though other client still has the BFD registration.

Root Cause: Even though BGP, OSPF and OSPF6 are 3 different clients from Quagga that are trying to register/deregister BFD sessions with PTM, all 3 are represented as one client “quagga” from zebra. This makes it hard for PTM/BFD to distinguish between all three when BFD peer registration/deregistration happens from the clients.

Fix: Send the actual client name bgp, ospf or ospf6 from zebra with BFD reg/dereg messages instead of one unified client name “quagga”

CM-7773: BFD sessions are not getting cleaned from PTM even though no BGP peering exists in Quagga.

Root Cause: PTM cleans up stale BFD sessions from a client when it finds a change in seq id advertised by the client. But, if PTM never detects a change in the seq id then the stale BFD sessions never get cleaned up. The test restarts the quagga without saving the configuration, which results in no BGP peering. No BGP peers are registered with PTM after restart and PTM does not detect a client seq id change resulting in stale BFD sessions.

Fix: New client registration message was added in PTM. Every client that is interested in BFD monitoring will register with PTM with the client seq id. Client will register with a different seq id (typically pid) every time it restarts. This will help in detecting the change in seq id and cleanup of stale BFD sessions for a client.

Code Changes: To support the new client registration message following changes have been made
  - Added support for client registration messaging in zebra for sending messages to PTM.
  - Added support for client registration messaging between zebra and clients (BGP, OSPF and OSPF6) in BFD library.
  - Expanded the reg/de reg peer messaging between zebra and clients to support client specific seq id to distinguish between multiple clients registering for BFD peer rather than one “quagga” client.
  - Changes in bgpd, ospfd and ospf6d to send client registrations at the time of daemon initialization and on receiving BFD peer replay message.
2016-03-08 23:31:32 -08:00
vivek
988bf1fe69 OSPFv3: Check area before scheduling SPF
Check on area that interface points to before scheduling SPF.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-7911, CM-8934
Reviewed By: CCR-4256
Testing Done: Verification by Anitha
2016-03-07 23:49:45 +00:00
Donald Sharp
a807d96e7c ospf6d: Fix for crash when non area 0 network entered first
When a user specifies a non area 0 network in an ospf6d
config the daemon could crash.

Ticket: CM-9134
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-02-23 18:47:55 -05:00
Donald Sharp
87bb7354d8 ospf6d: Ensure that ospf6d is actually running before handling default routes
If a default route is passed into ospf6d then we need to make
sure that ospf6d is actually running before we accept and process it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-02-18 10:25:09 -05:00
vivek
0e5223e7a0 Quagga: Support VRF unregister for clients
Clients (BGP, OSPF etc.) register with Zebra for information about
a VRF such as Router ID, interfaces and redistribution. Add API to
support unregister also which is required for the non-default VRF.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-9128
Reviewed By: CCR-4098
Testing Done: Manual testing
2016-02-12 11:37:33 -08:00
Donald Sharp
66dd6fdbdd *: Modify protocols to have systemd integration
Modify the daemons to integrate with systemd, if it is enabled via configure,
and to notify systemd that they are running/stopping and to send watch
notifications.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-02-10 15:07:05 -05:00
Donald Sharp
385f703b16 ospf6d: Fix double increment of Sequence Number
When OSPF6 is creating the header for the ROUTER LSA type
if the packet being sent has interface information to add
to the data, the Sequence Number is at least double incremented.

This change moves the header creation to outside the loop over
all interfaces in the area.  Additionally the header is created
at the bottom of the function now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-01-18 16:27:45 -08:00
Donald Sharp
cbdee2350a Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2015-11-27 08:58:52 -08:00
Donald Sharp
4690c7d74c Quagga: prefix2str fixup
During CR for nexthop upstream it was noticed that usage
of prefix2str was not consistent.  This fixes this problem

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-23 13:31:11 -08:00
Daniel Walton
813d4307f9 Should be able to "no" the full text of any config line
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-5816
2015-11-23 18:05:03 +00:00
Donald Sharp
1a1f4efab3 Quagga: vrf_id not being set correctly
Several routing protocols use the zapi_ipv[4|6] api to talk to
zebra.  There are some instances where the api.vrf_id was not
being set.  Since the practice is to declare the api structure
on the stack, the data inside is not being set to 0.  As
such random vrf_id values were being passed to zebrad
causing rage and confusion.

Ticket: CM-8287
Reviewed-by: CCR-3841
Testing:  Test suites no longer crashing and burning

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-20 11:36:46 -08:00
Vipin Kumar
c4a24efd88 Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2015-11-03 22:05:02 -08:00
Feng Lu
7076bb2f52 *: add VRF ID in the API message header
The API messages are used by zebra to exchange the interfaces, addresses,
routes and router-id information with its clients. To distinguish which
VRF the information belongs to, a new field "VRF ID" is added in the
message header. And hence the message version is increased to 3.

* The new field "VRF ID" in the message header:

    Length    (2 bytes)
    Marker    (1 byte)
    Version   (1 byte)
    VRF ID    (2 bytes, newly added)
    Command   (2 bytes)

  - Client side:

    - zclient_create_header() adds the VRF ID in the message header.
    - zclient_read() extracts and validates the VRF ID from the header,
      and passes the VRF ID to the callback functions registered to
      the API messages.
    - All relative functions are appended with a new parameter "vrf_id",
      including all the callback functions.
    - "vrf_id" is also added to "struct zapi_ipv4" and "struct zapi_ipv6".
      Clients need to correctly set the VRF ID when using the API
      functions zapi_ipv4_route() and zapi_ipv6_route().
    - Till now all messages sent from a client have the default VRF ID
      "0" in the header.
    - The HELLO message is special, which is used as the heart-beat of
      a client, and has no relation with VRF. The VRF ID in the HELLO
      message header will always be 0 and ignored by zebra.

  - Zebra side:

    - zserv_create_header() adds the VRF ID in the message header.
    - zebra_client_read() extracts and validates the VRF ID from the
      header, and passes the VRF ID to the functions which process
      the received messages.
    - All relative functions are appended with a new parameter "vrf_id".

* Suppress the messages in a VRF which a client does not care:

  Some clients may not care about the information in the VRF X, and
  zebra should not send the messages in the VRF X to those clients.

  Extra flags are used to indicate which VRF is registered by a client,
  and a new message ZEBRA_VRF_UNREGISTER is introduced to let a client
  can unregister a VRF when it does not need any information in that
  VRF.

  A client sends any message other than ZEBRA_VRF_UNREGISTER in a VRF
  will automatically register to that VRF.

  - lib/vrf:

    A new utility "VRF bit-map" is provided to manage the flags for
    VRFs, one bit per VRF ID.

    - Use vrf_bitmap_init()/vrf_bitmap_free() to initialize/free a
      bit-map;
    - Use vrf_bitmap_set()/vrf_bitmap_unset() to set/unset a flag
      in the given bit-map, corresponding to the given VRF ID;
    - Use vrf_bitmap_check() to test whether the flag, in the given
      bit-map and for the given VRF ID, is set.

  - Client side:

    - In "struct zclient", the following flags are changed from
      "u_char" to "vrf_bitmap_t":
          redist[ZEBRA_ROUTE_MAX]
          default_information
      These flags are extended for each VRF, and controlled by the
      clients themselves (or with the help of zclient_redistribute()
      and zclient_redistribute_default()).

  - Zebra side:

    - In "struct zserv", the following flags are changed from
      "u_char" to "vrf_bitmap_t":
          redist[ZEBRA_ROUTE_MAX]
          redist_default
          ifinfo
          ridinfo

      These flags are extended for each VRF, as the VRF registration
      flags. They are maintained on receiving a ZEBRA_XXX_ADD or
      ZEBRA_XXX_DELETE message.

      When sending an interface/address/route/router-id message in
      a VRF to a client, if the corresponding VRF registration flag
      is not set, this message will not be dropped by zebra.

    - A new function zread_vrf_unregister() is introduced to process
      the new command ZEBRA_VRF_UNREGISTER. All the VRF registration
      flags are cleared for the requested VRF.

  Those clients, who support only the default VRF, will never receive
  a message in a non-default VRF, thanks to the filter in zebra.

* New callback for the event of successful connection to zebra:

  - zclient_start() is splitted, keeping only the code of connecting
    to zebra.

  - Now zclient_init()=>zclient_connect()=>zclient_start() operations
    are purely dealing with the connection to zbera.

  - Once zebra is successfully connected, at the end of zclient_start(),
    a new callback is used to inform the client about connection.

  - Till now, in the callback of connect-to-zebra event, all clients
    send messages to zebra to request the router-id/interface/routes
    information in the default VRF.

    Of corse in future the client can do anything it wants in this
    callback. For example, it may send requests for both default VRF
    and some non-default VRFs.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>

Conflicts:
	lib/zclient.h
	lib/zebra.h
	zebra/zserv.c
	zebra/zserv.h

Conflicts:
	bgpd/bgp_nexthop.c
	bgpd/bgp_nht.c
	bgpd/bgp_zebra.c
	isisd/isis_zebra.c
	lib/zclient.c
	lib/zclient.h
	lib/zebra.h
	nhrpd/nhrp_interface.c
	nhrpd/nhrp_route.c
	nhrpd/nhrpd.h
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6_zebra.h
	ospfd/ospf_vty.c
	ospfd/ospf_zebra.c
	pimd/pim_zebra.c
	pimd/pim_zlookup.c
	ripd/rip_zebra.c
	ripngd/ripng_zebra.c
	zebra/redistribute.c
	zebra/rt_netlink.c
	zebra/zebra_rnh.c
	zebra/zebra_rnh.h
	zebra/zserv.c
	zebra/zserv.h
2015-11-03 22:04:36 -08:00
Daniel Walton
692c795432 Enable OSPF "log-adjacency-changes" by default
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7941
2015-11-03 10:48:30 -08:00
Daniel Walton
4dfd8affa2 Add "no debug ospf" and "no debug ospf6" commands to disable all ospf debugging
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-4010
2015-11-03 10:37:25 -08:00
Feng Lu
6a69b354a6 *: call if_init()/if_terminate() from vrf_init()/vrf_terminate()
Later, an interface will belong to a specific VRF, and the interface
initialization will be a part of the VRF initialization. So now call
if_init() from vrf_init(), and if_terminate() from vrf_terminate().

Daemons have the according changes:
- if if_init() was called or "iflist" was initialized, now call
  vrf_init() instead;
- if if_terminate() was called or "iflist" was destroyed, now call
  vrf_terminate() instead.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>

Conflicts:
	bgpd/bgp_main.c
	pimd/pim_iface.c
	pimd/pim_iface.h
	pimd/pim_main.c
	pimd/pimd.c
2015-10-29 17:00:32 -07:00
vivek
5048fe1444 Zebra: Make redistribute do replace instead of del/add for better convergence
Ticket: CM-6768
Reviewed By: CCR-3207
Testing Done: bgpsmoke, smoke, topo to create failure

Redistributing routes goes through a del/add cycle whenever a redistributed
is updated. This del/add cycle causes disruption by causing traffic loss
for brief/long periods of time(6-8 s in case of OSPF). The modifications in
this patch remove the del/add cycle to ensure that this disruption doesn't
happen.

Also fixed sending no forwarding address when announcing IPv4 routes with IPv6
nexthops, and sending nexthop only when there is a single path.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-10-20 21:38:38 -07:00
radhika
1eab5b17bc Fix for IPv6 OSPF BFD session staying down when ifdown/ifup on logical interfaces
Ticket: CM-7649
Reviewed By: Donald
Testing Done:

This is porting of the patch, ospf6d-bfd-fix-dereg-miss.patch from br2.5.

 Issue: The IPv6 OSPF BFD sessions stay down after ifdown/ifup on logical interfaces. This problem doesn’t exist for BFD sessions created by BGP and IPv4 OSPF.

 Root cause: When the interface is brought down the IPv6 neighbors discovered on that interface are deleted. This deletion happens without first bringing down the neighbor and the BFD deregistration happens only when the neighbor state changes. This leaves an orphaned BFD session in PTM. Also, the BFD session socket that is bound to the interface that was brought down loses connection. The socket has to be rebound to the interface when it comes up. This problem will not happen if the client deleted the sessions and re-adds it when interface goes down and come up. IPv4 OSPF and BGP work exactly like that.

 Fix: Added the BFD deregistration code to IPv6 OSPF neighbor delete.
2015-10-09 13:44:32 -07:00
Donald Sharp
4140ca4d15 lib: zclient.c remove extern struct thread_master *
zclient.c depended upon link time inclusion of a
extern struct thread_master *master.  This is a violation of the
namespace of the calling daemon.  If a library needs the pointer
pass it in and save it for future use.

This code change also makes the zclient code consistent with
the other lib functions that need to schedule work on your behalf

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-09-23 13:26:56 -07:00
vivek
1d37410425 OSPFv3: Do not display default network type.
Ticket: CM-3917
Reviewed By: CCR-3454
Testing Done: Manual verification
2015-09-08 11:25:57 -07:00
radhika
68fe91d6c7 Support of BFD status in Quagga
Ticket:CM-6802, CM-6952
Reviewed By: Donald, Kanna
Testing Done:

Double commit of b76943235e09472ec174edcf7204fc82d27fe966 from br2.5. But, manually resolved all the compilation errors. Also, modified the shows to support the json format which was not supported in br2.5.

CM-6802 – Currently, BFD session status can be monitored only through ptmctl. There is no way to check the BFD status of a peer/neighbor through Quagga. Debugging becomes easier if BFD status is shown in Quagga too. BFD status is relevant when it is shown against the BGP peer/OSPF neighbor. For, this following code changes have been done:
   - Only down messages from PTM were being propagated from Zebra daemon to clients (bgpd, ospfd and ospf6d). Now, both up and down messages are redistributed to the clients from zebra. BFD status field has been added to the messaging. Handling of BFD session up messages has been added to the client code. BGP/OSPF neighbor is brought down only if the old BFD session status is ‘Up’ to handle extra/initial down messages.
   - BFD status and last update timestamp fields have been added to the common BFD info structure. Also, common show functions for showing BFD information have been added to BFD lib.
   - Modified the BGP neighbor show functions to call common BFD lib functions.
   - For ospf and ospf6, BFD information was maintained only at interface level. To show BFD status per neighbor, BFD information has been added at neighbor level too. “show ip ospf interface”, “show ip ospf neighbor detail”, “show ipv6 ospf6 interface” and “show ipv6 ospf6 neighbor detail” output have been modified to show BFD information.

CM-6952 - IBGP peers were always assumed to be multi-hop since there was no easy way to determine whether an IBGP peer was single hop or multihop unlike EBGP. But, this is causing problem with IBGP link local peers since BFD doesn't allow multihop BFD session with link local IP addresses. Link local peers were discovered when the interface peering was enabled. Interface peering is always singlehop. So, added checks to treat all interface based peers as single hop irrespective of whether the peer is IBGP or EBGP.
2015-08-31 14:56:11 -07:00
Donald Sharp
b07c4cb33e arm compilation failures.
Ticket: Trivial
Reviewed by: Trivial
Testing: arm/powerpc/amd64 targets now build

Apparently we have a arm build.  Who knew?  This fixes the compile warnings/errors
produced when you compile a arm build with -Werror.
2015-07-29 16:02:26 -07:00
Donald Sharp
ee046671d3 Fixup compiler warnings for powerpc
The turn-on of -Werror was never run fully against powerpc.
there were some powerpc specific issues that turned up.
This commit fixes these issues.
2015-07-27 13:19:12 -07:00
Donald Sharp
aa9584c1cf Add --enable-werror to configure 2015-07-25 16:05:56 -07:00
Donald Sharp
88177fe3ed Fixup of warnings in the code
Ticket: None
Reviewed by: Trivial
Testing:

A bunch of warnings have crept in to the code base.  This
fixes the issue
2015-07-25 15:55:47 -07:00
Donald Sharp
7f342629a9 This patch changes ospfd from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering neighbors discovered on BFD enabled interfaces with PTM/BFD through zebra. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.
OSPF BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ip ospf bfd <detect mult> <min rx> <min tx>

This patch also adds BFD support for IPv6 OSPF. ospf6d  will dynamically register/deregister IPv6 neighbors with BFD for monitoring the connectivity of the neighbor. Neighbor is registered with BFD when 2-way adjacency is established and deregistered when adjacency goes down if the BFD is enabled on the interface through which the neighbor was discovered.

OSPF6 BFD command added to configure BFD and parameters (detect multiplier, min rx and min tx).
interface <if-name>
  ipv6 ospf6 bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-07-22 12:35:37 -07:00
Donald Sharp
ed2eb093c7 ospfd: ospfd-warnings.patch
Remove compile warnings for the ospfd/ospf6d directory
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:
2015-05-19 18:29:14 -07:00
Donald Sharp
b69278752c Command to adjust min-arrival value in Milliseconds.
timers lsa min-arrival <1-60000>

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:04:07 -07:00
Donald Sharp
3fd6abdd13 Adding the initialization check in ospfv3_clean()
This is to avoid a crash triggered by process termination
when ospf6d daemon is running and 'router ospf6' config has not been done yet.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 18:03:53 -07:00
Donald Sharp
0f23bb679b Fixing a couple of issues with ospf6_route_remove () routine.
When a route_node has multiple ospf6_routes under it (common subnet case),
then the current implementation has an issue in adjusting the route_node->info
on a ospf6_route_remove() call.

The main reason is that it ends up using exact match to determine if the next
ospf6_route belongs to the same route_node or not. Fixing that part to use
rnode (the existing back-pointer to the route_node) from the ospf6_route to
determine that.

Also fixing some of the walks to turn them safe so that the route deletion is
fine.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2015-05-19 18:03:53 -07:00
Donald Sharp
a1c55bf1dd LA (local-address) bit related inter-op fix.
As per the RFC, when the NU bit is set, prefix should be ignored.
However, the code is currently ignoring prefix with LA bit too.

Fixing that part.

In future, we should also set LA bit for the loopback addresses. Not doing this
part right away, as quagga wont be backward compatible with its own previous
releases. Maybe after a release or so, we should start setting LA bit too.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 18:03:51 -07:00
Donald Sharp
8bb0831e23 Per AFI redist registrations
The problem is that zclient->redist[ZEBRA_ROUTE_MAX] used for storing a
client’s redist state, has no address-family qualification. This means
a client can only store its interest in a protocol (connected, static etc.),
but cant choose IPv4 or ipv6 with that. This hindered implementation on
client sides to manage redistribution of ipv4 and ipv6 both.

BGP's redistribution of protocols like connected/static is one such place.

One fix could be to overload this and flap the redist connection each time
any new afi is added for redist, but that may have side-effects on the
existing afi redist.

The cleaner way is to modify redist data-structure to also take AFI, and adjust
routines that deal with it, so that a client can register for a protocol
redistribution based on the AFI. BGP already maintains redistribution state
based on afi and protocol (bgp->redist[AFI_MAX][ZEBRA_ROUTE_MAX]). This patch
takes care of filling up the gap in zclient/zserv redistribution state to
also use AFI qualification.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 18:03:45 -07:00
Donald Sharp
7c8ff89e93 Multi-Instance OSPF Summary
——————————————-------------

- etc/init.d/quagga is modified to support creating separate ospf daemon
  process for each instance. Each individual instance is monitored by
  watchquagga just like any protocol daemons.(requires initd-mi.patch).

- Vtysh is modified to able to connect to multiple daemons of the same
  protocol (supported for OSPF only for now).

- ospfd is modified to remember the Instance-ID that its invoked with. For
  the entire life of the process it caters to any command request that
  matches that instance-ID (unless its a non instance specific command).
  Routes/messages to zebra are tagged with instance-ID.

- zebra route/redistribute mechanisms are modified to work with
  [protocol type + instance-id]

- bgpd now has ability to have multiple instance specific redistribution
  for a protocol (OSPF only supported/tested for now).

- zlog ability to display instance-id besides the protocol/daemon name.

- Changes in other daemons are to because of the needed integration with
  some of the modified APIs/routines. (Didn’t prefer replicating too many
  separate instance specific APIs.)

- config/show/debug commands are modified to take instance-id argument
  as appropriate.

Guidelines to start using multi-instance ospf
---------------------------------------------

The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.

To enable multiple instances, do the following:

     1. service quagga stop
     2. Modify /etc/quagga/daemons to add instance-ids of each desired
        instance in the following format:
        ospfd=“yes"
        ospfd_instances="1,2,3"
	assuming you want to enable 3 instances with those instance ids.
     3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
        and ospfd-3.conf.
     4. service quagga start/restart
     5. Verify that the deamons are started as expected. You should see
        ospfd started with -n <instance-id> option.
     	ps –ef | grep quagga
     	With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
	ospfd-<instance-id>/vty to each instance.
     6. vtysh to work with instances as you would with any other deamons.
     7. Overall most quagga semantics are the same working with the instance
     	deamon, like it is for any other daemon.

NOTE:
     To safeguard against errors leading to too many processes getting invoked,
     a hard limit on number of instance-ids is in place, currently its 5.
     Allowed instance-id range is <1-65535>
     Once daemons are up, show running from vtysh should show the instance-id
     of  each daemon as 'router ospf <instance-id>’  (without needing explicit
     configuration)
     Instance-id can not be changed via vtysh, other router ospf configuration
     is allowed as before.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-19 18:03:42 -07:00
Donald Sharp
a231c1d588 OSPFv3 should accept long form of "no redistribute" 2015-05-19 18:03:41 -07:00
Donald Sharp
b52a8a52c1 ospf6d: ospfv3-show-cmds-instance-check-fix.patch
SYMPTOM:

If some of the ospfv3 commands like 'show ipv6 ospf6 route' are executed
with ospf6d daemon running but before having any ospfv3 configuration, then
ospf6d crash is seen.

ISSUE:

There are a few show commands, which are (unlike others) not checking if
ospf6 instance is initialized already.

FIX:

Add the missing checks, by using OSPF6_CMD_CHECK_RUNNING() in the commands
where its needed and not yet used.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
             Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-19 18:03:41 -07:00
Donald Sharp
a1b11f9bfa Support for 'clear ipv6 ospf6 interface [ifname] 2015-05-19 18:03:40 -07:00
Donald Sharp
552237cf20 This is a fix to make sure router-LSA is updated when neighbor's interface ID change
is received in hello packet.
2015-05-19 18:03:40 -07:00
Donald Sharp
8e370bfa14 ospf6d: ospfv3-setsocket-retry.patch
SYMPTOM:

With quagga running on Linux, 'ifdown <if-name>' followed by 'ifup <ifname>
can cause OSPFv3 to not receive Hello packets on the interface.

ISSUE:

Operating System's interface IPv6 readiness may not be guaranteed at the
time of interface-up event. Thats because the ipv6 components in an OS may
also be listening to the same interface-up event that (in this case) is
relayed to OSPFv3.

In this failure case, setsockopt with option IPV6_JOIN_GROUP on the interface
returned EINVAL.

Error logs -
OSPF6: Zebra Interface state change: swp1 index 3 flags 11043 metric 1 mtu 1500
OSPF6: Interface Event swp1: [InterfaceUp]
OSPF6: Network: setsockopt (20) on ifindex 3 failed: Invalid argument

FIX:

To take care of this possible race condition, any address-family related
setting should be retried. Given it's a rare condition and window of this
race should be short, the patch adds a limited retry mechanism for the
IPV6 membership setting on the socket.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
             Satish Ashok <sashok@cumulusnetworks.com>
2015-05-19 18:03:40 -07:00
Donald Sharp
ca1f4309e6 ospf6d: ospfv3-stub-area-support.patch
Support stubby and totally stubby areas in OSPFv3

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
2015-05-19 18:03:40 -07:00
Donald Sharp
c3c0ac8395 ospf6d: ospfv3-abr-ecmp-support.patch
OSPFv3: Add ABR support and make ECMP > 4.

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
2015-05-19 18:03:39 -07:00
Donald Sharp
60e42c52d6 Increase SO_SNDBUF and SO_RCVBUF to 8MB to avoid drops in large networks. 2015-05-19 18:03:39 -07:00
Donald Sharp
5e3edbf561 'set metric -12' is broken in the parser
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:47:22 -07:00
Donald Sharp
a0f72a9164 Fix "no set metric" for ospf6 and RIP
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:40:46 -07:00
David Lamparter
6b0655a251 *: nuke ^L (page feed)
Quagga sources have inherited a slew of Page Feed (^L, \xC) characters
from ancient history.  Among other things, these break patchwork's
XML-RPC API because \xC is not a valid character in XML documents.

Nuke them from high orbit.

Patches can be adapted simply by:
	sed -e 's%^L%%' -i filename.patch
(you can type page feeds in some environments with Ctrl-V Ctrl-L)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-06-04 06:58:02 +02:00
Christian Franke
cd40b329a2 lib/command.c: rewrite command matching/parsing
Add support for keyword commands.

Includes new documentation for DEFUN() in lib/command.h, for preexisting
features as well as new keyword specification.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-04-01 20:21:41 +02:00
Christian Franke
c78a46c27f ospf6d: fix refcounting in ospf6_asbr_lsa_remove
When iterating over a list, also the last node should be unlocked again.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-21 06:28:48 +01:00
Vincent Bernat
fd5006896f ospf6d: add "auto-cost reference-bandwidth" command
This command allows the user to change to default reference bandwidth
for cost calculations. The default value is 100 Mbps. With a default
bandwidth of 10 MBps, the default cost becomes 10. Those values are
consistent with OSPFv2.

[DL: resolved conflicts in vty command additions & docs]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-21 06:28:48 +01:00
Vincent Bernat
c19543b223 ospf6d: compute interface cost from its bandwidth
Previously, the interface cost was a fixed default value that a user
was allowed to change with "ipv6 ospf6 cost XX". As what is done with
OSPFv2, we change this behaviour to compute the default interface cost
from the interface bandwidth.

The user can still force a cost with "ipv6 ospf6 cost XX". He can get
the default value with "no ipv6 ospf6 cost". Moreover, the default
cost value was 1. The cost is now computed from the bandwidth and a
default reference bandwidth of 100 MBps (as for OSPFv2). Since the
default bandwidth for an interface is 10 MBps, the "default" cost
becomes 10 instead of 1.

[DL: resolved conflict in ospf6d/ospf6_interface.c]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-21 06:28:47 +01:00
Ingo Flaschberger
1db65fadf6 ospf6d: solve segfaults with ospf6d on FreeBSD
Do not send ospf6d hellos on fresh created interfaces without
configuration (ie. no vlan configured).  Ospf6d use ip6_mtu, if it's not
initalised, Ospf6d tries to alloc indefinite size of memory.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-21 06:28:23 +01:00
David Lamparter
e708ed69aa Merge volatile/cumulus_ospf6d
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-18 17:04:25 +01:00
David Lamparter
424cc3bd48 ospf6d: fix interface_down() stopping hellos
interface_down() - which also handles some nonobvious cases like the
last linklocal address disappearing - was previously not cancelling the
hello timer.  This had the effect of multiple such threads ending up
scheduled after a quick down-up cycle.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-18 08:45:29 +01:00
David Lamparter
11b4f01355 ospf6d: clear lsa->refresh before clearing LSAs
This fixes a SEGV when we receive a higher-SeqNum copy of a LSA that we
originated ourselves, before a reboot of ospf6d.  We create a new
copy of the LSA to resync the SeqNum, but then half an hour later
the old refresh thread ends up trying to refresh the free()'d old LSA.

The SEGV is triggered by this chain:
  ospf6_lsdb_maxage_remover
  -> thread_execute(ospf6_lsa_refresh)
     -> old->refresh = NULL
Which assumes that old->refresh is no longer scheduled to run, as it is
being run right there.  But the thread_execute() doesn't know about
old->refresh and therefore didn't remove it.

(Found by ANVL OSPFV3-16.17)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-03-18 08:45:29 +01:00