Commit graph

252 commits

Author SHA1 Message Date
Lakshman Krishnamoorthy eadd168781 lib: Introducing a 3rd state for route-map match cmd: RMAP_NOOP
Introducing a 3rd state for route_map_apply library function: RMAP_NOOP

Traditionally route map MATCH rule apis  were designed to return
a binary response, consisting of either RMAP_MATCH or RMAP_NOMATCH.
(Route-map SET rule apis return RMAP_OKAY or RMAP_ERROR).
Depending on this response, the following statemachine decided the
course of action:

Action: Apply route-map match and return the result (RMAP_MATCH/RMAP_NOMATCH)
State1: Receveived RMAP_MATCH
THEN: If Routemap type is PERMIT, execute other rules if applicable,
otherwise we PERMIT!
Else: If Routemap type is DENY, we DENYMATCH right away

State2: Received RMAP_NOMATCH, continue on to next route-map, otherwise,
return DENYMATCH by default if nothing matched.

With reference to PR 4078 (https://github.com/FRRouting/frr/pull/4078),
we require a 3rd state because of the following situation:

The issue - what if, the rule api needs to abort or ignore a rule?:
"match evpn vni xx" route-map filter can be applied to incoming routes
regardless of whether the tunnel type is vxlan or mpls.
This rule should be N/A for mpls based evpn route, but applicable to only
vxlan based evpn route.

Today, the filter produces either a match or nomatch response regardless of
whether it is mpls/vxlan, resulting in either permitting or denying the
route.. So an mpls evpn route may get filtered out incorrectly.
Eg: "route-map RM1 permit 10 ; match evpn vni 20" or
"route-map RM2 deny 20 ; match vni 20"

With the introduction of the 3rd state, we can abort this rule check safely.
How? The rules api can now return RMAP_NOOP (or another enum) to indicate
that it encountered an invalid check, and needs to abort just that rule,
but continue with other rules.

Question: Do we repurpose an existing enum RMAP_OKAY or RMAP_ERROR
as the 3rd state (or create a new enum like RMAP_NOOP)?
RMAP_OKAY and RMAP_ERROR are used to return the result of set cmd.

We chose to go with RMAP_NOOP (but open to ideas),
as a way to bypass the rmap filter

As a result we have a 3rd state:
State3: Received RMAP_NOOP
Then, proceed to other route-map, otherwise return RMAP_PERMITMATCH by default.

Signed-off-by:Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-05-30 11:21:28 -07:00
Philippe Guibert 0945d5ed01 bgp, ospfd, ospf6d, pimd, lib, isisd: add bfd_client_sendmsg vrf_id
vrf_id parameter is added to the api of bfd_client_sendmsg().
this permits being registered to bfd from a separate vrf.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-07 15:53:07 +02:00
Quentin Young 121f9dee7c *: use ZAPI_CALLBACK_ARGS macro for zapi handlers
This macro:
- Marks ZAPI callbacks for readability
- Standardizes argument names
- Makes it simple to add ZAPI arguments in the future
- Ensures proper types
- Looks better
- Shortens function declarations

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-03 20:57:35 +00:00
Quentin Young 9f5dc3192e *: remove casts of XMALLOC / XCALLOC
No cast necessary for void *

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

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

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

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

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

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

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

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-01-14 11:41:33 -02:00
Donald Sharp 26f63a1ec6 *: Replace zclient_new with zclient_new_notify
It's been a year since we added the new optional parameters
to instantiation.  Let's switch over to the new name.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-12 09:16:23 -05:00
Olivier Dugeon 13894ce894
Merge pull request #3077 from rgirada/ospf_2980_fix
ospfd: Resolved the inconsistency behavior when “default-info origina…
2018-10-09 19:07:33 +02:00
rgirada 1fb93326ad ospfd: issue with the "default-information originate always" command #2980
Made changes such that message wont be sent to zebra to validate default
route existence  if user configured with “always”.

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

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

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

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

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

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-13 17:17:42 -04:00
Quentin Young d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
G. Paul Ziemba 5c780bc943 ospfd: debug detail for redistribute
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-09 16:42:40 -05:00
Lou Berger 996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Donald Sharp 4a7371e9e2 *: Track vrfs per nexthop not per route entry
Track the vfrs on a per nexthop basis instead
of on a per route entry basis.

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

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12 09:22:07 -05:00
Donald Sharp e1a1880de3 *: Make zapi route install Notifications optional
Allow the higher level protocol to specify if it would
like to receive notifications about it's routes that
it has installed.

I've purposely made it part of zclient_new_notify because
we need to track the routes on a per daemon basis only.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-27 09:09:35 -05:00
Chirag Shah de1ac5fd63 ospfd: Make external routes in ospf VRF aware
Currently, ospf external routers are part of struct
ospf_master which is not vrf aware ospf instance.
All ospf external routes are injected/leaked into all
vrfs.

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

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

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

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

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

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

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

This reverts commit 84361d615.

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

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

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

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

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

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

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

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

Address memory leaks

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

to the form

  thread_add_* (..., &t)

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

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

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

It is based on the following patch:

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

    *: Widen width of Zserv routing tag field.

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

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-10-07 21:05:05 -04:00
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
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
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
Olivier Dugeon 16f1b9ee29 Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches.  Since this
series builds together I am doing this. -DBS

This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering

* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add support for IEEE 754 format

* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
  safely convert between big-endian IEEE-754 single and double binary
  format, as used in IETF RFCs, and C99.  Implementation depends on host
  using __STDC_IEC_559__, which should be everything we care about.  Should
  correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add link parameters support to Zebra

* zebra/interface.c:
   - Add new link-params CLI commands
   - Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add support of new link-params CLI to vtysh

In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Update Traffic Engineering support for OSPFD

These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).

* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

tmp
2016-09-03 11:05:50 -04:00
Donald Sharp 5b30316ea5 bgpd, lib, ospfd, pimd, zebra: Use nexthop_types_t
Use the 'enum nexthop_types_t' instead of
the zebra.h #defines.  And remove code from
zebra.h that does not belong there.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-02 10:36:28 -04:00
Donald Sharp 275382273b Merge remote-tracking branch 'origin/cmaster' into cmaster-next 2016-07-12 20:24:00 -04: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
Joakim Tjernlund f4936b2aab ospfd: add missing unlock for ospf_interface_address_delete()
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com>
(cherry picked from commit fbb6c8650344fe72d39f538c681659e8b76a39d0)
2016-05-26 15:33:30 +00:00
Daniel Walton 3dfc79c20d OSPF ANVL failures in 3.0
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10088

When we pulled this patch from upstream there was one spot where we
incorrectly used min_ls_interval (5s) instead of min_ls_arrival (1s).
commit ac7424f9de
Author: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
Date:   Mon Jul 27 21:05:44 2015 +0200

    configuration options for faster OSPF convergence

    Allow configuration of faster OSPF convergence via the
    min_ls_interval and min_ls_arrival timer lengths.

    This patch was originated by Michael, and cross-ported
    to Cumulus's Quagga.
2016-05-14 02:29:11 +00:00
Don Slice 4fe5171412 zebra: Change interface handling so non-vrf aware protocols correctly handle them
Changed interaction between zebra and routing protocols so that they correctly
fill in the vrf_iflist even for vrfs they're not responsible for.  In that way,
when they get callbacks from zebra they can correctly understand whether they need
to create them or not.

Ticket: CM-10427
Signed-off-by: Don Slice
Reviewed-by:
2016-04-22 05:26:12 -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 53785cfdbf ospfd: Fix MI redistribution
If we are attempting to redistribute from a MI ospf
then when should only check for the non MI case if
instance was not passed in.

Ticket: CM-9543
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-03-01 13:12:36 -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 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
Donald Sharp d44ca835fc Zebra: Remove reliance on NEXTHOP_TYPE_IPV4_ONLINK
Zebra already knows if an interface is unnumbered or not.  This
is communicated to OSPF.
OSPF would only send a NEXTHOP_TYPE_IPV4_ONLINK *if* the path
was unnumbered, which it learns from Zebra.

As such, Have OSPF use the normal NEXTHOP_TYPE_IPV4_IFINDEX
type for unnumbered paths.  In Zebra, if the ifindex recieved
is unnumbered then assume that the link is NEXTHOP_FLAG_ONLINK.

Ticket: CM-8145
Reviewed-by: CCR-3771
Testing: See bug

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-16 12:48:07 -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
David Lamparter a38401b6af lib: hide internal prefix list structures
These are about to be touched and there's no point in other code
touching into prefix list's internas.  Add some isolation.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2015-11-03 05:42:24 -08: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
Vipin Kumar 9a89518f3b OSPF needs to handle the previously added redist update
Ticket: CM-7388
Reviewed By: Donald, Vivek
Testing Done: Cherry picking from 2.5.4, no testing on 3.0 yet

OSPF needs to handle the previously added redist update/raplace semantics.
Update has no new message type, it comes as ADD message.
2015-10-20 15:17:07 -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
Michael Rossberg ac7424f9de configuration options for faster OSPF convergence
Allow configuration of faster OSPF convergence via the
min_ls_interval and min_ls_arrival timer lengths.

This patch was originated by Michael, and cross-ported
to Cumulus's Quagga.

Signed-off-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-07-31 06:29:35 -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 c43ed2e48a This patch changes BGP from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state.
This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop.

BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).

router bgp <as-number>
  neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-06-12 07:59:11 -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 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 525c183906 Unnumbered interface support. 2015-05-19 17:58:13 -07:00
Donald Sharp d5a5c8f05b This patch adds support for a new BFD session down message from zebra to
protocols. BGP and OSPF are integrated to respond this BFD session down message
originated in Zebra via ptmd.

BGP and OSPF now have a bfd command, which tells OSPF/BGP to respond to the
BFD session down message.

OSPF:

interface <>
 ip ospf bfd

BGP:

router bgp <>
  neighbor <> bfd

Please note that these commands don't enable BFD as a protocol. BFD configuration
and paramter tuning are via BFD applicable UI.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
2015-05-19 17:47:23 -07:00
Donald Sharp 0d9551dc3c Add support for route tags
Credit
------
A huge amount of credit for this patch goes to Piotr Chytla for
their 'route tags support' patch that was submitted to quagga-dev
in June 2007.

Documentation
-------------
All ipv4 and ipv6 static route commands now have a "tag" option
which allows the user to set a tag between 1 and 65535.

quagga(config)# ip route 1.1.1.1/32 10.1.1.1 tag ?
  <1-65535>  Tag value
quagga(config)# ip route 1.1.1.1/32 10.1.1.1 tag 40
quagga(config)#

quagga# show ip route 1.1.1.1/32
Routing entry for 1.1.1.1/32
  Known via "static", distance 1, metric 0, tag 40, best
  * 10.1.1.1, via swp1

quagga#

The route-map parser supports matching on tags and setting tags
!
route-map MATCH_TAG_18 permit 10
 match tag 18
!

!
route-map SET_TAG_22 permit 10
 set tag 22
!

BGP and OSPF support:
- matching on tags when redistribing routes from the RIB into BGP/OSPF.
- setting tags when redistribing routes from the RIB into BGP/OSPF.

