summaryrefslogtreecommitdiff
path: root/tests/bgpd/test_mp_attr.c
AgeCommit message (Collapse)Author
2023-04-07bgpd: Treat withdraw variable as a boolDonald Sharp
Used as a bool, treated as a bool. Make it a bool Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit aa056a2a6481aba66c727794d0ee988724be9316)
2022-04-27tests: Correctly align variable type in testsDonald Sharp
New compilers are noticing that the tests are compiling with a pointer for the bgpd_privs variable while the bgp library that is being linked against is not a pointer. Since these tests had the declaration just to make the compiler happy, let's actually align the variable type to make the compiler even happier. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-12-21*: rework renaming the default VRFIgor Ryzhov
Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-06bgpd: rework BGP_MAX_PACKET_SIZE & friendsQuentin Young
BGP_MAX_PACKET_SIZE no longer represented the absolute maximum BGP packet size as it did before, instead it was defined as 4096 bytes, which is the maximum unless extended message capability is negotiated, in which case the maximum goes to 65k. That introduced at least one bug - last_reset_cause was undersized for extended messages, and when sending an extended message > 4096 bytes back to a peer as part of NOTIFY data would trigger a bounds check assert. This patch redefines the macro to restore its previous meaning, introduces a new macro - BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE - to represent the 4096 byte size, and renames the extended size to BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE for consistency. Code locations that definitely should use the small size have been updated, locations that semantically always need whatever the max is, no matter what that is, use BGP_MAX_PACKET_SIZE. BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE should only be used as a constant when storing what the negotiated max size is for use at runtime and to define BGP_MAX_PACKET_SIZE. Unless there is a future standard that introduces a third valid size it should not be used for any other purpose. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-03-03tests: Use BGP Extended Message lengthDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-01-11tests: tests for bgpd listing on multiple addressesAdriano Marto Reis
* Added a new topotest to test bgpd listening on multiple addresses. * Updated the existing bgpd tests according to the parameter added to bgp_master_init. Signed-off-by: "Adriano Marto Reis" <adrianomarto@gmail.com>
2020-02-14tests: refactor Prefix-SID binary syntaxHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2020-02-14bgpd: refactor func prototype arround Prefix-SIDHiroki Shirokura
mp_update value isn't used by the function arround Prefix-SID. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2020-01-03bgpd: fix missing bounds checks for psid attrQuentin Young
Guess what - for a bounds check to work, it has to happen *before* you read the data. We were trusting the attribute field received in a prefix SID attribute and then checking if it was correct afterwards, but if was wrong we'd crash before that. This fixes the problem, and adds additional paranoid bounds checks. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-06bgpd: use new defaults system (v2)David Lamparter
This moves all the DFLT_BGP_* stuff over to the new defaults mechanism. bgp_timers_nondefault() added to get better file-scoping. v2: moved everything into bgp_vty.c so that the core BGP code is independent of the CLI-specific defaults. This should make the future northbound conversion easier. Signed-off-by: David Lamparter <equinox@diac24.net>
2019-10-16bgpd: Add ability to set tcp socket buffer sizeDonald Sharp
Add -s X or --socket_size X to the bgp cli to allow the end user to specify the outgoing bgp tcp kernel socket buffer size. It is recommended that this option is only used on large scale operations. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-28*: add a vrf update hook to be informed of the vrf namePhilippe Guibert
The Vrf aliases can be known with a specific hook. That hook will then, from zebra propagate the information to the relevant zapi clients. The registration hook function is the same for all daemons. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-02tests: Add a prefix-sid testDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25tests: Fix crash in test_mp_attrDonald Sharp
Some recent changes in BGP now require that the peer's nexthop have a valid ifp when we are looking at: case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL: case BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL: This assumption makes sense for this type of Nexthop Attribute. So for the test let's jimmy up a `fake` enough interface pointer so that the actual test we can focus on what we are actually testing. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-30tests: add flowspec test with BGP MP_REACH/UNREACHPhilippe Guibert
This commit checks that the reception of MP_REACH and MP_UNREACH flowspec is handled correctly. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
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>
2018-02-02tests: fix warnings by removing dead codeRenato Westphal
These variables being removed were made obsolete by commit 9cabb64b3. As of now, the parse_test() function fetches the afi/safi values from the parsed NLRIs. There's no need to have duplicate information in the 'test_segment' structure anymore. This fixes several warnings of this kind when running "make check" on FreeBSD: "implicit conversion from enumeration type 'iana_safi_t' to different enumeration type 'safi_t'". Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-11-30tests: add name to test_mp_attr threadmasterQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-11-30tests: update tests for bgp_packet changesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-07-31lib/bgpd: introduce the iana_safi_t enumRenato Westphal
We had afi_t/iana_afi_t for AFIs but only safi_t for SAFIs. Fix this inconsistency. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-22Revert "*: reindent pt. 2"David Lamparter
This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindent pt. 2whitespace / reindent
w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-29lib: more `show thread cpu`Quentin Young
Add support for naming pthreads. Also, note that we don't have any records yet if that's the case. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-17Merge pull request #537 from donaldsharp/vrf_stuffDavid Lamparter
Vrf stuff
2017-05-15tests: Fix vrf_init to have correct callDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
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>
2017-03-07*: add frr_init() infrastructureDavid Lamparter
Start centralising startup & option parsing into the library. FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g. for killing the ZLOG_* enum, and having the daemon name available) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-14tests: fix bgp print in testsPhilippe Guibert
This commit is a fix from previous commit: Quagga: AFI/SAFI mappings IANA to/from internal values. It removes the printf that was used for troubleshooting the afi/safi change, in respect to testing. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-14tests: update bgp_nlri_parse function usage in bgp testingPhilippe Guibert
Because the bgp_nlri_parse function has been extended with one parameter, when doing bgp testing against some packets, the correct call to bgp_nlri_parse must be done. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-02-08tests: reorganize tests hierarchicallyChristian Franke
Signed-off-by: Christian Franke <chris@opensourcerouting.org>