summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_script.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bgpd: Convert `struct peer_connection` to dynamically allocatedDonald Sharp2023-08-181-1/+1
| | | | | | | | | | | | | | | | As part of the conversion to a `struct peer_connection` it will be desirable to have 2 pointers one for when we open a connection and one for when we receive a connection. Start this actual conversion over to this in `struct peer`. If this sounds confusing take a look at the bgp state machine for connections and how it resolves the processing of this router opening -vs- this router receiving an open. At some point in time the state machine decides that we are keeping one of the two connections. Future commits will allow us to untangle the peer/doppelganger duality with this abstraction. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Move status and ostatus to `struct peer_connection`Donald Sharp2023-08-181-1/+2
| | | | | | | The status and ostatus are a function of the `struct peer_connection` move it into that data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: Do not use time_t as a special Lua encoder/decoderDonatas Abraitis2023-08-011-3/+3
| | | | | | This is purely an integer (long long/long), and causes issues for 32-bit systems. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White2023-02-211-1/+2
|\ | | | | lib, bgp: add initial support for asdot format
| * bgpd: aspath list format binds on as-notation formatPhilippe Guibert2023-02-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each BGP prefix may have an as-path list attached. A forged string is stored in the BGP attribute and shows the as-path list output. Before this commit, the as-path list output was expressed as a list of AS values in plain format. Now, if a given BGP instance uses a specific asnotation, then the output is changed: new output: router bgp 1.1 asnotation dot ! address-family ipv4 unicast network 10.200.0.0/24 route-map rmap network 10.201.0.0/24 route-map rmap redistribute connected route-map rmap exit-address-family exit ! route-map rmap permit 1 set as-path prepend 1.1 5433.55 264564564 exit ubuntu2004# do show bgp ipv4 BGP table version is 2, local router ID is 10.0.2.15, vrf id 0 Default local pref 100, local AS 1.1 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 4.4.4.4/32 0.0.0.0 0 32768 1.1 5433.55 4036.61268 ? *> 10.0.2.0/24 0.0.0.0 0 32768 1.1 5433.55 4036.61268 ? 10.200.0.0/24 0.0.0.0 0 32768 1.1 5433.55 4036.61268 i 10.201.0.0/24 0.0.0.0 0 32768 1.1 5433.55 4036.61268 i The changes include: - the aspath structure has a new field: asnotation type The ashash list will differentiate 2 aspaths using a different asnotation. - 3 new printf extensions display the as number in the wished format: pASP, pASD, pASE for plain, dot, or dot+ format (extended). Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-15/+1
|/ | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: Make sure we pop the table from the stack when decoding struct attrDonatas Abraitis2022-03-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | ``` bgpd[81718]: bgpd/bgp_routemap.c:382: route_match_script(): assertion (lua_gettop(lfs->L) == 1) failed BGP[81718]: Received signal 6 at 1648554165 (si_addr 0x6e00013f36, PC 0x7fcc5adebce1); aborting... BGP[81718]: /usr/local/lib/libfrr.so.0(zlog_backtrace_sigsafe+0x5e) [0x7fcc5b1caf5e] BGP[81718]: /usr/local/lib/libfrr.so.0(zlog_signal+0xe6) [0x7fcc5b1cb136] BGP[81718]: /usr/local/lib/libfrr.so.0(+0xcd4b2) [0x7fcc5b1f54b2] BGP[81718]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x14140) [0x7fcc5af89140] BGP[81718]: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x141) [0x7fcc5adebce1] BGP[81718]: /lib/x86_64-linux-gnu/libc.so.6(abort+0x123) [0x7fcc5add5537] BGP[81718]: /usr/local/lib/libfrr.so.0(_zlog_assert_failed+0xd7) [0x7fcc5b21ecd7] BGP[81718]: /usr/lib/frr/bgpd(+0x162710) [0x55ed70255710] BGP[81718]: /usr/local/lib/libfrr.so.0(+0xc0e47) [0x7fcc5b1e8e47] BGP[81718]: /usr/local/lib/libfrr.so.0(route_map_apply_ext+0x4b6) [0x7fcc5b1eaaf6] BGP[81718]: /usr/lib/frr/bgpd(+0x13eb24) [0x55ed70231b24] BGP[81718]: /usr/lib/frr/bgpd(bgp_update+0x7db) [0x55ed7023f81b] BGP[81718]: /usr/lib/frr/bgpd(bgp_nlri_parse_ip+0x113) [0x55ed70241bc3] ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* bgpd: Update bgp_script encoders and decodersDonald Lee2021-06-211-6/+9
| | | | | | | | This is an example of creating encoders and decoders for user defined structs and registering them in the ENCODE_ARGS DECODE_ARGS macro in frrscript. Signed-off-by: Donald Lee <dlqs@gmx.com>
* build: HAVE_LUA -> HAVE_SCRIPTINGQuentin Young2020-12-021-1/+5
| | | | | | And also guard all scripting-related stuff with HAVE_SCRIPTING. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* bgpd: update routemap scripting exampleQuentin Young2020-12-021-0/+188
- Change from "match command <foo>" to "match script <script>" - Use new scripting API Signed-off-by: Quentin Young <qlyoung@nvidia.com>