BGP also supports setting a tag via a table-map, when installing BGP
routes into the RIB.

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-05-19 17:46:33 -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 a25a1264a5 ospfd: fixup log message in ospf_zebra_delete
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Feng Lu <lu.feng@6wind.com>
2014-02-10 22:07:11 +01:00
Andrew Certain 0798cee34f ospfd: compile warning cleanups
A set of patches to clarify some comments as well as cleanup code that was
causing warnings.  After these patches, the code can be compiled with

-Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings
-Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual
-Wextra -Wno-unused-parameter -Wno-missing-field-initializers

(what is current in trunk plus -Wextra -Wno-unused-parameter
-Wno-missing-field-initializers).

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
2013-01-07 09:59:59 -08:00
Joakim Tjernlund ba281d3d04 ospfd: use ZEBRA_NEXTHOP_IPV4_IFINDEX
OSPF really needs to specify interface in its routes. Otherwise
ospf may change the wrong route.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
[fixed up some whitespace errors, split patch in two]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-07-25 18:07:45 +02:00
Denis Ovsienko b4e45f6705 fix zebra protocol after MP-BGP changes
The previous commits modified both zebra and bgpd for additional
SAFI field, but not any other routing daemon, which led to zebra
daemon crashing with failed assertion.
2012-01-23 14:31:42 +04:00
Denis Ovsienko bcc6c59ac5 ospfd: spelling 2011-09-27 21:43:27 +04:00
Joakim Tjernlund 46154fe367 ospfd: Only refresh external default route once.
* ospf_zebra.c: (ospf_distribute_list_update_timer) forces a
  refresh of default route each time it finds a default prefix.
  This is suboptimal, just record that it needs to be done and
  do it once.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
2010-04-18 14:56:41 -04:00
Joakim Tjernlund 45acaa0a4c ospfd: Make sure ospf_distribute_list_update_timer() eventually runs.
* ospf_zebra.c: (ospf_distribute_list_update_timer)
   If there are updates to the distribute list every 5 second or less,
   ospf_distribute_list_update_timer() will never run as the timer gets
   rearmed for each update. This fixes it by never rearming an active
   distribute list timer.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
2010-04-18 14:53:28 -04:00
Joakim Tjernlund 274d3f090d ospfd: Make sure all external routes are updated.
Roman Hoog Antink <rha@open.ch>	reports:

When adding a connected route (using vtysh, without restart) to the
redistribution access list of ospfd, while static routes already exist,
the update timer ospf_distribute_list_update_timer() is being run for
static routes only. That way, the connected route never appears in the
OSPF database, until quagga is completely restarted.

The update timer for connected routes is cancelled in
ospfd/ospfd_zebra.c:ospf_distribute_list_update():976, were a new timer
is scheduled for static routes, caused by the loop in ospf_filter_update().

 * ospf_zebra.c: (ospf_distribute_list_update_timer) make it
   refresh all external routes. This fixes the problem
   reported by Roman.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
2010-04-18 14:35:36 -04:00
Joakim Tjernlund 5d8de93a84 ospfd: Tighten up the connected check for redistribution
* ospf_zebra.c: (ospf_distribute_check_connected) check to make filter out
  routes matching connected routes was matching against OSPF networks, which
  can be far more general than the actual connected interfaces. Fix.
2009-08-28 12:29:38 +01:00
Joakim Tjernlund a8ba847ff9 ospfd: Change struct ospf_path *oi to ifindex.
* global: In struct ospf_path, change struct ospf_interface *oi to int
  ifindex.  It is unsafe to reference *oi as an ospf interface can be
  deleted under your feet. Use a weak reference instead.
