summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2012-07-19lib: make IPv6 prefix parser slightly more strictDavid Lamparter
This makes it possible to have both "show babel route A.B.C.D/M" and "show babel route X:X::X:X/M" commands at the same time without the parser complaining about ambiguity. * lib/command.c: only accept STATE_DOT after : was seen. Reported-by: Juliusz Chroboczek <jch@pps.jussieu.fr> 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-25agentx: handle SNMP trapsVincent Bernat
smux_trap() signature has been changed to provide appropriate level information to send SNMPv2 notifications. This includes the addition of the enterprise OID to use (from which is derived the SNMP trap OID) and the MIB registry to locate the appropriate function for variable bindings provided by the trap. The SMUX implementation has been updated but ignore the provided enterprise OID. Instead, it still uses the SMUX peer OID to keep compatibility with previous versions of Quagga. The SMUX implementation also ignores the provided MIB registry since it uses smux_get() function to grab the appropriate values. This is not possible with the AgentX implementation since there is no such function provided by NetSNMP.
2012-06-25smux: drop findVar element from trap object structVincent Bernat
This element was not unused.
2012-06-25smux: remove `tick` argument from smux_trap()Vincent Bernat
smux_trap() contains an argument whose use appears to be to set sysUpTime.0/timestamp field in SNMP trap. However, this value is not used in smux_trap(). Moreover, it is expected that this field is the value of sysUpTime.0 when the trap was sent and not any other time related to the trap. To avoid any confusion, we remove this field from the signature of the function.
2012-06-25agentx: add AgentX support to Quagga.Vincent Bernat
--enable-snmp will enable AgentX support in Quagga. SMUX is still here and can be enabled with --enable-snmp=smux. AgentX support can be enabled with "agentx" in configuration file. As for SMUX, this command is not understood by vtysh. It can be disabled with "no agentx", though there is no real use of this since this command cannot be used with vtysh. If "agentx" and "no agentx" command were added to vtysh, it would not be possible to disable agentx support after enabling it because NetSNMP does not expose the appropriate methods for this. The internals of AgentX are hidden by NetSNMP. Therefore, we don't have a file descriptor to add to the threading system. We do not have the timers to set either. Therefore, the event loop is modified to make use of snmp_select_info() from NetSNMP. Traps are not supported yet.
2012-06-25smux: isolate SMUX implementation from SNMP implementationVincent Bernat
lib/snmp.c gets OID related helper functions that can be used with another SNMP interface. smux.h is cleaned of SMUX specific bits to only expose functions that may be used by an alternative implementation. We also do not redefine functions already present in NetSNMP. Just use the appropriate headers.
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-06-14lib: Add back sockunion_str2suPaul Jakma
* sockunion.h: Add back sockunion_str2su, its removal breaks things needlessly (e.g. our own unit tests). * sockunion.c: (sockunion_str2su) implement on top of str2sockunion.
2012-05-22lib: do not allocate/free thread funcnamesJorge Boncompte [DTI2]
This avoids memory heap fragmentation and imposses less load on the system memory allocator. * thread.h: FUNCNAME_LEN defined to 64 (ISO C99 says max 63) Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> [changed FUNCNAME_LEN to a less arbitrary value] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22lib: micro-op for thread_get()Jorge Boncompte [DTI2]
thread_trim_head() already checks that the list is not empty. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22lib: remove RUSAGE_T from struct threadJorge Boncompte [DTI2]
* thread.c: It's only temporarily used in thread_call() to calculate the diffs. Saves 80 bytes per copy. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22micro-op bgp_node_[get|lookup]() and route_node_[get|lookup]()Jorge Boncompte [DTI2]
Reduce indirection for values that doesn't change in the loop. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> [adjusted after dropping previous patch] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-22bgpd: optimize bgp_nexthop_self()Jorge Boncompte [DTI2]
This function scores 2nd, profiling a full internet table load. It's called for every prefix received. Instead of looping in the interface lists comparing addresses use a hash to mantain them. * bgpd.c: Init the own address hash. * bgp_nexthop.c: Introduce methods to maintain an own address hash. (bgp_connected_add) add addresses to the hash. (bgp_connected_delete) delete addresses from the hash. (bgp_nexthop_self) lookup addresses in the hash. Removed the unused afi_t parameter. * bgp_route.c: (bgp_update_main) Micro-optimization, rearranged condition to not lookup the hash for bogus nexthops (0.0.0.0 or a class D/E address) Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-21lib: fix thread_cancel_event()Jorge Boncompte [DTI2]
ospfd was crashing some times on neighbour going down. The cause was that ospf_nsm_event() was accessing already freed memory in ospf_nbr_delete() call from ospf_nsm_event(). What happens is that since commit b5043aab (lib: fix incorrect thread list...) now a thread can be on the event and ready lists but thread_cancel_event() doesn't account for that. * thread.c: (thread_cancel_event) loop on the ready list too to cancel pending events. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-21lib: drop heuristic IPv6 address recognitionRoman Hoog Antink
* command.c: (cmd_ipv6_match) Drop IPv6 address recognition heuristics and solely rely on inet_pton, because strings like "abcd" were mistaken for IPv6 addresses. This affects e.g. the command "neighbour WORD peer-group", which won't work with words consisting of up to 4 characters between 'a' and 'f' and digits. From: Roman Hoog Antink <rha@open.ch> [full delete instead of #if 0] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-02lib: remove sockunion related unused definitionsJorge Boncompte [DTI2]
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> 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: Fix memory leak of some "show ip bgp neighbor" commandsJorge Boncompte [DTI2]
sockunion_str2su() use is prone to memory leaks. Remove it's use all over the code. At least these commands leaked a sockunion union: - show ip bgp vpnv4 ... routes - show ip bgp ... received prefix-filter Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-02lib: remove last uses of sockunion_su2str()Jorge Boncompte [DTI2]
Use of this function is prone to memory leaks. This fixes a memory accounting bug for vty denied connections. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-05-02bgpd: Fix memory leak with 'set ip next-hop peer-address'Jorge Boncompte [DTI2]
A route-map with the mentioned statement causes a memory leak for every prefix that matches. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-20lib: bump ZSERV_VERSION to 2David Lamparter
continually changing the zserv protocol without bumping up the version number has made it impossible to talk to zebra without knowing the exact version. in reality, increasing the version number more often guards against inadvertedly running incompatible versions of a daemon and zebra as well as aids external development. * lib/zclient.h: #define ZSERV_VERSION 2 Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-16isisd: merge osr/google-is-isDavid Lamparter
this is essentially half of a rewrite of isisd. please note that a lot of things are still broken and isisd is not ready for production use.
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-09Merge branch 'quagga' into google-bgp-multipathAvneesh Sachdev
Conflicts: bgpd/bgp_route.c
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-08lib: Tweak to if_delete_retain()Josh Bailey
* lib/if.c: Change if_delete_retain() to delete all connected addresses, but to not free the list that holds them. Free the list just before the interface structure itself is freed, in if_delete().
2012-04-07isisd: add Google's changes to IS-ISJosh Bailey
2012-04-07lib: add stream_set_endp()Subbaiah Venkata
* lib/stream.[ch]: - Add stream_set_endp(). This can be used to trim data (for example, padding) at the end of a stream. - Fix swapped 'getp' and 'endp' parameters in STREAM_WARN_OFFSETS. From: Subbaiah Venkata <svenkata@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-07lib: add support for keyed-hashing with MD5Josh Bailey
* lib/md5.[ch] Add implementation of HMAC-MD5 from RFC 2104. From: Josh Bailey <joshb@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-07lib: Tweaks to linked list macrosJosh Bailey
* lib/linklist.h - Change the listnextnode, listhead and listtail macros so that they allow the list pointer to be NULL. - Modify the ALL_LIST_ELEMENTS* macros such that they clear the data pointer at the beginning and end of the loop. From: Josh Bailey <joshb@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-04lib: pretty ip_masklen and masklen2ipDavid Lamparter
nonwithstanding any desire for optimisation, these versions are shorter and more concise. reading the comments, they might even be easier to understand. I've tested them on i686 and x86_64, and checked that correct assembler code is emitted for ARM, MIPS and PowerPC. IPv6 is left as an exercise for another day, none of the ideas I had led to a "yes, this is the one to go with" solution. Signed-off-by: David Lamparter <equinox@diac24.net>
2012-04-04Revert "lib: optimize ip_masklen()" (BZ#720)David Lamparter
This reverts commit d171bf58ef12ace43d48565e6870722dece1e6ed. There are multiple reasons for this revert, including bug #720, but also quite simply the unreadability of having 2000 lines of an autogenerated table in the middle of a source file. Signed-off-by: David Lamparter <equinox@diac24.net> Reported-by: Martin Winter <mwinter@opensourcerouting.org>
2012-03-25memory: install babel memory informations.Matthieu Boutier
2012-03-25lib: update proto_redistnum() for BabelDenis Ovsienko
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-03-23lib: fix endianness bug in prefix.cRenato Westphal
While defining two "maskbytes" arrays for the respective endiannesses, the code was unconditionally using one that only worked on little endian systems. Use preprocessor macros to avoid the somewhat expensive htonl/ntohl macros. From: Renato Westphal <renatowestphal@gmail.com> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-02-28lib: fix incorrect thread list processing loopsPaul Jakma
* thread.c: (thread_timer_process,thread_process) thread_list_delete nulls thread->next. Loops need to save next first, or will only process the head. Problem noted by Lou Berger <lberger@labn.net>.
2012-02-21lib: fix logging of ZEBRA_HELLO messageDenis Ovsienko
2012-02-16lib: add THREAD_TIMER_MSEC_ON()Everton Marques
* lib/thread.h: new timer macro, millisecond precision (this was cherrypicked from pimd to isolate all non-contained changes) From: Everton Marques <everton.marques@gmail.com> Signed-off-by: David Lamparter <equinox@diac24.net>
2012-02-14isisd: implement MD5 circuit authenticationFritz Reichmann
* Replace command "isis passwd" with "isis passwd {clear|md5}" * Verify HMAC MD5 on ISIS Hello PDUs * Add HMAC MD5 authentication to md5.h/md5.c from RFC2104
2012-01-23bgpd: IPv6 MP-BGP Routes addition and deletionG.Balaji
This patch contains the following: 1. Addition of IPv6 SAFI_MULTICAST BGP routes into the BGP Multicast RIB. 2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
2012-01-23bgpd: IPv4 MP-BGP Routes addition and deletionG.Balaji
This patch contains the following: 1. Addition of IPv4 SAFI_MULTICAST BGP routes into the BGP Multicast RIB. 2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
2012-01-08lib: use prefix bit length macrosDenis Ovsienko
2012-01-06lib/if: trivial, fix rarely used if debug function to print everythingPaul Jakma
* if.c: (if_dump) loop that doesn't do anything, wants to be before the zlog of what it's meant to print out so all the connected addresses get printed out. Trival: just a debug function
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-02lib: fix some strtoul() use casesUlrich Weber
...otherwise 4294967295 is not a valid value on 32bit systems
2012-01-02lib: address type-punned pointers in prefix_same()Denis Ovsienko
IPV4_ADDR_SAME() wasn't passed the right union member, this could cause a bug due to strict-aliasing. IPV6_ADDR_SAME() case got its fix before the error could be created by macro upgrade.