summaryrefslogtreecommitdiff
path: root/zebra
AgeCommit message (Collapse)Author
2012-11-05zebra: kernel_socket: fix overflow in RTA_ADDR & RTA_ATTRDoug VanLeuven
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>
2012-11-05zebra: kernel_socket: fix 64bit MacOS X alignmentDoug VanLeuven
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>
2012-11-01build: reorder libraries to address linker errorAvneesh Sachdev
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>
2012-10-25*: use array_size() helper macroBalaji.G
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>
2012-10-25zebra: make static routes respect table settingNolan Leake
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>
2012-07-25zebra: Add support for ZEBRA_NEXTHOP_IPV4_IFINDEXJoakim Tjernlund
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>
2012-07-13zebra: lingering IP address after deletion (BZ#486)David Lamparter
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>
2012-06-25snmp: let handlers accept OID from a lesser prefixVincent Bernat
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.
2012-06-25build: use net-snmp-config to configure NetSNMPVincent Bernat
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.
2012-06-25build: only define HAVE_SNMPVincent Bernat
NetSNMP is the only SNMP implementation for Quagga. We don't need two different symbols.
2012-06-25build: allow configure and build in a separate directoryVincent Bernat
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
2012-05-09zebra: fix up compilation without rtadv/IPv6Joachim Nilsson
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>
2012-05-02zebra: feed Connected routes into MRIBG.Balaji
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>
2012-05-02zebra: no need to clear memory of the netlink buffersJorge Boncompte [DTI2]
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>
2012-05-02lib, zebra: extend use of sockunion2ip macroJorge Boncompte [DTI2]
* 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>
2012-05-02bgpd, zebra: Fix format for some metric outputsJorge Boncompte [DTI2]
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>
2012-04-20Revert "zebra: clean up client routes when client goes away"David Lamparter
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>
2012-04-16zebra: use larger buffer (4096) for netlink messagesJR Rivers
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.
2012-04-11Merge quagga mainline into the google ISIS code.Avneesh Sachdev
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
2012-04-08zebra: include hardware addr in if up/down messagesJosh Bailey
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().
2012-04-08zebra: clean up client routes when client goes awayJosh Bailey
* 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>
2012-04-07zebra: add more logs/asserts to rib work queue codeSubbaiah Venkata
* 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>
2012-04-07zebra: tweak deletion of routes without nexthop addrSubbaiah Venkata
* 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>
2012-04-07zebra: read multipath routes and hw addr from netlinkJosh Bailey
* 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>
2012-03-25zebra: Display uptime of Babel routes in show ip[v6] route.Juliusz Chroboczek
2012-03-25babeld: Initial import, for Babel routing protocol.Paul Jakma
* 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
2012-01-26zebra: justify rtadv VTY commands with argumentsDenis Ovsienko
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
2012-01-26zebra: freshen RFC references in rtadvDenis Ovsienko
RFC2461 was replaced by RFC4861 RFC3775 was replaced by RFC6275 draft-ietf-mip6-mipext-advapi-03 was replaced by RFC4584
2012-01-26zebra: use prefix_ipv6 in rtadv_prefixDenis Ovsienko
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.
2012-01-26zebra: clear host bits of ND RA prefix optionDenis Ovsienko
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
2012-01-26zebra: justify some IPv6 ND RA timers wrt RFCDenis Ovsienko
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
2012-01-26zebra: fix output of IPv6 ND RA optionsDenis Ovsienko
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
2012-01-23zebra: fix recent MP-BGP commits for FreeBSDDenis Ovsienko
2012-01-23zebra: Removal of the following warning messagesG.Balaji
warning: too many arguments for format [-Wformat-extra-args]
2012-01-23zebra: IPv6 MP-BGP Routes addition and deletionG.Balaji
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.
2012-01-23zebra: IPv4 MP-BGP Routes addition and deletionG.Balaji
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.
2012-01-20zebra: include MTU option in RA on request (BZ#665)Denis Ovsienko
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
2012-01-06general: remove inline qualifiers and move in-header functions to objectsPaul Jakma
* (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.
2012-01-02zebra: fix IPv6 RA wrt interface removal (BZ#480)Denis Ovsienko
2012-01-02zebra: fix ifindex test condition (BZ#487)Matthias Ferdinand
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.
2012-01-02zebra: ZEBRA_HELLO and mopping up routes (BZ#448)Vyacheslav Trushkin
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.
2011-12-18fix set never used warningsStephen Hemminger
(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
2011-12-13lib: put route_types.txt to real useDavid Lamparter
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
2011-12-13zebra: fix redistribution of new protocolsDavid Lamparter
redistribute is currently limited to "known" protocols. there is no reason for this limitation, so, remove it.
2011-12-13rib: default distance value for new protocols (v2)David Lamparter
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)
2011-12-13zebra: set the interface link-layer socket addressTom Goff
* kernel_socket.c: (ifm_read) The reorganization from commit 6fe70d1b35c189cb1e488b2c26551ba7baac6148 removed setting the interface link-layer socket address structure on routing socket platforms. This restores saving the link-layer information because it might be used elsewhere: rtm_write() when no gateway is given, if_dump_vty() and rtadv_send_packet().
2011-12-13zebra: spellingDenis Ovsienko
2011-12-13build: delete .cvsignore filesDenis Ovsienko
2011-12-13quagga: option "-z" ("--socket <path>") addedVyacheslav Trushkin
All daemons modified to support custom path to zserv socket. lib: generalize a zclient connection zclient_socket_connect added. zclient_socket and zclient_socket_un were hidden under static expression. "zclient_serv_path_set" modified.
2011-12-07zebra: fix warnings in forward procStephen Hemminger
Check result of fgets(), and don't set variable that is never used.