Commit Graph

30451 Commits

Author SHA1 Message Date
Russ White
962ae985ee
Merge pull request #12515 from opensourcerouting/fix/show_ip_bgp_detail_weird_output
bgpd: Show the real prefix for `show bgp detail`
2022-12-27 15:05:55 -05:00
Russ White
16aa1809e7
Merge pull request #11127 from louis-6wind/bgp-leak
bgpd: multiple fixes for route leaking
2022-12-27 14:51:28 -05:00
Jafar Al-Gharaibeh
f616e71608
Merge pull request #12560 from opensourcerouting/fix/allow_agentx_for_frr-reload
tools: Ignore agentx command for frr-reload.py
2022-12-24 19:48:21 -06:00
Jafar Al-Gharaibeh
3cb40f8000
Merge pull request #12561 from opensourcerouting/feature/update_snmp_documentation
doc: Add an example of how to query SNMP for BGP
2022-12-24 19:45:48 -06:00
Mark Stapp
54798a99ac
Merge pull request #12564 from sysoleg/evpn-doc-fix
doc: Fix EVPN documentation minor error
2022-12-23 16:17:24 -05:00
Oleg A. Arkhangelsky
b9450ff104 doc: Fix EVPN documentation minor error
Signed-off-by: Oleg A. Arkhangelsky <sysoleg@yandex.ru>
2022-12-23 17:49:01 +00:00
Donatas Abraitis
8431489f74
Merge pull request #12551 from proelbtn/fix-install-srv6-local-routes
bgpd: Fix announce SRv6 locally-generated routes to Zebra
2022-12-23 14:51:46 +02:00
Donatas Abraitis
7126fa3d66
Merge pull request #12555 from anlancs/fix/bgp-debug-info
bgpd: fix one wrong debug log for evpn
2022-12-22 21:24:32 +02:00
Donatas Abraitis
cef8b8591d doc: Add an example of how to query SNMP for BGP
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-22 18:25:50 +02:00
Donatas Abraitis
4a9ea00a27 tools: Ignore agentx command for frr-reload.py
agentx can't be disabled once enabled, so we should ignore it for frr-reload.py.

```
$ /usr/lib/frr/frr-reload.py --reload /etc/frr/bgpd.conf --bindir /usr/local/bin
"no agentx" we failed to remove this command
SNMP AgentX support cannot be disabled once enabled
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-22 17:55:40 +02:00
Rafael Zalamena
cb8d1c5598
Merge pull request #12557 from donaldsharp/getenv_two_times
vtysh: Remove double retrieve of env VTYSH_HISTFILE
2022-12-21 16:13:23 -03:00
Donald Sharp
aaa18e0e6f
Merge pull request #12540 from manojvn/489527
ospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackh…
2022-12-21 08:20:31 -05:00
Donald Sharp
6d980c40b0
Merge pull request #12553 from opensourcerouting/fix-sa-warnings
bgpd: fix static analyzer warning
2022-12-21 08:09:02 -05:00
Donald Sharp
99a9f25ce8 vtysh: Remove double retrieve of env VTYSH_HISTFILE
The code is double checking the VTYSH_HISTFILE env variable,
additionally clang-15 when running SA over it doesn't fully
understand the code pattern.  Reduce the double check to
one check to reduce program run-time (ha!) and make SA happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-21 08:04:34 -05:00
anlan_cs
4d67f4fc5f bgpd: fix one wrong debug log for evpn
Take it into consideration for one debug log:
EVPN MAC-IP routes with a L3 NHG id, has no nexthops.

Not "delete", but "add".

Before:
```
Tx route delete VRF 21 192.168.30.253/32 metric 0 tag 0 count 0 nhg 72580649
```

After:
```
Tx route add VRF 21 192.168.30.253/32 metric 0 tag 0 count 0 nhg 72580649
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-12-21 11:22:55 +08:00
Donald Sharp
11a98193dc
Merge pull request #12552 from Jafaral/rel-notes
Release housekeeping
2022-12-20 15:49:15 -05:00
Rafael Zalamena
105331a3c6 bgpd: fix static analyzer warnings
Use `DEFPY` to provide the `struct prefix` required by the debug
insertion functions. While here exchange `int` with `bool` where
appropriated.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-20 15:44:02 -03:00
Donatas Abraitis
43203ba63a
Merge pull request #12518 from patrasar/pim_minor_issue
pimd: Fix (S,G) debug issue
2022-12-20 18:21:07 +02:00
Russ White
a1347aa90c
Merge pull request #12539 from donaldsharp/bgp_debug_prefix_mem_leak
bgpd: When allocating prefix, free it when we are already tracking it
2022-12-20 11:20:19 -05:00
Russ White
e30e0fee81
Merge pull request #12531 from opensourcerouting/feature/snmp_tests
bgpd: SNMP IPv6 tests and some fixes
2022-12-20 11:19:10 -05:00
Russ White
971930a5f6
Merge pull request #12543 from donaldsharp/ospf_json_mem_leak
ospfd: Fix some json mem leaks and some issues
2022-12-20 11:15:28 -05:00
Russ White
babe0800d3
Merge pull request #12527 from opensourcerouting/ospf-spf-leak2
ospfd: fix SPF table memory leak
2022-12-20 11:12:23 -05:00
Jafar Al-Gharaibeh
2e7e3f8a70 debian, redhat: updating changelog for new release
8.4 Release Overview

