summaryrefslogtreecommitdiffstats
path: root/tests/bgpd/test_mp_attr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: Treat withdraw variable as a boolDonald Sharp2023-04-061-2/+2
| | | | | | Used as a bool, treated as a bool. Make it a bool Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-1/+1
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_master_XXX functions to event_master_XXXDonald Sharp2023-03-241-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-1/+1
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White2023-02-211-1/+2
|\ | | | | lib, bgp: add initial support for asdot format
| * bgpd: add as-notation keyword to 'router bgp' vty commandPhilippe Guibert2023-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new keyword permits changing the BGP as-notation output: - [no] router bgp <> [vrf BLABLA] [as-notation [<dot|plain|dot+>]] At the BGP instance creation, the output will inherit the way the BGP instance is declared. For instance, the 'router bgp 1.1' command will configure the output in the dot format. However, if the client wants to choose an alternate output, he will have to add the extra command: 'router bgp 1.1 as-notation dot+'. Also, if the user wants to have plain format, even if the BGP instance is declared in dot format, the keyword can also be used for that. The as-notation output is only taken into account at the BGP instance creation. In the case where VPN instances are used, a separate instance may be dynamically created. In that case, the real as-notation format will be taken into acccount at the first configuration. Linking the as-notation format with the BGP instance makes sense, as the operators want to keep consistency of what they configure. One technical reason why to link the as-notation output with the BGP instance creation is that the as-path segment lists stored in the BGP updates use a string representation to handle aspath operations (by using regexp for instance). Changing on the fly the output needs to regenerate this string representation to the correct format. Linking the configuration to the BGP instance creation avoids refreshing the BGP updates. A similar mechanism is put in place in junos too. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| * bgpd: store the bgp as identifier in the configured as-notationPhilippe Guibert2023-02-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preliminary work to handle various ways to configure a BGP Autonomous System. When creating a BGP instance, the user may want to define the AS number as a dotted value, instead of using an integer value. To handle both cases, an as_pretty char attribute will store the as number as it has been given to the vtysh command: router bgp <as number> Whenever the as integer of the BGP instance was dumped, the as_pretty original format is used. The json output reuses the integer value to keep backward compatibility with old displays. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-16/+1
|/ | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* tests: Correctly align variable type in testsDonald Sharp2022-04-271-1/+1
| | | | | | | | | | | 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>
* *: rework renaming the default VRFIgor Ryzhov2021-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* bgpd: rework BGP_MAX_PACKET_SIZE & friendsQuentin Young2021-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tests: Use BGP Extended Message lengthDonatas Abraitis2021-03-031-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* tests: tests for bgpd listing on multiple addressesAdriano Marto Reis2021-01-111-1/+1
| | | | | | | | * 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>
* tests: refactor Prefix-SID binary syntaxHiroki Shirokura2020-02-141-6/+13
| | | | Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* bgpd: refactor func prototype arround Prefix-SIDHiroki Shirokura2020-02-141-1/+1
| | | | | | mp_update value isn't used by the function arround Prefix-SID. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* bgpd: fix missing bounds checks for psid attrQuentin Young2020-01-031-1/+1
| | | | | | | | | | | 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>
* bgpd: use new defaults system (v2)David Lamparter2019-12-061-1/+1
| | | | | | | | | | | 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>
* bgpd: Add ability to set tcp socket buffer sizeDonald Sharp2019-10-161-1/+2
| | | | | | | | | | | 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>
* *: add a vrf update hook to be informed of the vrf namePhilippe Guibert2018-08-281-1/+1
| | | | | | | | 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>
* tests: Add a prefix-sid testDonald Sharp2018-05-031-3/+35
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* tests: Fix crash in test_mp_attrDonald Sharp2018-04-251-0/+4
| | | | | | | | | | | | | | | | 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>
* tests: add flowspec test with BGP MP_REACH/UNREACHPhilippe Guibert2018-03-301-1/+40
| | | | | | | 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>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* tests: fix warnings by removing dead codeRenato Westphal2018-02-021-91/+0
| | | | | | | | | | | | | 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>
* tests: add name to test_mp_attr threadmasterQuentin Young2017-11-301-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* tests: update tests for bgp_packet changesQuentin Young2017-11-301-5/+9
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib/bgpd: introduce the iana_safi_t enumRenato Westphal2017-08-011-1/+1
| | | | | | | 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>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-85/+73
| | | | | | | | | 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>
* *: reindent pt. 2whitespace / reindent2017-07-171-73/+85
| | | | | | | | w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-704/+1054
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: more `show thread cpu`Quentin Young2017-06-301-1/+1
| | | | | | | 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>
* Merge pull request #537 from donaldsharp/vrf_stuffDavid Lamparter2017-05-171-1/+1
|\ | | | | Vrf stuff
| * tests: Fix vrf_init to have correct callDonald Sharp2017-05-161-1/+1
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | *: 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>
* *: add frr_init() infrastructureDavid Lamparter2017-03-071-1/+1
| | | | | | | | | 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>
* tests: fix bgp print in testsPhilippe Guibert2017-02-141-1/+0
| | | | | | | | 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>
* tests: update bgp_nlri_parse function usage in bgp testingPhilippe Guibert2017-02-141-2/+2
| | | | | | | | 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>
* tests: reorganize tests hierarchicallyChristian Franke2017-02-081-0/+786
Signed-off-by: Christian Franke <chris@opensourcerouting.org>