summaryrefslogtreecommitdiffstats
path: root/lib/stream.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: Convert bgp_addpath_encode_[tr]x() to bool from intDonatas Abraitis2022-02-011-4/+3
| | | | | | Rename addpath_encode[d] to addpath_capable to be consistent. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* lib: add new stream function to reorganize bufferRafael Zalamena2020-11-241-0/+10
| | | | | | | The function was originally implemented for zebra data plane FPM plugin, but another code places could use it. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bgpd: support for DF election in EVPN-MHAnuradha Karuppiah2020-10-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DF (Designated forwarder) election is used for picking a single BUM-traffic forwarded per-ES. RFC7432 specifies a mechanism called service carving for DF election. However that mechanism has many disadvantages - 1. LBs poorly. 2. Doesn't allow for a controlled failover needed in upgrade scenarios. 3. Not easy to hw accelerate. To fix the poor performance of service carving alternate DF mechanisms have been proposed via the following drafts - draft-ietf-bess-evpn-df-election-framework draft-ietf-bess-evpn-pref-df This commit adds support for the pref-df election mechanism which is used as the default. Other mechanisms including service-carving may be added later. In this mechanism one switch on an ES is elected as DF based on the preference value; higher preference wins with IP address acting as the tie-breaker (lower-IP wins if pref value is the same). Sample output ============= >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> torm-11# sh bgp l2vpn evpn es 03:00:00:00:00:01:11:00:00:01 ESI: 03:00:00:00:00:01:11:00:00:01 Type: LR RD: 27.0.0.15:6 Originator-IP: 27.0.0.15 Local ES DF preference: 100 VNI Count: 10 Remote VNI Count: 10 Inconsistent VNI VTEP Count: 0 Inconsistencies: - VTEPs: 27.0.0.16 flags: EA df_alg: preference df_pref: 32767 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> torm-11# sh bgp l2vpn evpn route esi 03:00:00:00:00:01:11:00:00:01 *> [4]:[03:00:00:00:00:01:11:00:00:01]:[32]:[27.0.0.15] 27.0.0.15 32768 i ET:8 ES-Import-Rt:00:00:00:00:01:11 DF: (alg: 2, pref: 100) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
* Merge pull request #7046 from qlyoung/fix-various-integer-issuesRenato Westphal2020-09-051-0/+8
|\ | | | | Fix various integer signedness / overflow issues
| * lib: add stream_rewind_getp()Quentin Young2020-09-031-0/+8
| | | | | | | | | | | | | | stream_forward_getp() cannot be used with negative numbers due to the size_t argument, we'll end up doing overflow arithmetic. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* | lib: remove unused stream_get_data apiMark Stapp2020-09-031-1/+0
|/ | | | Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: add STREAM_FORWARD_[GET|ENDP]Quentin Young2020-08-151-0/+14
| | | | | | Safe stream macros for adjusting buffer pointers Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle2020-08-071-0/+8
| | | | | | | | | | | | | | | | | | | | For the sake of Segment Routing (SR) and Traffic Engineering (TE) Policies there's a need for additional infrastructure within zebra. The infrastructure in this PR is supposed to manage such policies in terms of installing binding SIDs and LSPs. Also it is capable of managing MPLS labels using the label manager, keeping track of nexthops (for resolving labels) and notifying interested parties about changes of a policy/LSP state. Further it enables a route map mechanism for BGP and SR-TE colors such that learned BGP routes can be mapped onto SR-TE Policies. This PR does not introduce any usable features by now, it is just infrastructure for other upcoming PRs which will introduce 'pathd', a new SR-TE daemon. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
* lib: fix STREAM_GETF macroEmanuele Di Pascale2020-06-221-1/+1
| | | | | | | | | a missing '!' operator was making any STREAM_GETF fail when in fact it should have succeeded. As a consequence of this, for example, many link-params of an interface were not being read and populated. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
* lib: add stream_fifo_init, more constMark Stapp2020-06-021-8/+22
| | | | | | | | Add utilities that init and deinit a stream_fifo - this lets us use an on-stack fifo in some places, avoiding malloc'ing. Also add const to some apis (no functional changes there). Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: stream_hexdump takes const structWesley Coakley2020-05-281-1/+1
| | | | Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* zebra, lib: bugfix on zebra packet debuggingWesley Coakley2020-05-281-0/+3
| | | | | | | `debug zebra packet detail` dumps the full message whereas it had been dropping exactly 10 bytes, the size of the zebra header Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
* lib: add STREAM_GETQ, STREAM_GETFQuentin Young2020-04-131-0/+20
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib, bgpd: Another round of `struct const prefix` cleanupDonald Sharp2020-03-261-1/+1
| | | | | | | Cleanup another set of functions that need to respect the const'ness of a prefix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd, lib: More `const`ification of various codeDonald Sharp2020-03-231-1/+2
| | | | | | | More second order effects of cleaning up rn usage in bgp. Sprinkle the fairy const's all over the place. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* isisd: fix a bunch of build warnings with GCC 10Ruben Kerkhof2020-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 10 thinks we memcpy into a 0-sized array (which we're not). Use a C99 flexible array member instead. Fixes: CC lib/stream.lo lib/stream.c: In function ‘stream_put_in_addr’: lib/stream.c:824:2: warning: writing 4 bytes into a region of size 0 [-Wstringop-overflow=] 824 | memcpy(s->data + s->endp, addr, sizeof(uint32_t)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ isisd/isis_tlvs.c: In function ‘auth_validator_hmac_md5’: isisd/isis_tlvs.c:4279:2: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=] 4279 | memcpy(STREAM_DATA(stream) + auth->offset, auth->value, 16); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘update_auth_hmac_md5’, inlined from ‘update_auth’ at isisd/isis_tlvs.c:3734:4, inlined from ‘isis_pack_tlvs’ at isisd/isis_tlvs.c:3897:2: isisd/isis_tlvs.c:3722:2: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=] 3722 | memcpy(STREAM_DATA(s) + auth->offset, digest, 16); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ isisd/isis_tlvs.c:3722:2: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=] Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* lib: use const in several stream lib apisMark Stapp2019-12-061-5/+8
| | | | | | Add some const to some stream apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: remove deprecated stream_resize apiMark Stapp2019-08-221-5/+0
| | | | Signed-off-by: Mark Stapp <mjs@voltanet.io>
* bgpd: tx addpath info for labeled unicastQuentin Young2019-08-061-1/+2
| | | | | | Labeled unicast needs path IDs too! Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: add extern "C" {} blocks to all libfrr headersRenato Westphal2019-02-121-0/+8
| | | | | | | These are necessary to use functions defined in these headers from C++. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: make atomic ops C++ compatibleDavid Lamparter2019-02-111-2/+2
| | | | | | | C++ doesn't have ISO C11 stdatomic.h or "_Atomic inttype", so use std::atomic instead to get the headers compatible. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib,bgpd: remove deprecated stream lib macrosMark Stapp2018-11-291-7/+0
| | | | | | | A couple of deprecated lib/stream macros have aged out; remove them, and replace the one remaining use. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* lib: Convert stream_new to use one mallocDonald Sharp2018-08-221-5/+6
| | | | | | | | | Modify stream.c to have stream_new call one malloc call instead of two. Also change stream_resize_orig to use stream_resize_inplace and to send an error to the developer to switch over. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Add stream_resize_orig and stream_resize_inplaceDonald Sharp2018-08-221-1/+8
| | | | | | | | | | | | | Start setup for handling of stream_resize into old and new functions. Create a stream_resize_inplace function that takes a double pointer to allow for a realloc operation to return the possibly moved pointer. Add a CONFDATE for removal as well. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: remove VERSION_TYPE_DEV from CONFDATE checksLou Berger2018-07-101-1/+1
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* lib, zebra: Add a bit of code to look at fifoDonald Sharp2018-06-281-0/+3
| | | | | | | When in a dev build add a bit of code to track max depth of a fifo and to allow zebra to report on it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: add mt-safe variants for stream_fifo opsQuentin Young2018-05-071-2/+91
| | | | | | | | | | stream_fifo is used as our standard internal message queue. Message queues are useful in multithreaded environments. Up until now I have been doing my own synchronization when using stream_fifo in this way; this patch gets rid of the need for that boilerplate and decreases the risk of locking mistakes when working with this datastructure. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Only test CONFDATE when VERSION_TYPE_DEV definedLou Berger2018-04-031-1/+1
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-22/+22
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-22/+22
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* *: don't use deprecated stream.h macrosQuentin Young2017-12-011-1/+6
| | | | | | | Some of the deprecated stream.h macros see such little use that we may as well just remove them and use the non-deprecated macros. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Add STREAM_GETX functionsDonald Sharp2017-11-131-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when stream reads fail, for any reason, we assert. While a *great* debugging tool, Asserting on production code is not a good thing. So this is the start of a conversion over to a series of STREAM_GETX functions that do not assert and allow the developer a way to program this gracefully and still clean up. Current code is something like this( taken from redistribute.c because this is dead simple ): afi = stream_getc(client->ibuf); type = stream_getc(client->ibuf); instance = stream_getw(client->ibuf); This code has several issues: 1) There is no failure mode for the stream read other than assert. if afi fails to be read the code stops. 2) stream_getX functions cannot be converted to a failure mode because it is impossible to tell a failure from good data with this api. So this new code will convert to this: STREAM_GETC(client->ibuf, afi); STREAM_GETC(client->ibuf, type); STREAM_GETW(client->ibuf, instance); .... stream_failure: return; We've created a stream_getc2( which does not assert ), but we need a way to allow clean failure mode handling. This is done by macro'ing stream_getX2 functions with the equivalent all uppercase STREAM_GETX functions that include a goto. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: fix be32 reading / 24-bit left shiftDavid Lamparter2017-09-091-0/+18
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-92/+88
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST tableDaniel Walton2017-06-161-1/+2
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> - All ipv4 labeled-unicast routes are now installed in the ipv4 unicast table. This allows us to do things like take routes from an ipv4 unicast peer, allocate a label for them and TX them to a ipv4 labeled-unicast peer. We can do the opposite where we take routes from a labeled-unicast peer, remove the label and advertise them to an ipv4 unicast peer. - Multipath over a labeled route and non-labeled route is not allowed. - You cannot activate a peer for both 'ipv4 unicast' and 'ipv4 labeled-unicast' - The 'tag' variable was overloaded for zebra's route tag feature as well as the mpls label. I added a 'mpls_label_t mpls' variable to avoid this. This is much cleaner but resulted in touching a lot of code.
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: labeled unicast processingDon Slice2017-04-061-1/+2
| | | | | | | | | Implement support for negotiating IPv4 or IPv6 labeled-unicast address family, exchanging prefixes and installing them in the routing table, as well as interactions with Zebra for FEC registration. This is the implementation of RFC 3107. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* Update Traffic Engineering Support for OSPFDOlivier Dugeon2016-09-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: I am squashing several commits together because they do not independently compile and we need this ability to do any type of sane testing on the patches. Since this series builds together I am doing this. -DBS This new structure is the basis to get new link parameters for Traffic Engineering from Zebra/interface layer to OSPFD and ISISD for the support of Traffic Engineering * lib/if.[c,h]: link parameters struture and get/set functions * lib/command.[c,h]: creation of a new link-node * lib/zclient.[c,h]: modification to the ZBUS message to convey the link parameters structure * lib/zebra.h: New ZBUS message Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support for IEEE 754 format * lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to safely convert between big-endian IEEE-754 single and double binary format, as used in IETF RFCs, and C99. Implementation depends on host using __STDC_IEC_559__, which should be everything we care about. Should correctly error out otherwise. * lib/network.[c,h]: Add ntohf and htonf converter * lib/memtypes.c: Add new memeory type for Traffic Engineering support Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add link parameters support to Zebra * zebra/interface.c: - Add new link-params CLI commands - Add new functions to set/get link parameters for interface * zebra/redistribute.[c,h]: Add new function to propagate link parameters to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering. * zebra/redistribute_null.c: Add new function zebra_interface_parameters_update() * zebra/zserv.[c,h]: Add new functions to send link parameters Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Add support of new link-params CLI to vtysh In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue to use the ordered version for adding line i.e. config_add_line_uniq() to print Interface CLI commands as it completely break the new LINK_PARAMS_NODE. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Update Traffic Engineering support for OSPFD These patches update original code to RFC3630 (OSPF-TE) and add support of RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support of RFC6827 (ASON - GMPLS). * ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering * ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392 * ospfd/ospf_packet.c: Update checking of OSPF_OPTION * ospfd/ospf_vty.[c,h]: Update ospf_str2area_id * ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get Link Parameters information from the interface to populate Traffic Engineering metrics * ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN) * ospfd/ospf_te.[c,h]: Major modifications to update the code to new link parameters structure and new RFCs Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> tmp
* lib: add 3-byte stream functionsDavid Lamparter2016-07-281-0/+4
| | | | | | This will be used for BGP MPLS labels. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* stream: remove unused stream_read_unblockStephen Hemminger2016-05-261-4/+0
| | | | | | | | The one place this was being used in BGP is now gone, can remove deprecated interface. Acked-by: Feng Lu <lu.feng@6wind.com> (cherry picked from commit 3790eb0d3f0bbb24b9c6be97f547cec144ee05d1)
* BGP: support for addpath TXDaniel Walton2015-11-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com Ticket: CM-8014 This implements addpath TX with the first feature to use it being "neighbor x.x.x.x addpath-tx-all-paths". One change to show output is 'show ip bgp x.x.x.x'. If no addpath-tx features are configured for any peers then everything looks the same as it is today in that "Advertised to" is at the top and refers to which peers the bestpath was advertise to. root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1' BGP routing table entry for 1.1.1.1/32 Paths: (6 available, best #6, table Default-IP-Routing-Table) Advertised to non peer-group peers: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8) Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 8 Last update: Fri Oct 30 18:26:44 2015 [snip] but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis: superm-redxp-05# show ip bgp 1.1.1.1/32 BGP routing table entry for 1.1.1.1/32 Paths: (6 available, best #6, table Default-IP-Routing-Table) Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 8 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:44 2015 Local, (Received from a RR-client) 34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 7 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 6 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 5 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 4 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1) Origin IGP, metric 0, localpref 100, valid, internal, best AddPath ID: RX 0, TX 3 Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8) Last update: Fri Oct 30 18:26:34 2015 superm-redxp-05#
* BGP: Add dynamic update group supportDonald Sharp2015-05-201-0/+3
| | | | | | | | | | | | | | | | | | | | This patch implements the 'update-groups' functionality in BGP. This is a function that can significantly improve BGP performance for Update generation and resultant network convergence. BGP Updates are formed for "groups" of peers and then replicated and sent out to each peer rather than being formed for each peer. Thus major BGP operations related to outbound policy application, adj-out maintenance and actual Update packet formation are optimized. BGP update-groups dynamically groups peers together based on configuration as well as run-time criteria. Thus, it is more flexible than update-formation based on peer-groups, which relies on operator configuration. [Note that peer-group based update formation has been introduced into BGP by Cumulus but is currently intended only for specific releases.] From 11098af65b2b8f9535484703e7f40330a71cbae4 Mon Sep 17 00:00:00 2001 Subject: [PATCH] updgrp commits
* bgpd: efficient NLRI packing for AFs != ipv4-unicastPradosh Mohapatra2014-06-031-0/+11
| | | | | | | | | | | | | | | | | | | | | ISSUE: Currently, for non-ipv4-unicast address families where prefixes are encoded in MP_REACH/MP_UNREACH attributes, BGP ends up sending one prefix per UPDATE message. This is quite inefficient. The patch addresses the issue. PATCH: We introduce a scratch buffer in the peer structure that stores the MP_REACH/MP_UNREACH attributes for non-ipv4-unicast families. This enables us to encode multiple prefixes. In the end, the two buffers are merged to create the UPDATE packet. Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com> [DL: removed no longer existing bgp_packet_withdraw prototype] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: add stream_set_endp()Subbaiah Venkata2012-04-071-0/+1
| | | | | | | | | | | | | * 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>
* [lib] trivial: add const qualifier to stream_put/writePaul Jakma2008-06-071-2/+2
| | | | | | | 2008-06-07 Paul Jakma <paul@jakma.org> * stream.{c,h}: (stream_{put,write}) add const qualifier to source argument. Change u_char to void *.
* [c++] remove/rename some names in headers that clash with C++ reserved wordsPaul Jakma2008-02-261-1/+1
| | | | | | | | | | | 2008-01-30 Peter Szilagyi <sp615@hszk.bme.hu> * lib/stream.h: Remove named 'new' parameter in prototype for c++ header compatibility. * ospfd/ospf_opaque.h: ditto * ospfd/ospfd.h: Renamed struct export to _export for c++ header compatibility. * ospf6d/ospf6_area.h: ditto
* [stream] Add quad-word support and stream_resizepaul2006-01-101-3/+14
| | | | | | | | | | | | 2006-01-10 Paul Jakma <paul.jakma@sun.com> * stream.c: (stream_new) Allocate stream data as seperate object. (stream_free) free the data. (stream_resize) new function, resize stream to new size. (stream_{get,put}q*) new functions to get/put quad word size types. * stream.h: (struct stream) make data seperate from the stream. Export new stream_resize and quad-word get/put functions.
* [c99] change gcc zero-length array to C99 flexible array declarationpaul2005-11-261-1/+1
| | | | | | | | | 2005-11-26 Paul Jakma <paul.jakma@sun.com> * buffer.c: (struct buffer_data) change gcc zero array declaration to C99 incomplete array. * stream.h: (struct stream) same * ospf_api.c: (struct opaque_lsa) same
* 2005-05-06 Paul Jakma <paul@dishone.st>paul2005-05-061-49/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | * (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
* 2005-05-03 Paul Jakma <paul@dishone.st>paul2005-05-031-7/+8
| | | | | | | | | | | * stream.h: Add comment about the special zero-ing ability of stream_put. (stream_recvmsg, stream_write) should return ssize_t and size_t respectively. Should both be extern linkage. (stream_recvfrom) Stream aware wrapper around recvfrom, in style of stream_read_try. * stream.c: (stream_recvfrom) new function, wrapper around recvfrom. (stream_recvmsg, stream_write) ssize_t and size_t return values