summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge Quagga master branch -- as of 1-Mar-2012 -- into euro_ix_bex21bChris Hall2012-03-171-204/+683
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Version 0.99.20ex21b This brings us up to date with: commit 48f99b0c2bfed8d3880732d188e1d5964f575ee4 Date: Thu Sep 29 16:55:23 2011 +0400 release: 0.99.20 and the subsequent: commit dc00d2bb56aa6a84dd2328133f69db3c3e6d9dc7 Date: Sun Jan 8 14:47:06 2012 +0000 Marker merge for 'RE-0.99.17.6' This marker merge (i.e. an 'ours' strategy merge) is a placeholder to show that all commits in Quagga-RE stable, to its release RE-0.99.17.6 tag, have been reviewed and merged into 'master'. and then further commits (in descending date order) commit b51a3a31500133e3e26f12e7639f297c655bc735 commit ef2d5d100431031c32ea35b3c834b46cff16f511 commit 4c78376f96cd2ca56f1c6476b76fd659654431f5 commit e854095932260b3e6187902aa9a7baa0e96b9428 commit e6b03b77766dce8009ad7b4a2392e14addf4ab0f commit c25eaffdb2190149e768dc4ee4efc913c6d02992 commit d034aa027ef44d0a74805c27ad2a4d8ea20395d1 commit 907fd95e502e10334e5390c73cc57588b88b8171 commit 7fd6cd819ff98f0580b745ba637990df9c20ef0f commit 4c0cf00afc4340a429a9c4830f638b4593d7c3af commit 4afa50b393ff1fb34dd577888a05b81dfdced5af commit 6eb0c5ab1d43bcf9edd4fefd19031f2b96ded728 commit aca43b656623f38dfa6ea835dacbdfec51d03a67 commit 6bb1273e83c29b3aeff9584bc8f6272e773294ad commit d660f698427277ce695a5b756f3143c8304274ea commit 6134b875f39986564aced5e2d7329fcd852f17f4 commit b4e45f67057be22133b6bec88cdf285d5c8214db commit 6eac79a6fed4842e00607c00c445213b51bba377 commit cb32fd690a957819865219a847e3c21a53a0f419 commit 73bfe0bd9adb8e4dfcee7239e56a425c6d58f4e9 commit f768f367bcd1f37a53c563495176a5a134caf234 commit c7ec179a95c1ed4fcd3d3be3f981c8c20dce534a commit cddf391bf6839e9f093cef15508669c1f3f92122 commit 5a616c08ce089e25dc0e8da920727af4d11279bf commit 6ae93c058725991df5a9ae35cefec368919b5fea commit fc98d16ea77372f4ab4231e8904f8467e8d1ef71 A summary of the changes that relate to bppd, zebra and the lib follows. bgpd changes * attribute handling: (a) now checks the flag byte for all attributes and issues suitable log messages and notifications, (b) reports some length issues that previously let slide (local pref). Tighten End-of-RIB detection -- now iff an MP_UNREACH is the *only* attribute and no ordinary update or withdraw. * added --socket/-z option -- sets zebra socket name * sets IPv6 tclass as required * improved next hop handling and added "show ip bgp scan" and "show ip bgpd scan detail" commands. see commits: fc98d16ea77372f4ab4231e8904f8467e8d1ef71 0e8032d69961ae196c11ba6ead856084c7acf7c2 b64bfc1c4a552fc0b4dd024d5f77171ec848a5df 318f0d8a7f5e8e87086bbf2a9e7c4b35638951ac 8e80bdf20f493a71bcf74262ed3aa3a2437f4df6 f04a80a5d209dbb54f6fec5d0149b7c0e489d29e * removed SAFI_UNICAST_MULTICAST * fiddled with SAFI_MPLS_LABELED_VPN -- unsure if this is now complete -- stuff here TODO ! * support for multicast SAFI see commits: 73bfe0bd9adb8e4dfcee7239e56a425c6d58f4e9 5a616c08ce089e25dc0e8da920727af4d11279bf * added "match probability" commands * uses "route_types.txt" more effectively -- which affects the implementation of "redistribute" commands see commit: e0ca5fde7be5b5ce90dae78c2477e8245aecb8e9 * "nexthop-local unchanged" included in configuration. zebra changes * some whitespace change clutter :-( * ZEBRA_HELLO and mopping up routes (BZ#448) * implement route_types.h * support for SAFI_MULTICAST commit f768f367bcd1f37a53c563495176a5a134caf234 IPv6 MP-BGP Routes addition and deletion commit cddf391bf6839e9f093cef15508669c1f3f92122 IPv4 MP-BGP Routes addition and deletion * brought up to date with RFC6275 * add --socket/-z option * add "ipv6 nd mtu <1-65535>" commands lib changes * filter-list handling -- does not free the filter-list before calling the delete_hook(). However, unlike commit 6a2e0f36b103386e57dbe3a6ee4716e809111198 *does* remove the filter-list from the name look-up, before calling the delete_hook() -- which I believe works better. * md5.c now includes RFC 2104 HMAC However fixed to remove compiler warning, by replacing use of caddr_t by unsigned char*. Some phantom whitespace changes elsewhere * prefix.c: commits d171bf58ef12ace43d48565e6870722dece1e6ed 051954f574b9c26458518a7029aeed118f0da620 9663386f16e6285a322747514527fdf1d19788e4 - optimise masklen2ip() and apply_mask_ipv4() -- the version here should work on a Big-Endian machine as well. - optimise ip_masklen() -- the version here should (a) work on a Big-Endian machine, (b) give the same result as before if the netmask is not, in fact, valid, and (c) uses just 256 bytes of table -- not 64K. Version here is probably not quite as fast as the previous patch... but certainly faster that what was there before. * zclient.c: introduced zclient_serv_path, for general zclient and for bgpd zlookup. Added ZEBRA_HELLO to client start. Added safi to ipv4 and ipv6 route add/delete.
| * lib: use prefix bit length macrosDenis Ovsienko2012-01-081-7/+7
| |
| * general: remove inline qualifiers and move in-header functions to objectsPaul Jakma2012-01-061-0/+15
| | | | | | | | | | | | * (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.
| * lib: address type-punned pointers in prefix_same()Denis Ovsienko2012-01-021-2/+2
| | | | | | | | | | | | 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.
| * lib: fix type-punning in ip_masklen()Denis Ovsienko2012-01-021-2/+7
| | | | | | | | | | ip_masklen() was likely to return incorrect results after being compiled with -fstrict-aliasing (-O2, -O3, -Os)
| * lib: optimize ip_masklen()Denis Ovsienko2012-01-021-25/+2076
| | | | | | | | | | | | | | | | | | | | | | | | | | The new implementation makes use of a 64KB mapping table, which makes it possible to compute masklen faster and with constant execution time. The map also allows for additional version of the function, which can detect errors in input argument. The previous implementation had a variable cost of execution, which depended on masklen in a non-linear manner, and at its worst (/31) was 4 times slower, than the new implementation. The only case of old function just slightly outperforming the new one is /0, which is of little practical interest.
| * Revert "lib: optimize apply_mask_ipv6()"Denis Ovsienko2012-01-011-7/+17
| | | | | | | | | | Experience with IPv4 counterpart of this function suggests, that this way of type-punning is likely to cause errors.
| * lib: optimize apply_mask_ipv6()Denis Ovsienko2011-12-131-17/+7
| |
| * lib: optimize apply_mask_ipv4()Denis Ovsienko2011-12-131-18/+3
| |
| * lib: make masklen2ip6() safer and fasterDenis Ovsienko2011-12-131-16/+135
| |
| * lib: fix endianness of masklen2ip()Denis Ovsienko2011-12-131-3/+39
| |
| * lib: make masklen2ip() safer and fasterDenis Ovsienko2011-12-131-16/+39
| |
| * lib: prefix2sockunion, prefix_common_bits helper functionsDavid Lamparter2011-11-211-0/+54
| | | | | | | | | | | | prefix2sockunion converts a struct prefix* to a union sockunion *; prefix_common_bits counts the number of common bits in the prefix's address part.
| * lib: prefix.c nano-optimisationPaul Jakma2010-12-081-4/+5
| | | | | | | | | | * lib/prefix.c: (prefix_match) nano-optimisation, let it return early without copying pointers.
| * bgpd, lib: adopt afi_t and safi_t in several placesMichael Lambert2010-10-061-2/+2
| | | | | | | | | | | | | | | | | | * bgpd/bgp_attr.c, bgpd/bgp_open.h, bgpd/bgp_route.c, lib/prefix.c, lib/prefix.h: Various integer types were being used where, if we had strict type checking, afi_t and safi_t would be required. Signed-off-by: G.Balaji <balajig81@gmail.com> (cherry picked from commit c8af35ffa2dc79ff7d7ff00b1b61f1f50a100ab6)
| * lib: make some structures constantStephen Hemminger2009-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * isisd/isis_pdu.c * maskbit: this pre-initialized array is not modified * lib/prefix.c * maskbit: idem * lib/command.c * facility_map: idem * itoa64: idem * default_motd: make local var static * facility_name(): update local var accordingly * facility_match(): idem
* | Fix bug in stream_put_ipv4()Chris Hall2012-02-241-0/+96
| | | | | | | | | | | | | | | | Revised stream functions and built more throrough test program for same. Introduced functions in prefix.c to support both stream_put_prefix() and stream_get_prefix() -- ensuring that does not exceed possible sizes and does not output or input any bits beyond the prefix length.
* | vtysh partly restored. bgpd not crashing on over-size messages.Chris Hall2012-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NB: this is a partial interim version -- NOT for production. Reinstate vtysh. In bgpd: cope better with generating oversize messages. The "pipework" branch is no more. There is now "euro_ix" and "euro_ix_b", where 'b' stands for 'bleedin'. The "pipework" is currently in 'bleedin'. Version updated to: 0.99.18ex20b Major changes in this commit: * modified bgpd to avoid crashing if an oversize message is created. At present, any oversize messages are simply discarded. This may be a mistake... since it is possible that some routes that should have been withdrawn are not. TBA. The stream lib facilities have been overhauled to may this easier. * restoring vtysh. At present the vtysh is thought to work, except that it does not currently create integrated configuration files. For the time being, *only* the following compile: lib, bgpd, zebra, vtysh, tests All other daemons will fail to compile, and must be disabled.
* | Bring "ex" version up to date with 0.99.18ex15pChris Hall2011-03-291-6/+7
| | | | | | | | | | | | | | | | | | Release: 0.99.18ex15p -- Pipework Branch Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.)
* | Creation of pipework branchChris Hall2010-12-211-23/+24
| |
* | Fix "neighbor xx peer-group" and "show bgp XX::"Chris Hall2010-12-141-66/+67
| | | | | | | | | | | | | | | | | | | | | | | | 1234567890123456789012345678901234567890123456789012345678901234567890 For an unknown reason "neighbor xx peer-group" returned a CMD_WARNING even when everything was fine. Fixed. "show bgp XX::" issued a spurious "address is malformed" error message. Fixed. Small change to AS_PATH handling to clarify the checking of as-segment lengths.
* | Bring up to date with 0.99.16 releaseChris Hall2010-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | This brings this branch up to date with 0.99.16, EXCEPT for the change to bgpd to use monotonic clock for timing updates. There are places where bgpd expects to find the actual time that things happened... so this change is not though to be complete. Further tidying in zebra, for FreeBSD.
* | Review and tidy new code and comments.Chris Hall2010-02-041-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows David Lamparter's code for update-source handling. modified: bgpd/bgp_connection.c modified: bgpd/bgp_connection.h modified: bgpd/bgp_fsm.c modified: bgpd/bgp_fsm.h modified: bgpd/bgp_msg_read.c modified: bgpd/bgp_msg_read.h modified: bgpd/bgp_notification.c modified: bgpd/bgp_notification.h modified: bgpd/bgp_peer.c modified: bgpd/bgp_peer.h modified: bgpd/bgp_session.c modified: bgpd/bgp_session.h modified: lib/prefix.c modified: lib/prefix.h
* | Fix return values for str2prefix_ipv4 and str2prefix_ipv6Chris Hall (GMCH)2009-11-261-32/+60
|/ | | | | | There appears to be some divergence of opinion over the return values from these functions. This change makes the return == 1 if OK, and 0 otherwise. This is consistent with all usage.
* lib/trivial: str2prefix checks return of inet_pton in fragile wayPaul Jakma2009-08-281-2/+2
| | | | | * prefix.c: (str2prefix_ipv6) inet_pton succesful return is presumed to be 1, rather than the "not zero" the man page describes - seemed fragile.
* 2005-07-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-07-261-4/+9
| | | | | | | | | | | | | * prefix.c: (prefix_ipv4_new, prefix_ipv6_new): Call prefix_new to allocate the memory to make sure that all struct prefix pointers point to objects of the same length (avoids memory overruns on struct prefix assignments). (prefix_ipv4_free, prefix_ipv6_free): Simply call prefix_free. It is interesting to note that these functions are never actually called anywhere in the code. Instead prefix_free was already being called directly, despite the previous MTYPE incompatibility. [backport candidate]
* 2005-07-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-07-261-1/+1
| | | | | | | * prefix.c: (ip_masklen) While loop should test that 'pnt' pointer is in range before dereferencing it. [backport candidate]
* 2005-05-06 Paul Jakma <paul@dishone.st>paul2005-05-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
* * prefix.[hc]: Pass argument to the inet6_ntoa by value making it morehasso2005-04-081-2/+2
| | | | | | inet_ntoa alike. * ripngd.[hc], ripng_interface.c, ripng_peer.c: inet6_ntoa() takes argument now by value.
* * lib/prefix.[hc]: inet6_ntoa utility function copied fromquagga_pre_listloop_cleanuphasso2005-04-051-0/+11
| | | | | | | | ripngd/ripngd.c (inet6_ntop). * ripngd.[hc]: Remove inet6_ntop() and any usage of it. inet6_ntoa() from lib is used now. * ripng_interface.c: inet6_ntop() -> inet6_ntoa(). * ripng_peer.c: inet6_ntop() -> inet6_ntoa().
* 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-081-1/+1
| | | | | | * prefix.c: (prefix_copy) Error message before abort should have severity LOG_ERR, not LOG_INFO. * memory.c: (mtype_log) Log level should be LOG_DEBUG, not LOG_INFO.
* OK. Here it is - PtP patch from Andrew J. Schorr. No problems with ospfd,hasso2004-10-191-2/+24
| | | | ripd might need some more testing though.
* First small part of lib cleanup. Mainly "constification" of arguments andhasso2004-10-041-22/+26
| | | | adding FIXME's.
* Explain the dual use of struct prefix for CIDR prefixes andgdt2004-01-131-3/+18
| | | | address/netmask pairs, and clarify the two comparison functions.
* Initial revisionpaul2002-12-131-0/+696