Age | Commit message (Collapse) | Author |
|
* 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
|
|
Change interface up/down notification messages to also include the
hardware address of the interface. The format of these messages is now
identical to the interface add message -- move the serialization code
to common functions.
* lib/zclient.c: Modify zebra_interface_if_set_value() to also parse
the hardware address. Invoke it from zebra_interface_add_read()
and and zebra_interface_state_read().
* zebra/zserv.c: Add zserv_encode_interface(). Invoke it from
zserv_interface_add(), zserv_interface_delete() and
zserv_interface_update().
|
|
* zebra/zebra_rib.c: Add code to clean up routes added by a client
(as identfied by 'rib type').
* zebra/zserv.[ch]: Maintain the type of the routes added by a
client on the 'zserv' structure -- assume that a given client uses
a single route type for now.
Clean up routes from a client when the client goes away (in
zebra_client_close()).
From: Josh Bailey <joshb@google.com>
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* zebra/zebra_rib.c: (rib_queue_add, rib_queue_init) Add some more
logs and asserts.
From: Subbaiah Venkata <svenkata@google.com>
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* zebra/zserv.c
- zread_ipv4_delete(): Pass a null 'gate' parameter to
rib_delete_ipv4() if the route being deleted does not specify a
next hop IP address. We were previously passing a pointer to a
cleared out IP address.
- zread_ipv4_add(): Fix indentation.
From: Subbaiah Venkata <svenkata@google.com>
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
* zebra/rt_netlink.c:
- Pick up the hardware address of an interface when we receive a
netlink link change message. Extract code for parsing the
link-layer hardware address into a new function so we can reuse
it.
- netlink_routing_table(): Update to handle multipath routes.
- netlink_route_change(): Update to handle multipath routes. Fix
problem where the metric was not being read out.
* zebra/zebra_rib.[ch]: Extern nexthop_ipv4_ifindex_add() -- it is
now called from the netlink code.
From: Josh Bailey <joshb@google.com>
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@diac24.net>
|
|
|
|
* Initial import of the Babel routing protocol, ported to Quagga.
* LICENCE: Update the original LICENCE file to include all known potentially
applicable copyright claims. Ask that any future contributors to babeld/
grant MIT/X11 licence to their work.
* *.{c,h}: Add GPL headers, in according with the SFLC guidance on
dealing with potentially mixed GPL/other licensed work, at:
https://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
|
ipv6 nd ra-interval
ipv6 nd ra-lifetime
ipv6 nd reachable-time
ipv6 nd home-agent-preference
ipv6 nd home-agent-lifetime
ipv6 nd router-preference
Calls to atoi() and atol() are replaced with VTY_GET_INTEGER_RANGE()
macro, command patterns are clarified and aliases of some commands
are added for consistency. Other changes are listed below.
* zebra/rtadv.c
* ipv6_nd_ra_interval_msec(): resolve -Wsign-compare
* ipv6_nd_ra_interval(): idem
* rtadv_init(): update to list new aliases
* doc/ipv6.texi: update to match current implementation
|
|
RFC2461 was replaced by RFC4861
RFC3775 was replaced by RFC6275
draft-ietf-mip6-mipext-advapi-03 was replaced by RFC4584
|
|
rtadv_prefix.prefix was casted to "struct prefix_ipv6" and had the same
size, make it exactly this type to make the code a bit cleaner.
|
|
RFC4861 4.6.2. Prefix Information
Prefix An IP address or a prefix of an IP address. The
Prefix Length field contains the number of valid
leading bits in the prefix. The bits in the prefix
after the prefix length are reserved and MUST be
initialized to zero by the sender and ignored by
the receiver.
* rtadv.c
* ipv6_nd_prefix(): add missing call to apply_mask_ipv6()
* no_ipv6_nd_prefix(): idem
|
|
There was a regression introduced with the previous commit:
"ipv6 nd home-agent-lifetime 1800000" appeared by default in every
interface section of running-config, although this command is
invalid in this context. Troubleshooting and bugfixing of the issue
tracked out several bugs in router advertisement procedures, some of
which are fixed in this commit.
* zebra/interface.c
* if_zebra_new_hook(): update to treat -1 as "uninitialized"
* nd_dump_vty(): idem
* zebra/rtadv.c
* rtadv_send_packet(): update processing of "router lifetime" field,
"home agent" option and "home agent lifetime" field to conform to
RFC6275 better
* ipv6_nd_ra_interval_msec(): update MaxRtrAdvInterval range check,
make sure it never exceeds (initialized) AdvDefaultLifetime
* ipv6_nd_ra_interval(): idem
* ipv6_nd_ra_lifetime(): update AdvDefaultLifetime range check, make
sure it never falls below MaxRtrAdvInterval
* ipv6_nd_homeagent_lifetime(): update HomeAgentLifetime range check
* no_ipv6_nd_ra_lifetime(): update to treat -1 as "uninitialized"
* no_ipv6_nd_homeagent_lifetime(): idem
* rtadv_config_write(): idem
|
|
The following options could be configured for an interface, but were
never visible in the config text:
ipv6 nd adv-interval-option
ipv6 nd home-agent-preference
ipv6 nd home-agent-lifetime
ipv6 nd home-agent-config-flag
|
|
|
|
warning: too many arguments for format [-Wformat-extra-args]
|
|
This patch contains the following:
1. Addition of IPv6 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the RTM's RIB.
|
|
This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the RTM's RIB.
|
|
This implements a new "ipv6 nd mtu <1-65535>" interface-level command.
* doc/ipv6.texi: add description
* zebra/rtadv.c
* rtadv_send_packet(): send option type 5, when configured
* ipv6_nd_mtu(): new VTY helper
* no_ipv6_nd_mtu(): ditto
* rtadv_config_write(): add new option
* rtadv_init(): list new helpers
|
|
* (general) Move functions in headers into files, to be compiled into
shared object files. Remove inline qualifier from functions. Let the
compiler do the work.
|
|
|
|
When the same ip address is used on several interfaces,
and one of them gets deleted (or equivalent: set to down and
then address removed), rib_delete_ipv[46] will also remove
the connected route from other interfaces.
rib_delete_ipv[46] is called twice when an interface is
deleted:
- for the "ifdown" event
- for the address removal
(note: this may be specific to the netlink interface of linux)
The second call does not find the connected route to that same
ifindex anymore, but deletes similar connected routes to any
other ifindex instead.
Reason: the ifindex check is on the same level as the check
for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. If everything
matches except for the ifindex, the "else" part (intended for
different route types) is executed, thus removing the route
from the wrong interface.
fix: move ifindex check inside the "then" part of the check
for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. Now connected
routes to other ifindexes will not spill over to the "else"
part for different route types anymore.
|
|
ZEBRA_HELLO message is used by routing daemons to inform zebra
what type of routes daemon will be announcing to zebra. Also
zebra uses route_type_oaths array to track which daemon announces
which protocol. Zebra mops up routes if daemon didn't for some
reason.
|
|
(This patch was modified to leave calls to stream_getl() in place, they
are necessary for the stream's internal pointer to advance to the
correct position. -- Denis)
Signed-off-by: Denis Ovsienko <infrastation@yandex.ru>
Fix gcc warnings about varables that are set but never used.
* bgpd/bgp_attr.c
* cluster_unintern(): ret
* transit_unintern(): ret
* bgp_attr_default_intern(): attre
* bgp_mp_reach_parse(): rd_high, rd_low
* bgpd/bgp_route.c
* bgp_announce_check_rsclient(): bgp
* bgpd/bgp_zebra.c
* zebra_read_ipv4(): ifindex
* zebra_read_ipv6(): ifindex
* bgpd/bgpd.c
* bgp_config_write_peer(): filter
* lib/distribute.c
* distribute_list_all(): dist
* distribute_list(): dist
* distribute_list_prefix_all(): dist
* distribute_list_prefix(): dist
* lib/if_rmap.c
* if_rmap(): if_rmap
* lib/vty.c
* vty_accept(): vty
* lib/zclient.c
* zclient_read(): ret
* zebra/irdp_interface.c
* if_group(): zi
* zebra/rt_netlink.c
* kernel_read(): ret, sock
|
|
this replaces most occurences of routing protocol lists by preprocessor
defines from route_types.h. the latter is autogenerated from
route_types.txt by a perl script (previously awk). adding a routing
protocol now is mostly a matter of changing route_types.txt and log.c.
Conflicts:
lib/route_types.awk
|
|
redistribute is currently limited to "known" protocols. there is no
reason for this limitation, so, remove it.
|
|
adding protocols and forgetting to update zebra_rib.c currently causes
a beyond end of array access for the default distance value. fix by
making 150 the default distance for unknown routing protocols.
150 is higher than all other IGPs but lower than iBGP (200)
|