Age | Commit message (Collapse) | Author |
|
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
On Linux, the kernel will only allow for a route to be installed when
its gateway is directly attached according the kernel fib.
There are cases when this restriction by the kernel is too strong, in
those cases, we deploy the RTNH_F_ONLINK netlink flag.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Change the datastructure for recursive routes. This brings the following
benefits:
By using struct nexthop also to store nexthops obtained by recursive
resolution, we can get rid of quite a bit of code duplication in the fib
management. (rt_netlink, rt_socket, ...)
With the new datastructure we can make use of all available paths when
recursive routes are resolved with multipath routes.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Linux removes IPv6 addresses when the interface is set down. Those
addresses need to be readded when the interface is set up again.
Also, an interface should not be reactivated from shutdown by configuring
an ip address.
Finally, remove the three-state logic for the shutdown setting as its
sole current use may be mild confusion.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Try to avoid changing connected state from zebra/interface.c as this
means making assumptions about kernel behaviour which may be or may
become wrong. This state should rather be updated by events from the
kernel.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
As there are timeframes when we don't get a notification from the kernel
about new addresses. (e.g. while Linux performs IPv6 DAD), we need to
have some information whether an address has been sent to the kernel or
not.
One case where this is relevant would be a user adding an IPv6 address,
but deleting it before DAD has been complete. With the next patch which
removes some (ill assuming) synchronous parts in address setup,
ipv6_address_uninstall would not know whether or not it has to actually
delete the prefix from the kernel. Resolving these windows where we lack
information is what the flag ZEBRA_IFC_QUEUED is intended for.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
The implementation in zebra and the zclient protocol allow to communicate
addresses to clients which are not yet in the kernel.
This is usually not done and most clients seem to expect an address to be
configured in the kernel when they receive it. Therefore, it seems
reasonable to issue a warning when advertising an address to the clients
that is not yet in the kernel.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
connected_implicit_withdraw is used at two places and followed by exactly
the same code. Move that code into connected_implicit_withdraw and give
that function a more descriptive name.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
To match the semantics of IPv4, the ZEBRA_IFC_CONFIGURED flag
should be cleared when an IPv6 connected is uninstalled via
vty.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Enhance if_subnet_delete so it will complain about improper use.
Also, fix one occurence of improper use where it was called for
IPv6 as well.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Because of a change of semantics in the Linux kernel, information
about changes made by zebra itself was not considered for updates.
This change should fix this by accounting for the new semantics.
It is based on a patch by lich posted to the bugzilla #486
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Since commit ba281d3d040, ospfd uses NEXTHOP_IPV4_IFINDEX
routes. The API between zebra and bgpd which is used to query
nexthops for recursive routes did not support this nexthop
type and therefore, ospf changes (or any other IGP changes
which use NEXTHOP_IPV4_IFINDEX) would never trigger any
recursive route update.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
so net.core.rmem_max must not be adjusted. Requires
linux kernel >= 2.6.14, falls back to SO_RCVBUF on error
Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Not only was there a minor typo in the "pragma weak" preprocessor
checks, but also were the tests not behaving as needed - they only
indicated support for the /first/ method of implementing weak aliases,
which on Linux is __attribute__ and not #pragma.
* m4/ax_sys_weak_alias.m4: set defines for _all_ weak alias methods
* zebra/kernel_null.c: fix typo
Cc: Doug VanLeuven <roamdad@sonic.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Quagga makes bad assumptions about sockaddr_dl (on NetBSD, but possibly
on other systems as well). Particularly, sizeof(struct sockaddr_dl)
returns a size that does not include the full sdl_data field, leading to
not enough data being copied. This breaks IPv6 RAs in particular, as
a broken mac address from sockaddr_dl will be included in the packets.
From: Matthias-Christian Ott <ott@mirix.org>
Tested-by: Uwe Toenjes <6bone@6bone.informatik.uni-leipzig.de>
[further simplified + more comments]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
zebra was not checking afi/safi values. This was leading to crashes where
these values were coming directly from some protocol's on-wire fields.
Safeguarding them in zebra is a good start.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Change default value of variable NL_PKT_BUF_SIZE to 8192UL. Cf.
NLMSG_GOODSIZE definition of linux in include/linux/netlink.h for detail.
Previously, on platforms with a page size greater than 8192, if you had added
too many interfaces, zebra would not have enough buffer space to get the entire
interface list. This resulted in an incomplete interface list.
From: 高鹏 <gpstrive@gmail.com>
[updated to apply after FPM patches]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
LLVM clang does not support #pragma weak (bug 3679) on OS X. There are
other systems where the #pragma weak has varying syntax.
Added m4 file from the autoconf archives:
http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html
Fix up zebra/*_null.c files to use #pragma weak alias or stub functions
if not available. It's incomplete in that the different format #pragma
enable easier fixes on need.
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit) using
gcc & clang. Tested on linux 64bit.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
automake file lists haven't quite kept up with recent changes, time to
fix them up so the dist tarball actually works...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* zebra/zebra_fpm_netlink.c
Change the zebra FPM code to include an interface index when
encoding a nexthop even if the protocol only provided a gateway
address (e.g, NEXTHOP_TYPE_IPV4).
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Enhance zebra to send routes to the (optional) Forwarding Path Manager
component using the interface defined by fpm/fpm.h.
* configure.ac
- Add --enable-fpm flag.
The FPM-related code in zebra is activated only if the build is
configured with '--enable-fpm'.
- Add HAVE_NETLINK automake conditional.
This allows us to conditionally build netlink-dependent C code.
* zebra/{rib.h,zebra_rib.c}
- Add the 'fpm_q_entries' field to the rib_dest_t structure. This
allows dests to be placed on the fpm queue.
- Define a couple new rib_dest_t flags that hold FPM-related
state.
- Invoke the zfpm_trigger_update() function for a route_node
whenever the information to be sent to the FPM changes.
- rib_can_delete_dest(): Return FALSE if we have to update the FPM
about the given dest. This ensures that the dest is not deleted
even if there are no ribs hanging off of it.
* zebra/zebra_fpm.c
This file holds most of the code for interacting with the FPM.
- If quagga was configured with '--enable-fpm', periodically try
to connect to the FPM.
- When the connection comes up, enqueue all relevent dests to the
FPM queue.
- When the FPM socket is readable, dequeue the next rib_dest_t
from the FPM queue, encode it in to a message and send the
message to the FPM.
- When the connection to the FPM goes down, remove all dests from
the FPM queue, and then start trying to connect to the FPM
again.
- Expose the following new operational commands:
show zebra fpm stats
clear zebra fpm stats
* zebra/zebra_fpm_netlink.c
- zfpm_netlink_encode_route(): Function to encode information
about a rib_dest_t in netlink format.
* zebra/zebra_fpm_private.h
Private header file for the zebra FPM module.
* zebra/zebra_fpm.h
Header file exported by zebra FPM module to the rest of zebra.
* zebra/debug.c
Add the 'debug zebra fpm' command.
* zebra/main.c
Initialize the zebra-FPM code on startup.
* zebra/misc_null.c
Add stub for zfpm_trigger_update().
* zebra/Makefile.am
- Include new file zebra_fpm.c in build.
- Include zebra_fpm_netlink.c in build if HAVE_NETLINK is defined.
* vtysh/Makefile.am
Include zebra_fpm.c in list of files that define cli commands.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* zebra/{rib.h,zebra_rib.c}
Add nexthop_type_to_str(), which returns a human-readable string
corresponding to a nexthop type.
* zebra/rt_netlink.[hc]
- Add new header file that exposes some existing and new
netlink-related functions from rt_netlink.c to the rest of
zebra.
addattr32
addattr_l
rta_addattr_l
nl_msg_type_to_str (new)
nl_rtproto_to_str (new)
- Use nexthop_type_to_str() instead of the static array
'nexthop_types_desc'.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
* lib/zebra.h
Add macro ZEBRA_NUM_OF, which returns the number of elements in a
static array.
* zebra/rib.h
Add the rib_tables_iter_t structure and associated functions,
which allow one to walk all tables in the rib.
* zebra/zebra_rib.c
- Add vrf_id_get_next() to retrieve the first VRF id (if any) that
is greater than a given VRF id.
- Add rib_tables_iter_next().
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Add some code that allows us to determine which VRF and AFI/SAFI a
given RIB table corresponds to.
* zebra/rib.h
Add rib_table_info_t structure, which contains information about
the VRF, AFI and SAFI that a table is for.
* zebra/zebra_rib.c
- Add the vrf_table_create() function, which creates a table and
sets its 'info' pointer to a newly created rib_table_info_t.
The 'info' pointer allows us to go from a route_node or a table
to the associated vrf.
- vrf_alloc(): Use vrf_create_table() to create tables.
* lib/memtypes.c
Add memory type for rib_table_info_t.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Add the rib_dest_t structure to hold per-prefix state in the routing
information base. This gives us an appropriate place to maintain the
queueing state of a route_node. Queuing state was previously being
stored on the first rib in the list of ribs hanging off the
route_node.
* zebra/rib.h
- Add new structure rib_dest_t.
- Remove the rn_status field from 'struct rib', it is no longer
required.
- Add macros (RNODE_FOREACH_RIB, RNODE_FOREACH_RIB_SAFE) for
walking all 'struct ribs' corresponding to a route_node. These
hide the fact that there is an intermediate rib_dest_t
structure.
- Add a few utility inlines to go between a rib_dest_t and
associated structures.
* zebra/zebra_rib.c
- rib_link()/rib_unlink()
Tweak for new behavior, where the 'info' pointer of a route_node
points to a rib_dest_t. The list of ribs for a prefix now hangs
off of the dest.
Change the way we ref count route_nodes. We now hold a single
ref count on a route_node if there is a corresponding
rib_dest_t.
- Maintain the queuing state of a route_node on the flags field of
the rib_dest_t.
- Add the rib_gc_dest() function, which deletes a rib_dest_t if it
is no longer required. A rib_dest_t can be deleted iff there are
no struct ribs hanging off of it.
- Call rib_gc_dest() any time we unlink a rib from the
rib_dest_t. Currently we only need to call it once, just before
we return from rib_process().
* zebra/{redistribute,zebra_rib,zebra_snmp,zebra_vty}.c
Use new macros to walk over route_node ribs.
* lib/memtypes.c
Add memory type for rib_dest_t.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
ifi_link_state missing in OS X. There could be other *BSD's that haven't
implemented it and possibly affects older implementations.
The existing HAVE_BSD_LINK_DETECT configure.ac check is only confirming
the link state detection using ifmediareq.ifm_status found in
<net/if_media.h>. This is the link state detection used in
zebra/ioctl.c. Later, *BSD redefined struct if_data in <net/if.h> and
included link state detection. This is the method used in
zebra/kernel_socket.c
Additional test defined in config.ac to test for member struct
if_data.ifi_link_state defined in <net/if.h> separate from test for
<net/if_media.h> ifmediareq.ifm_status
Fixed #ifdef's in zebra/kernel_socket.c to use the new #define
No impact on older function calls in zebra/ioctl.c
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit)
using gcc & clang. Tested on linux 64bit.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
In zebra/kernel_socket.c, copying sockaddr from *_msghdr:
There are really 2 different lengths that need to be determined.
1) the length required to point to the next sockaddr in the mesg
buffer which might include any required padding and
2) the actual length of the sockaddr data that needs to be copied
into the destination field.
They may or may not be the same value.
Sizeof sockaddr_in6 is 28, which to pad for alignment purposes on 32
bit systems with a long of 4 bytes is evenly divided and requires
no padding. On 64 bit systems, with a long of 8 it is padded with 4
extra bytes.So the current RTA_* macros are copying 32 bytes into a 28
byte field on 64 bitsystems, where the field overflow did not occur
on the 32 bit systems.
Since using sa_len required the use of an #ifdef which couldn't be used
directly inside a #define, it made sense to move the copy into the
function to allow typdef checking throughout and eliminate the hack
to suppress compiler warnings.
Fixed declaration of cp in ifm_read after compiler noticed type mismatch.
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit)
using gcc & clang
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
In OS X 10.7 zebra crashed on invalid execution address.
sockaddr padding in *_msghdr is observed to be 4 bytes in 64bit OS X.
The ROUNDUP macro assumed alignment on sizeof(long) which
allocates 8 bytes on 64bit systems, 4 bytes on 32bit systems
which is true for BSD generally.
Test for Apple and use sizeof(int) which allocates 4 bytes on 32 & 64bit
systems.
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit)
using gcc & clang
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
The linker on some systems (for example, Ubuntu 12.04 LTS x86_64)
appears to be sensitive to the order in which libraries are
specified. On these systems, if a library 'A' depends on a library
'B', it has to be specified before 'B' when linking an executable.
* zebra/Makefile.am: Make sure LIBCAP comes after libzebra.
* tests/Makefile.am: Ensure libm comes after libbgp.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Use the array_size() helper macro. Replaces several instances of local
macros with the same definition.
Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Make static routes respect non-default routing tables.
BEFORE PATCH
------------
! in zebra.conf
table 1
! add static route
vtysh> ip route 10.0.0.0/30 eth0
cumulus@net-top0:~$ ip route
default via 192.168.0.2 dev eth0
10.0.0.0/30 dev eth0 proto zebra
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15
! nothing in table 1
cumulus@net-top0:~$ ip route show table 1
AFTER PATCH
-----------
! in zebra.conf
table 1
! add static route
vtysh> ip route 10.0.0.0/30 eth0
cumulus@net-top0:~$ ip route
default via 192.168.0.2 dev eth0
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15
! static route in table 1
cumulus@net-top0:~$ ip route show table 1
10.0.0.0/30 dev eth0 proto zebra
Signed-off-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Actually implement the IPV4_IFINDEX nexthop type that has been drifting
around as a definition forever (without any warning about it being a
placeholder).
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
zebra address bookkeeping is a mess. this is just a workaround to have
IPv4 address deletion somewhat working on Linux.
the if_unset_prefix call is synchronous, when it returns success the
address deletion completed successfully. this is either signaled by a
netlink ACK or by an OK return value from ioctl().
This version is wrapped by #ifdef HAVE_NETLINK so we don't touch the
BSDs for now.
* zebra/interface.c: On Linux, update zebra internal state after
deleting an address.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
Most table handlers do not expect to be given an OID whose prefix is
outside what they can handle. This is not a problem with the SMUX
implementation since it always correct the OID such that the prefix
matches. However, this is not the case for the AgentX
implementation. A new function, smux_header_table() is used to do this
normalization.
|
|
The correct method to link to NetSNMP is to use net-snmp-config (which
is like pkg-config). Explicit link to libcrypto is also dropped
(NetSNMP libs are linked to libcrypto, no need to link Quagga to
it). Moreover, @SNMP_INCLUDES@ is dropped because useless. Due to a
bug in configure.ac, it was properly populated.
|
|
NetSNMP is the only SNMP implementation for Quagga. We don't need two
different symbols.
|
|
Some .h files in lib/ are autogenerated. The search path should
include the build directory and the source directory. They usually
match but sometimes, they may be different. For example:
$ mkdir build
$ cd build
$ ../configure
$ make
|
|
let's ground the rtadv.h file if route advertisements are disabled. And
fix up the CLI for it, as well as move the "show ip mroute" to its
proper place.
* zebra/rtadv.h: #ifdef RTADV
* zebra/main.c: #ifdef RTADV
* zebra/zebra_vty.c: move "show ip mroute" out of #ifdef IPV6
From: Joachim Nilsson <troglobit@gmail.com>
[moved #ifdef RTADV to rtadv.h]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
The SAFI_MULTICAST RIB needs to contain Connected routes so that the
nexthop lookup does not fail and so that multicast routing daemons do
not need to sidestep and look into SAFI_UNICAST to be aware of connected
subnets.
* zebra/connected.c: add & delete connected in SAFI_MULTICAST
Signed-off-by: G.Balaji <balajig81@gmail.com>
[merged add/delete patches]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
The memory is always written before sending. Clearing it before use
slows netlink_route_multipath() down considerably and it's pretty
noticeable in a full-internet table scenario loading.
* zebra/rt_netlink.c: subtract bulk buffer size from clear
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* lib/sockunion.c,
* zebra/zebra_rib.c: replace ->sin.sin_addr.s_addr with sockunion2ip
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Metrics are unsigned values.
* bgpd/bgp_{debug,route,vty}.c,
* zebra/zebra_vty.c: replace %d with %u for metrics & distances
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
[reworded commit message]
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
This reverts commit af56d404cd56d94ad3b2ec3f159650eb72baef0a,
which was accidentally duplicating functionality from commit
2ea1ab1 "zebra: ZEBRA_HELLO and mopping up routes (BZ#448)"
Conflicts:
zebra/zebra_rib.c
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
Increase the maximum number of nexthops per route by using a larger
buffer for netlink messages.
* zebra/rt_netlink.c: Use a buffer of 4096 bytes to parse/build
netlink messages. Add a hash define for this number
(NL_PKT_BUF_SIZE). Most places in the code were previously using a
buffer of 1024 bytes.
|
|
The steps were:
$ git checkout google-is-is
$ git merge quagga
$ git checkout google-is-is -- isisd
# Resolve conflicts in the following:
lib/md5.h
zebra/rt_netlink.c
zebra/zebra_rib.c
zebra/zserv.c
Note that the content in the isisd directory is left unchanged in the
merge. As a result, changes made to isisd as part of the following
commits on the quagga mainline are dropped.
# 8ced4e82 is the merge base, e96b3121 is the current quagga master
$ git log --oneline --reverse 8ced4e82..e96b3121 -- isisd
5574999 isisd: fix crash on "no router isis" (BZ#536)
8998075 isisd: raise hello rate for DIS (BZ#539)
306ca83 isisd: include hash.h, not hash.c
b82cdeb delete CVS keywords
2f65867 isisd: indent longopts array
b511468 quagga: option "-z" ("--socket <path>") added
05e54ee build: delete .cvsignore files
b4e45f6 fix zebra protocol after MP-BGP changes
7fd6cd8 isisd: fix circuit state machine
907fd95 isisd: send proper LSP after DIS election
d034aa0 isisd: fix wrong next-hops from SPF
c25eaff isisd: unexpected kernel routing table (BZ#544)
e6b03b7 isisd: implement MD5 circuit authentication
|