- New BGP [command](https://docs.frrouting.org/en/latest/bgp.html#clicmd-neighbor-A.B.C.D-X-X-X-X-WORD-soo-EXTCOMMUNITY) (`neighbor PEER soo`) to configure SoO to prevent routing loops and suboptimal routing on dual-homed sites.
- Command `debug bgp allow-martian` replaced to `bgp allow-martian-nexthop` because previously we allowed using martian next-hops when debug is turned on.
- Implement `BGP Prefix Origin Validation State Extended Community` [rfc8097](https://datatracker.ietf.org/doc/rfc8097/)
- Implement `Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages` [rfc9234](https://datatracker.ietf.org/doc/rfc9234/)
- BMP L3VPN support
- PIMv6 support
- MLD support
- New [command](https://docs.frrouting.org/en/latest/basic.html#clicmd-allow-reserved-ranges) to enable using reserved IPv4 ranges as normal addresses for BGP next-hops, interface addresses, etc.
- As usual, lots of bugs and memory leaks were fixed \m/

Changelog
---------

**babeld**
  - Ignore Sub-TLV's with mandatory bit set
  - Ignore unicast Hello's

**bfdd**
  - Add IPv4 BFD Echo support
  - Add RTT to BFD IPv4 Echo packet processing
  - Allow L3 VRF BFD sessions without UDP leaking

**bgpd**
  - Add `mpls bgp forwarding` to ease MPLS-VPN EBGP peering
  - Add `bgp allow-martian-nexthop` command (remove `debug bgp allow-martian`)
  - Add `neighbor soo` command
  - Add `no rpki` command
  - Add `show bgp access-list` command to filter routes by access-list
  - Implement [rfc8097](https://datatracker.ietf.org/doc/rfc8097/)
  - Implement [rfc9234](https://datatracker.ietf.org/doc/rfc9234/)
  - Add resolution for L3VPN traffic over GRE interfaces
  - Allow setting custom port for BGP unnumbered peers
  - Allow statistics gathering to give more data about prefix lengths
  - Apply conditional advertisements policy to update-group
  - Associate appropriate family for redistributed connected addresses
  - Avoid notify race between io and main pthreads
  - Call a hook when as-path filter is replaced
  - Cleanup memory leaks associated with t_deferral_timer
  - Do not check if the whole as-path has target asn when using as-override
  - Do not print new line for EVPN CLI outputs if it's a JSON
  - Do not show polling_period default value in CLI for RPKI
  - Don't advertise conditionally withdrawn routes
  - Drop SSH public key for RPKI CLI option
  - Fix `show bgp nexthop a.b.c.d`
  - Fix for `aggregate-address summary-only matching-med-only`
  - Fix inconsistencies with default-originate route-map
  - Fix memory leak for `as-override`
  - Fix memory leak for `set as-path replace` route-map command
  - Fix memory leak for community alias
  - Fix memory leak for community stuff
  - Fix memory leak in SRv6 locator
  - Fix memory leak when an SRv6 sid is removed
  - Fix memory leak when setting [l]community at the egress
  - Fix route-map update and delete route-map
  - Fix `show bgp l2vpn evpn route rd` crash
  - Fix the wrong next-hop BGP struct for next-hop validation
  - Fixed BMP VPNv4 monitoring are withdrawn instead of updates
  - Fixup PBR rule changes that were missed
  - Fixup some MAC address token CLI syntax
  - Free ecommunity before returning on warning/error
  - Free memory for as-path filter if regexp is wrong
  - Free memory for BMP listeners when deleting BGP instance
  - Generate RPKI CLI config even if no cache servers are configured
  - Handle origin validation state extended community via route-map match
  - Handle route-refresh requests received before EOR
  - Implement retain route-target all behavior
  - Improve labelpool performance at scale
  - Inconsistencies in snt counters with default-originate
  - Prevent memory leak of the listener on shutdown
  - Print peer's hostname for BGP (filtering) messages
  - Print source VRF name when leaking to another VRF
  - Release RCU lock in BGP keepalive pthread
  - Reset BGP sessions when changing the port
  - Send route updates when modifying access/aspath/prefix lists
  - Set TTL for iBGP/eBGP by checking only if generic TTL security applied
  - Show cache server preference in `show rpki cache-server` output
  - Show extended communities memory consumption
  - Show TTL value unconditionally for neighbors
  - Start conditional advertisement timer instantly
  - Stop conditional advertisements thread when terminating
  - Stop LLGR thread when deleting a peer and/or gr flags changed
  - Treat as withdraw if we receive as path with as_set / as_confed_set
  - When specifying listen address for BGP we shouldn't imply no-fib flag
  - Withdraw implicitly old paths from VRFs when import/export list changes
  - Ensure that bgp open message stream has enough data to read
  - Notify BGP conditional advertisement thread when the peer goes down

**bmp**
  - Add an interface source to BMP connect command
  - Add L3VPN support

**eigrpd**
  - VRF variable name hides a parameter of the same name

**fabricd**
  - Turn off excessive logging when peering will not come up

**isisd**
  - Ensure rcap is freed in error case
  - Fix crash with xfrm interface type
  - Fix memory leak on shutdown with prefix lists
  - Fix prefix-sid last-hop-behavior

**ldpd**
  - Check if the thread is scheduled before calling for remained time

**lib**
  - Abstract usage of '%pnhs' so that next-hop groups can use it too
  - Add errno details to the sockopt_reuseaddr API
  - Add sys_rawio to the capabilities definitions
  - Allow downgrade of all caps when none are specified
  - Allow using ipv4 (class e) reserved block if enabled
  - Check hostname in resolver_resolve
  - Cleanup red-herring memleaks in the parent of daemonizing fork
  - Ensure ls_msg2edge does not use memory after freeing
  - Fix `show route-map name json` command and memory leak
  - Fix memory leak in `zclient_send_localsid()`
  - Fix skip of every other plist deletion
  - Fixup workqueue.c to use the proper thread.h semantics
  - Function `crypt` does not need to be declared mid function
  - Increase next-hop flags size to 16 bits
  - Prevent uninitialized usage of data
  - Remove usage of inet_ntop in lib/sockopt.c
  - Require at least 2.1.42 version of sysrepo when compiling
  - Return 0 as the remaining msec if the thread is not scheduled
  - stream_dup memory alloc cannot fail
  - Update sysrepo code with the latest API changes
  - Use pi4 instead of inet_ntop in sockopt.c

**nhrpd**
  - Use frr_weak_random()
  - Use nhrp_interface_update_nbma when source VRF was changed

**ospf6d**
  - Don't remove the summary route if it is a range
  - Ensure that ospf6d does not memcpy beyond the end of the data
  - Fix missing cost change
  - Permit route delete without next-hops
  - Remove ospf6enabled from JSON output

**ospfd**
  - Add how many packets the interface has queued to send
  - Add router-id support to OSPF API
  - Added CLIs to change default timers for lsa refresh and maxage remove delay.
  - Adding per neighbor JSON details to gr helper detail command
  - Crash when router acts as gr helper upon a topo change
  - Fix `show ip ospf neighbour <nbrid>` command
  - Increase packets sent at one time in ospf_write
  - Refactor fifo_flush for the interface
  - Remove deprecated command `graceful-restart helper-only`
  - When a neighbor goes down clear the oi->obuf if we can
  - Catch and report too small LSAs
  - Remove assert on zero length LSA - which is permitted by spec
  - Fix bug where acks were not be generated to incoming P2P/P2MP neighbors

**pathd**
  - `no mpls-te on` command was not working
  - Add a zebra stop handler
  - Change the vty output, when no ted is enabled on pathd
  - Ensure the path is free'd after we no longer need it
  - Nai adjacency fix query type f for IPv5

pim6d
  - (*,g) mroutes not learnt after pim6d daemon restart
  - Lots of CLI changes regarding MLD
  - Lots of CLI changes regarding PIMv6
  - Clear interface stats on interface shutdown
  - Disable pim6d compilation by default
  - Don't enable MLD on pimreg interface
  - Fix the code for MLD in the show pim state command
  - mroute stuck in register state, multicast traffic getting drops
  - Register message getting dropped in the source node, mroute stuck in regj
  - Send register msg with IPv6 global address
  - Update last_member_query_interval and last_member_query_count
  - Use ttable for displaying show commands
  - Deleting the memory malloced for JSON
  - Adding JSON support for show ipv6 next-hop
  - Send register msg via register socket
  - Change the show running commands based on the address family
  - Set rp to true if the address matches, ignore prefix-length

**pimd**
  - Allow v6 to do non-integrated configuration
  - Assign a vty port value for v6
  - Cleanup rpf lookup debug to help us figure out what is going on
  - Correct the order of show JSON for interface traffic
  - During prune pending, behave as noinfo state
  - Fix invalid memory access join_timer_stop
  - Fix memleak in bfd profile
  - Fix PIM interface deletion flow
  - Fix static mroute to also take into account the input interface
  - Fix the setting of oif_flags in channel oil
  - Fix unaligned accesses
  - Handle receive of (*,g) register stop with src addr as 0
  - Igmp querier election is not correct in lan scenario
  - JSON support for next-hop
  - Let the end operator know the ifindex as well in the failure case
  - Limit PIM's ECMP to what zebra tells us is the multipath
  - Querier to non-querier transition to be ignored
  - Register stop message sent with mask 32
  - Show interface traffic even if the interface is currently `down`
  - Update mroute iif based on next-hop received from zebra
  - VRF may be null from pim_cmd_lookup_vrf

**ripd**
  - Use a sequence number instead of a time

**sharpd**
  - Fix memory leak in release-locator-chunk
  - Fix memory leak in release-locator-chunk
  - Fix memory leaks related to SRv6 next-hops

**staticd**
  - When changing the underlying nh ensure it is reinstalled

**tools**
  - Add missing bfdd to logrotate config
  - Add pim6d to tools so that pim6d will work properly
  - Fix boot config load in watchfrr
  - Stop zebra daemon last

**vtysh**
  - Account validity should be verified when authenticating users with pam
  - Add autocomplete for VRFs when using with `router bgp`
  - Handle SIGTSTP (c-z) without exiting the vty shell
  - Ignore `end` when parsing frr.conf
  - Properly handle `[no] service cputime-stats` in config
  - Properly handle `service cputime-warning xx` in the config
  - Add `allow-reserved-ranges` global command

**watchfrr**
  - Check that the operational timeout specified is good

**zebrad**
  - Fixing log flooding when disabling MLAG leaf configuration
  - Add a `mpls enable` interface node command
  - Add a configurable knob `zebra nexthop-group keep (1-3600)`
  - Add a timer to next-hop group deletion
  - Add ability for netconf dplane to handle global values
  - Add interface sysctl ignore on linkdown status
  - Add more cases to proto2zebra for understanding kernel routes
  - Add some more data to rtadv socket failures
  - Add support for maintaining local neigh entries
  - Add tc handlers in the script code
  - Add tc netlink and dplane ops
  - Allow kernel routes to stick around better on interface state changes
  - Attempt to make ioctl.c have a bit more useful log messages
  - Avoid buffer overflow using netlink_parse_rtattr_nested()
  - Cleanup the memory from the hash for MPLS stuff
  - Create a zebra_rib_route_entry_new function and use it
  - Debug decode rta_expires and rta_mfc_stats
  - Delete the malloced memory under `show zebra`
  - Don't install connected routes multiple times into frr
  - Expand PBR rule action for data-plane programming
  - Explicitly call out the correct queue name
  - Fix bond down for EVPN-MH
  - Fix bug in netconf handling where dplane would drop the change
  - Fix crash in shutdown w/ pw thread still running
  - Fix ctab calculation typo in tc netlink
  - Fix FPM crash
  - Fix lost memory on lsp free
  - Fix memory leak in srv6 locator delete
  - Fix memory leaks and use after frees in nhg's on shutdown
  - Fix missing tenant VRF change notification
  - Fix missing VNI transition
  - Fix remaining mr rtm_getroute oddities
  - Fix rtadv startup when config read in is before interface up
  - Free neighbor state before the exit to avoid memleaks
  - Handle freebsd routing socket enobufs
  - Iif/oif are not used in mr rtm_getroute
  - Infrastructure for the new dataplane plugin
  - Initialize hw via DPDK
  - Introduce early route processing on the metaq
  - Mc_forwarding was being sent but not retrieved across dataplane
  - Notice when an interface is turned on w/ mpls and enable mpls subsystem
  - On Linux let interface data come in through netlink messaging
  - Pass AFI received for netconf updates
  - Pass PBR expanded actions to the dataplane
  - Pbr DPDK programming
  - Reconfiguring netns for VRF is not a failure
  - Rtnetlink: flow attr per gateway attr in multipath updates
  - Setup the zebra interface to the DPDK port map table
  - System routes should be processed the same time as the kernel
  - Use default ns directly in tc dplane
  - When deleting next-hop group entries ensure the thread is off
  - When saving nhg for later stop processing

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2022-12-20 09:53:59 -06:00
Donald Sharp
f9f19fef9d ospfd: Fix some json mem leaks and some issues
a) if show_function happened to be NULL we would leak json memory
b) json_lsa_type was being allocated but only used in the default case, leaking memory
c) json output would sometimes produce text output and that is incorrect

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-20 08:45:51 -05:00
Donald Sharp
11bf2747ef bgpd: When allocating prefix, free it when we are already tracking it
Several functions had this pattern:

a) p = prefix_new
b) if (already_tracking)
      return

Let's just stop allocating the prefix and use a prefix on the
stack, especially since the function used to hold the value
actually copies it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-20 08:39:29 -05:00
Donald Sharp
f147ca860b
Merge pull request #12549 from opensourcerouting/fix/bgp_packet_attribute_forward_null
bgpd: Check if bgp_path_info is not NULL when setting AIGP metric TLV
2022-12-20 08:14:47 -05:00
Rafael Zalamena
9bf19426e0 ospfd: fix SPF table memory leak
After `free()`ing a table also set it to NULL so when the instance
release function is called we know whether the pointer is valid or not.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-12-20 08:51:13 -03:00
Rafael Zalamena
bcf4d02b84
Merge pull request #12541 from manojvn/dbdesc_recv
ospf6d: Fixing memory leak in ospf6_lsa_create_headeronly for both
2022-12-20 08:37:16 -03:00
Donatas Abraitis
27bb782a98 bgpd: Adopt show bgp detail-routes command for L3VPN outputs as well
```
unet> sh pe2 vtysh -c 'sh ip bgp ipv4 vpn detail-routes'
BGP table version is 4, local router ID is 10.10.10.20, vrf id 0
Default local pref 100, local AS 65001
Route Distinguisher: 192.168.2.2:2
BGP routing table entry for 192.168.2.2:2:10.0.0.0/24, version 1
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, metric 0, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022
BGP routing table entry for 192.168.2.2:2:172.16.255.1/32, version 2
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022
BGP routing table entry for 192.168.2.2:2:192.168.1.0/24, version 3
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022
BGP routing table entry for 192.168.2.2:2:192.168.2.0/24, version 4
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, metric 0, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022

Displayed  4 routes and 4 total paths
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 13:13:34 +02:00
Ryoga Saito
4d85efb0d3 tests: Add topotest bgp_srv6l3vpn_route_leak
To verify previous changes, this PR adds topotest to verify whether
imported routes redistributed will be active on other VRF RIB.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-12-20 20:07:44 +09:00
Ryoga Saito
db65643931 bgpd: Fix handling of SRv6 local routes
Current bgpd can't annouce SRv6 locally-generated routes to Zebra
correctly because MPLS label of locally-generated routes is not valid
but sid_info->transposition_len is set to non-zero value. This commit
fixes such kind of issues.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-12-20 20:07:40 +09:00
Donatas Abraitis
81dcd88113 bgpd: Set routes detail flag when using flowspec detailed command
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 12:19:37 +02:00
Donatas Abraitis
711835d986 doc: Add new command show bgp detail-routes
```
donatas-pc# show bgp all detail-routes

For address family: IPv4 Unicast
BGP table version is 11, local router ID is 192.168.10.17, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.0.2.0/24, version 1
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.124
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, best (First path received)
      Last update: Tue Dec 20 12:11:52 2022
BGP routing table entry for 10.10.100.0/24, version 2
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.124
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin IGP, metric 0, valid, external, otc 65001, best (First path received)
      Last update: Tue Dec 20 12:11:52 2022
BGP routing table entry for 172.16.31.1/32, version 3
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.124
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, best (First path received)
      Last update: Tue Dec 20 12:11:52 2022
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 12:19:37 +02:00
Donatas Abraitis
509d82bd49 bgpd: Add show ip bgp <afi> <safi> detail command version
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 12:19:37 +02:00
Donatas Abraitis
67799a4893 bgpd: Rename BGP_SHOW_OPT_DETAIL to BGP_SHOW_OPT_JSON_DETAIL
This option used only for JSON detailed output.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 12:19:37 +02:00
Donatas Abraitis
9a1aae2dde bgpd: Show the real prefix for show bgp detail
Absolutely not possible to read the output and even distinguish the prefix
we are looking for.

Before:

```
donatas-pc# show ip bgp detail
BGP table version is 12, local router ID is 192.168.10.17, vrf id 0
Default local pref 100, local AS 65002
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
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin incomplete, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:53:16 2022
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, multipath, best (Neighbor IP)
      Last update: Tue Dec 13 22:53:16 2022
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin IGP, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:53:16 2022
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin IGP, metric 0, valid, external, otc 65001, multipath, best (Neighbor IP)
      Last update: Tue Dec 13 22:53:16 2022
```

After:

```
donatas-pc# show ip bgp detail
BGP table version is 12, local router ID is 192.168.10.17, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.0.2.0/24, version 1
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  2a02:4780:abc::2
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin incomplete, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:47:16 2022
BGP routing table entry for 10.0.2.0/24, version 1
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  2a02:4780:abc::2
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, multipath, best (Neighbor IP)
      Last update: Tue Dec 13 22:47:16 2022
BGP routing table entry for 10.10.100.0/24, version 2
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  2a02:4780:abc::2
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin IGP, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:47:16 2022
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 12:19:37 +02:00
Donatas Abraitis
af9aee79f9 bgpd: Check if bgp_path_info is not NULL when setting AIGP metric TLV
*** CID 1530035:  Null pointer dereferences  (FORWARD_NULL)
/bgpd/bgp_updgrp_packet.c: 756 in subgroup_update_packet()
750                              * position.
751                              */
752                             mpattr_pos = stream_get_endp(s);
753
754                             /* 5: Encode all the attributes, except MP_REACH_NLRI
755                              * attr. */
>>>     CID 1530035:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "path" to "bgp_packet_attribute", which dereferences it.
756                             total_attr_len = bgp_packet_attribute(
757                                     NULL, peer, s, adv->baa->attr, &vecarr, NULL,
758                                     afi, safi, from, NULL, NULL, 0, 0, 0, path);
759
760                             space_remaining =
761                                     STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 09:48:43 +02:00
Donatas Abraitis
99f60e5ecb tests: Add an option for SNMP config to specify a custom options
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 09:42:36 +02:00
Donatas Abraitis
2789c90994 bgpd: Zero intial OID items in array at the beginning
If OID does not have an IP address encoded, initialized every item in an
array to 0 to avoid a wrong comparison between IP addresses.

With >= 5.8 net-snmp, it works without this hack.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20 09:42:35 +02:00
Donatas Abraitis
4f4728b678
Merge pull request #12380 from chiragshah6/zdev
ospfd: json support for show ip ospf border-routers
2022-12-19 23:37:59 +02:00
Donatas Abraitis
54257fae5d tests: Add basic tests for SNMP BGP4V2-MIB
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-19 23:27:33 +02:00
Donatas Abraitis
15c3b52f3f bgpd: Return MED, not local-preference if MED attribute exists (SNMP)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-19 23:27:33 +02:00
Donatas Abraitis
71a055c9d1 bgpd: Specify prefix address-family before looking into BGP table
Otherwise, lookup behaves a bit weird.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-19 23:27:33 +02:00
Donatas Abraitis
2b9d7b2c9b bgpd: Make sure we have peer->notify.data before returning for SNMP
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-19 23:27:33 +02:00
Donatas Abraitis
6a2c7a57bd
Merge pull request #12434 from chiragshah6/fdev1
zebra: show ip nht route-map vrf json support
2022-12-19 23:24:53 +02:00
Donald Sharp
ccbebd59ac Merge pull request #12544 from mjstapp/fix_pathd_sa_pcep_config
pathd: fix SA warning in path_pcep_config
2022-12-19 14:44:21 -05:00
Donatas Abraitis
2999fbdc2a
Merge pull request #12535 from donaldsharp/mpattr_size_enum
Use switch statements without default for safi_t and afi_t enum's
2022-12-19 20:54:53 +02:00
Rafael Zalamena
e3ba9ce36a
Merge pull request #12537 from anlancs/fix/fpm-debug-info
zebra: fix wrong gateway for fpm debug
2022-12-19 15:01:43 -03:00
Rafael Zalamena
3e44212f9f
Merge pull request #12538 from donaldsharp/zebra_crash_in_shutdown
zebra: Ensure memory is not freed that dplane depends on in shutdown
2022-12-19 14:58:49 -03:00
Mark Stapp
040ca77097 pathd: fix SA warning in path_pcep_config
Fix an SA warning about a possibly-uninited local.

Signed-off-by: Mark Stapp <mjs@labn.net>
2022-12-19 11:36:03 -05:00