2009-08-03 16:52:30 +01:00
Stephen Hemminger 30d205909c [global] interface flags format warnings
*/*: ifp->flags is 64 bit unsigned which can not be handled by %l on 32
     bit architectures - requires %ll and the appropriate cast.
2009-07-28 11:58:51 +01:00
Stephen Hemminger 393deb9bd6 [cleanup] Convert XMALLOC/memset to XCALLOC
Simple conversion of XMALLOC/memset to XCALLOC
2009-06-12 17:07:49 +01:00
Joakim Tjernlund a49eb30a17 [ospfd] Restructure opsf_if_update() and ospf_network_run()
Add an struct interface paramenter and adjust the affected
    code accordingly.

    The old code was a mess looping over all interfaces several times
    when one interface was added/changed.

    * ospfd/ospfd.h: Add struct interface parameter to ospf_if_update()
    * ospfd/ospf_zebra.c: Add ifp arg to ospf_if_update() calls.
      (ospf_interface_address_delete) delete ospf_if_update() call,
      redundant as function calls ospf_if_free() itself.
    * ospfd/ospfd.c: (ospf_network_unset) handle deconfiguration here,
      rather than ospf_if_update.
      (ospf_network_run_interface) ospf_network_run, for
      any given interface.
      (ospf_network_run) move guts to previous, and use it.
      (ospf_if_update) Adjust to take struct interface as argument, as
      all callers have a specific ifp in mind.
      Iterate over ifp's connected list and call ospf_network_run_interface
      instead of ospf_network_run, turning this path into O(nm) rather
      than O(n^2).
      Adjust all code dealing with opsf_if_update and ospf_network_run to
      pass the new struct interface * arg.

     (some minor modifications and bug-additions by Paul Jakma).

Signed-off-by: Paul Jakma <paul@quagga.net>
2008-09-02 21:38:00 +01:00
Andrew J. Schorr 56b3ea09bb [ospfd] Fix two debug messages that used inet_ntoa more than once
2007-03-14 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ospf_zebra.c: (ospf_zebra_add, ospf_zebra_delete) Fix bug
	  where inet_ntoa was used twice in the same debug message,
	  which doesn't work because there's a single shared buffer
	  for the returned string.  The fix is to use inet_ntop.
2007-03-14 20:21:43 +00:00
Andrew J. Schorr 7f643ebf2b [ospfd] Add debug messages for a few zebra messages that had been overlooked
2006-11-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ospf_zebra.c: (ospf_router_id_update_zebra,
	  ospf_interface_address_add, ospf_interface_address_delete)
	  If (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) is enabled, then
	  add a debug message about what Zebra is telling us.
	  (ospf_zebra_add_discard) Add a debug message matching the one
	  already in ospf_zebra_delete_discard.
2006-11-30 16:17:02 +00:00
Andrew J. Schorr 8fb8a504e2 [ospfd] Stop losing subsequent default-information originate 'always' info
2006-10-24 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ospf_zebra.c: (ospf_redistribute_default_set) Fix bug where
	  a new value for ospf->default_originate was being ignored
	  if a previous 'default-information originate' command
	  had already been processed.
2006-10-24 19:04:26 +00:00
Paul Jakma 6db3a6f75c [ospfd] CID #28, remove another ospf_lookup call - ospf_redistribute_withdraw
2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* ospf_asbr.c: (ospf_redistribute_withdraw) remove ospf_lookup
	  call by taking the struct ospf * as argument, which the
	  caller has, fixing CID #28.
	* ospf_asbr.h: (ospf_redistribute_withdraw) update declaration
	* ospf_zebra.c: (ospf_redistribute_unset) update call to
	  ospf_redistribute_withdraw to match.
2006-05-12 23:02:46 +00:00
Paul Jakma 4021b60aad [ospfd] Squash another ospf_lookup call
2006-05-11 Paul Jakma <paul.jakma@sun.com>

	* ospf_lsa.c: (ospf_default_originate_timer) Let the thread
	  take (struct ospf *) as thread argument, rather than (struct
	  ospf *)->default_originate, thus avoiding having to call
	  ospf_lookup.
	* ospf_zebra.c: (ospf_redistribute_default_set) change setup
	  of ospf_default_originate_timer thread to match.
	* ospfd.c: (ospf_router_id_update) ditto.
2006-05-12 22:55:41 +00:00
paul c6371718f3 [ospfd/zserv] adjust to new format
2006-01-17 Paul Jakma <paul.jakma@sun.com>

	* ospf_packet.c: (ospf_verify_header) print out the types
	  involved if there's a mismatch.
	* ospf_zebra.c: (ospf_zebra_add) Adjust to new zserv format.
2006-01-17 17:49:53 +00:00
paul 98429f6d07 [ospfd] fix rare leak of struct connected, in an error path.
2006-01-10 Juris Kalnins <juris@mt.lv>

	* ospf_zebra.c: (ospf_interface_address_delete) fix rare leak of
	  struct connected in an error case.
2006-01-10 22:11:54 +00:00
paul b29800a676 2005-11-20 Paul Jakma <paul.jakma@sun.com>
* ospfd.h: remove the OSPF_ROUTER_ID_UPDATE_DELAY define
          (struct ospf) remove the router_id timer thread.
          remove export of ospf_router_id_update_timer.
        * ospfd.c: (ospf_router_id_update) call ospf_if_update to
          poke interfaces into action after ID has been configured.
          (ospf_router_id_update_timer) removed.
          (ospf_finish_final) t_router_id_update timer is gone.
          (ospf_network_run) router-id update timer gone.
          call ospf_router_id_update directly if ID not configured.
          In the per-iface loop, don't ospf_if_up interfaces if
          ID is still not configured. The update function will call
          ospf_if_update anyway.
          (ospf_if_update) ID update timer is gone. Just return if no
          ID is set.
        * ospf_vty.c: (ospf_router_id) call ospf_router_id_update, no
          timer needed.
        * ospf_zebra.c: (ospf_router_id_update_zebra) call
          ospf_router_id_update directly, not via timer.
2005-11-20 14:50:45 +00:00
ajs f52d13cb2e 2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
	  zebra_route_char().
	* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
	  functions to map zebra route numbers to strings.
	* zebra_vty.c: (route_type_str) Remove obsolete function: use new
	  library function zebra_route_string() instead.  Note that there
	  are a few differences: for IPv6 routes, we now get "ripng" and
	  "ospf6" instead of the old behavior ("rip" and "ospf").
	  (route_type_char) Remove obsolete function: ues new library function
	  zebra_route_char() instead.  Note that there is one difference:
	  the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
	  whereas the new one returns 'X'.
	  (vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
	  route_type_str() with zebra_route_string().
	  (vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
	  with zebra_route_char().
	* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
	  zebra_route_string instead of a local hard-coded table.
	* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
	  zroute_abname. Change the ZROUTE_NAME macro to use new library
	  function zebra_route_string().  Remove the ZROUTE_ABNAME macro.
	  (ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
	  a call to zebra_route_char(), and be sure to fix the format string,
	  since we now have a char instead of a char *.
	* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
	  zebra_route_abname.  Note that the zebra_route_name[] table
	  contained mixed-case strings, whereas the zebra_route_string()
	  function returns lower-case strings.
	  (ospf6_zebra_read_ipv6): Change debug message to use new library
	  function zebra_route_string() instead of zebra_route_name[].
	  (show_zebra): Use new library function zebra_route_string() instead
	  of zebra_route_name[].
	* ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
	  (ospf_redist_string) New function implemented using new library
	  function zebra_route_string().  Note that there are a few differences
	  in the output that will result: the new function returns strings
	  that are lower-case, whereas the old table was mixed case.  Also,
	  the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
	  new function returns "ospf6".
	* ospfd.h: Remove extern struct message ospf_redistributed_proto[],
	  and add extern const char *ospf_redist_string(u_int route_type)
	  instead.
	* ospf_asbr.c: (ospf_external_info_add) In two messages, use
	  ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
	* ospf_vty.c: Remove local hard-coded table distribute_str.
	  (config_write_ospf_redistribute,config_write_ospf_distribute): Use
	  new library function zebra_route_string() instead of distribute_str[].
	* ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
	  ospf_redistribute_default_set,ospf_redistribute_check)
	  In debug messages, use ospf_redist_string() instead of
	  LOOKUP(ospf_redistributed_proto).
	* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
	  table str[]. Replace str[] with calls to new library function
	  zebra_route_string().
	* ripd.c: Remove local hard-coded table route_info[].
	  (show_ip_rip) Replace uses of str[] with calls to new library
	  functions zebra_route_char and zebra_route_string.
	* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
	  table str[].  Replace str[i] with new library function
	  zebra_route_string(i).
	* ripngd.c: Remove local hard-coded table route_info[].
	  (show_ipv6_ripng) Use new library function zebra_route_char() instead
	  of table route_info[].
2005-10-01 17:38:06 +00:00
ajs 5339cfdb7c 2005-09-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_lsa.h: (ospf_external_lsa_flush) Comment out the 5th argument
	  (nexthop) since it is not used in the function (except inside
	  some commented-out code).
	* ospf_lsa.c: (ospf_external_lsa_flush,ospf_external_lsa_refresh)
	  Comment out the 5th argument to ospf_external_lsa_flush.
	* ospf_asbr.c: (ospf_redistribute_withdraw) Comment out 5th arg
	  to ospf_external_lsa_flush.
	* ospf_vty.c: (no_ospf_default_information_originate) Eliminate 5th
	  uninitialized nexthop arg to ospf_external_lsa_flush.
	* ospf_zebra.c: (ospf_zebra_read_ipv4) Comment out 5th arg
	  to ospf_external_lsa_flush.
	* ospfd.c: (ospf_network_set) Comment out 5th arg
	  to ospf_external_lsa_flush.
2005-09-19 13:28:05 +00:00
hasso 01018ce479 * ospf_zebra.c: Don't assert/stop before type == ZEBRA_ROUTE_MAX if
dealing with routemaps. There is ospf->route_map[ZEBRA_ROUTE_MAX]
	  for default-information.

	Fixes bugzilla #208.
	[backport candidate]
2005-08-05 07:40:15 +00:00
paul 4dadc291e5 2005-05-06 Paul Jakma <paul.jakma@sun.com>
* (general) extern and static qualifiers added.
          unspecified arguments in definitions fixed, typically they should
          be 'void'.
          function casts added for callbacks.
          Guards added to headers which lacked them.
          Proper headers included rather than relying on incomplete
          definitions.
          gcc noreturn function attribute where appropriate.
        * ospf_opaque.c: remove the private definition of ospf_lsa's
          ospf_lsa_refresh_delay.
        * ospf_lsa.h: export ospf_lsa_refresh_delay
        * ospf_packet.c: (ospf_make_md5_digest) make *auth_key const,
          correct thing to do - removes need for the casts later.
        * ospf_vty.c: Use vty.h's VTY_GET_INTEGER rather than ospf_vty's
          home-brewed versions, shuts up several warnings.
        * ospf_vty.h: remove VTY_GET_UINT32. VTY_GET_IPV4_ADDRESS and
          VTY_GET_IPV4_PREFIX moved to lib/vty.h.
        * ospf_zebra.c: (ospf_distribute_list_update_timer) hacky
          overloading of the THREAD_ARG pointer should at least use
          uintptr_t.
2005-05-06 21:37:42 +00:00
ajs 634f9ea20f 2005-04-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
Implement non-blocking zclient I/O with buffering.
	* zclient.h (struct zclient): Add two fields to support non-blocking
	  I/O: struct buffer *wb, and struct thread *t_write.
	  (zclient_free): Remove function.
	  (zebra_redistribute_send): Change 2nd arg from socket fd to
	  struct zclient * (needed to support non-blocking I/O and buffering).
	  (zclient_send_message): New function to send an arbitrary
	  message with non-blocking I/O.
	* zclient.c (zclient_new): Create write buffer.
	  (zclient_free): Remove unused function.
	  (zclient_stop): Must cancel new t_write thread.  Also, reset
	  all buffers: ibuf, obuf, and wb.
	  (zclient_failed): New helper function for typical error handling.
	  (zclient_flush_data): New thread to flush queued data.
	  (zclient_send_message): New function to send the message in
	  zclient->obuf to zebra using non-blocking I/O and buffering.
	  (zebra_message_send, zapi_ipv4_route, zapi_ipv6_route): Use
	  new zclient_send_message function instead of calling writen.
	  (zclient_start): Set socket non-blocking.  Also, change 2nd arg
	  to zebra_redistribute_send from zclient->sock to zclient.
	  (zebra_redistribute_send): Change 2nd arg to struct zclient *.
	  Can now use zclient->obuf to assemble the message instead of
	  allocating a temporary stream.  And call zclient_send_message to
	  send the message instead of writen.
	  (zclient_read): Convert to support non-blocking I/O by using
	  stream_read_try instead of deprecated stream_read.
	  (zclient_redistribute): Change 2nd arg to zebra_redistribute_send
	  from zclient->sock to zclient.
	* ospf6_zebra.c (ospf6_zebra_redistribute, ospf6_zebra_no_redistribute):
	  Change 2nd arg to zebra_redistribute_send from zclient->sock
	  to zclient.
	* ospf_zebra.c (ospf_zebra_add): Call zclient_send_message instead
	  of writen.
	* rip_zebra.c (rip_redistribute_set, rip_redistribute_unset,
	  rip_redistribute_clean): Change 2nd arg to zebra_redistribute_send
	  from zclient->sock to zclient.
	* ripng_zebra.c (ripng_redistribute_unset, ripng_redistribute_clean):
	  Change 2nd arg to zebra_redistribute_send from zclient->sock
	  to zclient.
	* bgp_zebra.c (bgp_redistribute_set, bgp_redistribute_unset):
	  The 2nd arg to zebra_redistribute_send is now zclient instead of
	  zclient->sock.
	* isis_zebra.h (isis_zebra_finish): Remove declaration of unused
	  function.
	* isis_zebra.c (isis_zebra_route_add_ipv4): Call zclient_send_message
	  to send the message to zebra instead of calling writen directly, since
	  zclient_send_message understands non-blocking I/O and will manage
	  the buffer queue appropriately.
	  (isis_zebra_finish): Remove unused function, particularly since
	  the zclient_free function has been removed.
2005-04-11 15:51:40 +00:00
paul 1eb8ef2584 2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
	  and some basic auditing of usage.
	* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
	* HACKING: Add notes about deprecating interfaces and commands.
	* lib/linklist.h: Add usage comments.
	  Rename getdata macro to listgetdata.
	  Rename nextnode to listnextnode and fix its odd behaviour to be
	  less dangerous.
	  Make listgetdata macro assert node is not null, NULL list entries
          should be bug condition.
          ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
          with for loop, Suggested by Jim Carlson of Sun.
          Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
          "safety" of previous macro.
	  LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
	  distinguish from the similarly named functions, and reflect their
	  effect better.
	  Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
	  with the old defines which were modified above,
	  for backwards compatibility - guarded to prevent Quagga using it..
	* lib/linklist.c: fix up for linklist.h changes.
	* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
	  scan of the area list, rather than scanning all areas first for
	  INTER_ROUTER and then again for INTER_NETWORK. According to
	  16.2, the scan should be area specific anyway, and further
	  ospf6d does not seem to implement 16.3 anyway.
2005-04-07 07:30:20 +00:00
ajs 21fefa9843 2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_zebra.c: (zebra_interface_if_lookup) Must use
	  if_lookup_by_name_len.
2005-04-02 23:16:41 +00:00
ajs d2fc88962a 2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
Fix problems when netlink interfaces are renamed (same ifindex used
	for a new interface).  Start cleaning up some problems with the way
	interface names are handled.
	* interface.c: (if_new_intern_ifindex) Remove obsolete function.
	  (if_delete_update) After distributing the interface deletion message,
	  set ifp->ifindex to IFINDEX_INTERNAL.
	  (if_dump_vty) Detect pseudo interface by checking if ifp->ifindex is
	  IFINDEX_INTERNAL.
	  (zebra_interface) Check return code from interface_cmd.func.
	  Do not set internal ifindex values to if_new_intern_ifindex(),
	  since we now use IFINDEX_INTERNAL for all pseudo interfaces.
	* kernel_socket.c: (ifm_read) Fix code and comments to reflect that
	  all internal interfaces now have ifp->ifindex set to IFINDEX_INTERNAL.
        * rt_netlink.c: (set_ifindex) New function used to update ifp->ifindex.
	  Detects interface rename events by checking if that ifindex is already
	  being used.  If it is, delete the old interface before assigning
	  the ifindex to the new interface.
	  (netlink_interface, netlink_link_change) Call set_ifindex to update
	  the ifindex.
	* if.h: Remove define for IFINDEX_INTERNBASE and add define
	  IFINDEX_INTERNAL 0, since all internal (i.e. non-kernel) pseudo-
	  interfaces should have ifindex set to 0.
	  (if_new) Remove function.
	  (if_delete_retain) New function to delete an interface without
	  removing from iflist and freeing the structure.
	  (ifname2ifindex) New function.
	* if.c: (if_new) Remove function (absorb into if_create).
	  (if_create) Replace function if_new with call to calloc.
	  Set ifp->ifindex to IFINDEX_INTERNAL.  Fix off-by-one error
	  in assert to check length of interface name.  Add error message
	  if interface with this name already exists.
	  (if_delete_retain) New function to delete an interface without
	  removing from iflist and freeing the structure.
	  (if_delete) Implement with help of if_delete_retain.
	  (ifindex2ifname) Reimplement using if_lookup_by_index.
	  (ifname2ifindex) New function to complement ifindex2ifname.
	  (interface) The interface command should check the name length
	  and fail with a warning message if it is too long.
	  (no_interface) Fix spelling in warning message.
	  (if_nametoindex) Reimplement using if_lookup_by_name.
	  (if_indextoname, ifaddr_ipv4_lookup) Reimplement using
	  if_lookup_by_index.
	* bgp_zebra.c: (bgp_interface_delete) After deleting, set ifp->ifindex
	  to IFINDEX_INTERNAL.
	* isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead
	  of if_delete, since it is generally not safe to remove interface
	  structures.  After deleting, set ifp->ifindex to IFINDEX_INTERNAL.
	  (zebra_interface_if_lookup) Tighten up code.
	* ospf6_zebra.c: (ospf6_zebra_if_del) Previously, this whole function
	  was commented out.  But this is not safe: we should at least update
	  the ifindex when the interface is deleted.  So the new version
	  updates the interface status and sets ifp->ifindex to
	  IFINDEX_INTERNAL.
	  (ospf6_zebra_route_update) Use if_indextoname properly.
	* ospf_vty.c: (show_ip_ospf_interface_sub) Show ifindex and interface
	  flags to help with debugging.
	* ospf_zebra.c: (ospf_interface_delete) After deleting, set ifp->ifindex
	  to IFINDEX_INTERNAL.
	  (zebra_interface_if_lookup) Make function static.  Tighten up code.
	* rip_interface.c: (rip_interface_delete) After deleting, set
	  ifp->ifindex to IFINDEX_INTERNAL.
	* ripng_interface.c: (ripng_interface_delete) After deleting, set
	  ifp->ifindex to IFINDEX_INTERNAL.
2005-04-02 18:38:43 +00:00
ajs a608bbf27b 2005-03-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* rt_netlink.c: (netlink_link_change) If the status of an
	  operative interface changes (e.g. MTU changes), the client
	  daemons should be notified by calling zebra_interface_up_update.
	  Previously, the information was being updated in zebra's
	  interface structure, but the clients were not notified of
	  changes to an operative interface.
	* ospf_zebra.c: (ospf_interface_state_up) If the MTU of an operative
	  interface changes, print a debug message and call ospf_if_reset()
	  to simulate down/up on the interface.
	* ospf_interface.h: Declare new function ospf_if_reset().
	* ospf_interface.c: (ospf_if_reset) New function to call ospf_if_down
	  and ospf_if_up for all ospf interfaces attached to an interface.
2005-03-29 17:03:49 +00:00
ajs bc18d616ad 2004-12-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_interface.h: Declare new function ospf_default_iftype.
	* ospf_interface.c: (ospf_default_iftype) New function to centralize
	  this logic in one place.
	* ospf_zebra.c: (ospf_interface_add) Use new function
	  ospf_default_iftype.
	* ospf_vty.c: (no_ip_ospf_network,config_write_interface) Fix logic
	  by using new function ospf_default_iftype.
2004-12-15 15:07:19 +00:00
ajs 9b0e25c077 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* *.c: Change level of debug messages to LOG_DEBUG.
2004-12-08 19:06:51 +00:00
paul 64511f394a 2004-10-31 Paul Jakma <paul@dishone.st>
* ospf_packet.c: (ospf_ls_upd_packet_new) Format for size_t should
          be ld.
	* ospf_zebra.c: (ospf_distribute_list_update_timer) Ugly misuse of
	  THREAD_ARG to store an integer, but it should at least use same
          same type to retrieve the value. Assert value is sane.
2004-10-31 18:01:13 +00:00
paul 6c83567192 2004-10-11 Paul Jakma <paul@dishone.st>
* (global) Const char update and signed/unsigned fixes.
	* (various headers) size defines should be unsigned.
	* ospf_interface.h: remove duplicated defines, include the
	  authoritative header - though, these defines should probably
          be moved to a dedicated header, or ospfd.h.
	* ospf_lsa.h: (struct lsa) ls_seqnum should be unsigned.
	* ospf_packet.c: (ospf_write) cast result of shift to unsigned.
2004-10-11 11:00:30 +00:00
hasso 18a6dce6f8 Common router id. 2004-10-03 18:18:34 +00:00
hasso c9e52be3f4 Compiler warnings fixes. 2004-09-26 16:09:34 +00:00
hasso 52dc7ee65f Remove usage of evil list and listnode typedefs. 2004-09-23 19:18:23 +00:00
hasso dd669bb0e7 * Make updating redistributions work if prefix list is changed and it's
used in route-map used to filter redistributions.
* Move ospf_prefix_list_update() function from ospfd.c to ospf_zebra.c.
2004-05-10 07:43:59 +00:00
paul 0a58935967 2004-05-08 Paul Jakma <paul@dishone.st>
* bgp_zebra.c: (bgp_interface_address_add) sync to zclient changes
         (bgp_interface_address_delete) ditto.
         (bgp_zebra_announce) ditto.
         (bgp_zebra_withdraw) ditto.
       * isis_zebra.c: Sync with zclient changes.
       * zclient.c (zapi_ipv4_route) Follow Sowmini's lead and describe
         message format.
       * ospf6_zebra.c: Sync to zclient changes
       * ospf_zebra.c: Sync with lib/zclient changes
       * rip_zebra.c: sync with zclient changes.
       * rip_interface.c: ditto.
       * ripng_{interface,zebra}.c: sync with zclient changes


2004-05-08 Sowmini Varadhan <sowmini.varadhan@sun.com>

       * zclient.c: (zapi_ipv4_add) collapsed into zapi_ipv4_route
         (zapi_ipv4_delete) ditto.
         (zapi_ipv4_route) add/delete a route by way of cmd arg.
         (zapi_ipv6_add) collapsed into zapi_ipv6_route.
         (zapi_ipv6_delete) ditto.
         (zapi_ipv6_route) add/delete a route by way of cmd arg.
         (zebra_interface_address_delete_read) collapsed into
         zebra_interface_address_read.
         (zebra_interface_address_delete_read) ditto.
         (zebra_interface_address_read) read address add/delete messages
         by way of type argument. Describe command message format.
         (zebra_interface_add_read) Unconditionally read new ifmtu6 field.
         Describe command message format.
         (zebra_interface_state_read) Unconditionally read new ifmtu6 field.
         (zclient_redistribute_set) Collapsed into zclient_redistribute
         (zclient_redistribute_unset) ditto
         (zclient_redistribute) set/unset redistribution.
         (zclient_redistribute_default_set) Collapsed into
         zclient_redistribute_default.
         (zclient_redistribute_default_unset) ditto.
         (zclient_redistribute_default) Redistribute default set/unset.
       * zclient.h: delete zapi_ipv{4,6}_add, zapi_ipv{4,6}_delete. Add
         zapi_ipv{4,6}_route. delete zclient_redistribute_set/unset. Add
         zclient_redistribute. Ditto for
         zclient_redistribute_default_{set/unset}.
2004-05-08 11:48:26 +00:00
hasso a0a397615c Don't ignore reject/bh routes. Discussed with Paul in IRC. 2004-04-23 08:51:10 +00:00
hasso 8585d4e5e2 Some ospfd fixes - [quagga-dev 1032], [quagga-dev 1048], [quagga-dev 1058]. 2004-04-20 17:25:12 +00:00
paul 940b01aa6a 2004-02-17 Paul Jakma <paul@dishone.st>
* ospf_zebra.c: (ospf_interface_delete) Do not delete the interface
          params, nor the interface structure, if an interface delete
          message is received from zebra.
        * ospf_interface.c: (ospf_if_delete_hook) Delete the interface
          params and interface, ie that which was previously removed in
          (ospf_interface_delete) above.
2004-02-17 20:07:30 +00:00
gdt 6a8da8521d add an XXX at a point where ifindex_num is assumed to be one w/o
checking.
2004-02-13 17:40:51 +00:00
hasso 2db3d05da3 Don't crash when attempting to read path->oi->ifp if oi doesn't exist any
more. I'm not sure if this read should be attempted at all, but I'm trying
to keep code safe AND stable.
2004-02-11 21:52:13 +00:00
paul bb8ff1e7fe 2003-08-11 Yasuyuki Haga <yasuhaga@nifty.ne.jp>
* ospfd/ospf_zebra.c: (ospf_zebra_delete) Set ifindex if no nexthop
	  supplied. log if no (ifindex || nexthop) supplied.
2003-08-12 06:00:30 +00:00
paul d8e1d6bcc3 2003-08-10 Yasuyuki Haga <yasuhaga@nifty.ne.jp>
* ospfd/ospf_zebra.c: (ospf_zebra_delete) Do not dereference the
	ifp, it mightn't exist.
2003-08-10 04:04:41 +00:00
paul 96735eeafe 2003-08-10 amir <amir@datacore.ch>
* Add missing 'i' to getopts, short form of --pid_file.
	  see http://bugzilla.quagga.net/show_bug.cgi?id=25
2003-08-10 02:51:22 +00:00
hasso 622149ad4d Temporary "fix" for segfault. See bug #29 in bugzilla for details. 2003-08-07 09:29:13 +00:00
paul 7021c425a9 2003-07-15 Paul Jakma <paul@dishone.st>
* lib/version.h: add ZEBRA_URL (unused for now)
        * lib/vty.c: CMD_ERR_NOTHING_TODO when reading conf file should not
          be fatal. slight reformating.
        * ospfd/ospf_zebra.c: ignore reject/blackhole routes if zebra sends
          these type of routes. probably should be a new type of route to
          allow daemons to more easily choose whether to redistribute them
          - rathen than just a flag (eg for reject/blackhole).
          reorder the is_prefix_default test for ZEBRA_IPV4_ROUTE_DELETE to
          avoid the inverted test - slightly more readable.
        * redhat/zebra.spec.in: Add ospfapi port to services file, if
          with_ospfapi.
        * zebra/rib.h: Change nexthop types to an enum.
        * zebra/rt_netlink.c: run it through indent -nut.
          Add nexthop_types_desc[] descriptive array for nexthop types.
          (netlink_route_multipath) debug statements indicate which branch
          they are in and print out nexthop type.
        * zebra/zebra_rib.c: slight reformatting.
        * zebra/zebra_vty.c: Pass ZEBRA_FLAG_BLACKHOLE flag to
          static_add_ipv4() if Null0 route is configured. print out Null0 if
          STATIC_IPV4_BLACKHOLE route, and ignore flags (shouldnt be
          possible to set flags from vty) for config and show route.
2003-07-15 12:52:22 +00:00
paul cf795c5ded 2003-06-19 Paul Jakma <paul@dishone.st>
* ospfd/ospf_zebra.c: Run it through indent -nut to fix the $%^@ing
	annoying mix of tabs and spaces.
2003-06-19 02:13:25 +00:00
paul 72357f2b98 2003-06-19 Vladimir Ivaschenko <hazard@francoudi.com>
* ospfd/ospf_zebra.c: [zebra 19434] fix for disappearing OSPF routes
	modify ospf_zebra_delete() to specify nexthop when deleting routes
	with zebra.
2003-06-19 02:11:23 +00:00
paul 020709f993 2003-04-04 Paul Jakma <paul@dishone.st>
* Sync to Zebra CVS
        * Fix lib/thread.h leak
        * Fix small Opaque LSA leak
        * Do not configure OSPF interfaces for secondary addresses
        * vtysh fixes from Hasso
        * Dave Watson's missing ntohs fix
2003-04-04 02:44:16 +00:00
paul 6898008484 2003-03-25 Paul Jakma <paul@dishone.st>
* sync to latest zebra CVS
	* spec file: updated and added define for ospf-api/client

NB: OSPF-API has been broken by the zebra.org changes, which
has added struct ospf * as a new arg to many functions
2003-03-25 05:07:42 +00:00
paul f2c8065220 Kevin C Miller <kevinm@andrew.cmu.edu>
[zebra 16681] OSPF NSSA Patches
2002-12-13 21:44:27 +00:00