Commit Graph

35232 Commits

Author SHA1 Message Date
Nobuhiro MIKI
06ce47558f tools: Fix frr-reload for ebgp-multihop TTL reconfiguration.
In ebgp-multihop, there is a difference in reload behavior when TTL is
unspecified (meaning default 255) and when 255 is explicitly specified.
For example, when reloading with 'neighbor <neighbor> ebgp-multihop
255' in the config, the following difference is created. This commit
fixes that.

    Lines To Delete
    ===============
    router bgp 65001
     no neighbor 10.0.0.4 ebgp-multihop
    exit

    Lines To Add
    ============
    router bgp 65001
     neighbor 10.0.0.4 ebgp-multihop 255
    exit

The commit 767aaa3a80 is not sufficient and frr-reload needs to be
fixed to handle both unspecified and specified cases.

Signed-off-by: Nobuhiro MIKI <nob@bobuhiro11.net>
(cherry picked from commit 594e917656)
2025-01-29 12:06:15 +00:00
Donald Sharp
75991d68a1
Merge pull request #17940 from opensourcerouting/fix/revert_4338e21aa2feba57ea7004c36362e5d8186340b8_10.0
Revert "bgpd: Handle Addpath capability using dynamic capabilities" (backport)
2025-01-28 09:35:22 -05:00
Donatas Abraitis
513d333ca8 Revert "bgpd: Handle Addpath capability using dynamic capabilities"
This reverts commit 05cf9d03b3.

TL;DR; Handling BGP AddPath capability is not trivial (possible) dynamically.

When the sender is AddPath-capable and sends NLRIs encoded with AddPath ID,
and at the same time the receiver sends AddPath capability "disable-addpath-rx"
(flag update) via dynamic capabilities, both peers are out of sync about the
AddPath state. The receiver thinks already he's not AddPath-capable anymore,
hence it tries to parse NLRIs as non-AddPath, while they are actually encoded
as AddPath.

AddPath capability itself does not provide (in RFC) any mechanism on backward
compatible way to handle NLRIs if they come mixed (AddPath + non-AddPath).

This explains why we have failures in our CI periodically.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-28 11:23:37 +02:00
Donatas Abraitis
689b455c47
Merge pull request #17893 from FRRouting/mergify/bp/stable/10.0/pr-17888
bgpd: Fix for local interface MAC cache issue in 'bgp mac hash' table (backport #17888)
2025-01-22 07:04:43 +02:00
Krishnasamy R
4a49bf9be8 bgpd: Fix for local interface MAC cache issue in 'bgp mac hash' table
Issue:
During FRR restart, we fail to add some of the local interface's MAC
to the 'bgp mac hash'. Not having local MAC in the hash table can cause
lookup issues while receiving EVPN RT-2.

Currently, we have code to add local MAC(bgp_mac_add_mac_entry) while handling
interface add/up events in BGP(bgp_ifp_up/bgp_ifp_create). But the code
'bgp_mac_add_mac_entry' in bgp_ifp_create is not getting invoked as it
is placed under a specific check(vrf->bgp link check).

Fix:
We can skip this check 'vrf->bgp link existence' as the tenant VRF might
not have BGP instance but still we want to cache the tenant VRF local
MACs. So keeping this check in bgp_ifp_create inline with bgp_ifp_up.

Ticket: #4204154

Signed-off-by: Krishnasamy R <krishnasamyr@nvidia.com>
(cherry picked from commit 016528364e)
2025-01-21 14:31:11 +00:00
Donald Sharp
48221b1f0b
Merge pull request #17835 from FRRouting/mergify/bp/stable/10.0/pr-17813
bgpd: use igpmetric in bgp_aigp_metric_total() (backport #17813)
2025-01-10 13:35:45 -05:00
Enke Chen
7d6ee74f88 bgpd: use igpmetric in bgp_aigp_metric_total()
Use igpmetric from bgp_path_info in bgp_igp_metric_total() to be
consistent with all other cases, e.g., as in bgp_path_info_cmp().

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit b89e66a3bc)
2025-01-10 14:27:46 +00:00
Donatas Abraitis
8752401ebd
Merge pull request #17817 from FRRouting/mergify/bp/stable/10.0/pr-17807
bgpd: fix crash in displaying json orf prefix-list (backport #17807)
2025-01-10 09:43:06 +02:00
Louis Scalbert
2de8f291d4 bgpd: fix crash in displaying json orf prefix-list
bgpd crashes when there is several entries in the prefix-list. No
backtrace is provided because the issue was catched from a code review.

Fixes: 856ca177c4 ("Added json formating support to show-...-neighbors-... bgp commands.")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 8ccf60921b)
2025-01-09 20:58:58 +00:00
Louis Scalbert
0501a4800e bgpd: fix bgp orf prefix-list json prefix
0x<address>FX was displayed instead of the prefix.

Fixes: b219dda129 ("lib: Convert usage of strings to %pFX and %pRN")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit b7e843d7e8)
2025-01-09 20:58:58 +00:00
Donald Sharp
de8be500d2
Merge pull request #17790 from FRRouting/mergify/bp/stable/10.0/pr-17725
isisd: Allow full `no` form for `domain-password` and `area-password` (backport #17725)
2025-01-07 13:08:14 -05:00
Russ White
c66b18838d
Merge pull request #17786 from FRRouting/mergify/bp/stable/10.0/pr-17780
bgpd: fix a bug in peer_allowas_in_set() (backport #17780)
2025-01-07 09:44:48 -05:00
Donatas Abraitis
00de3f9244 isisd: Allow full no form for domain-password and area-password
Before:

```
LR1.wue3(config)# router isis VyOS
LR1.wue3(config-router)# no  area-password clear
% Unknown command: no  area-password clear
LR1.wue3(config-router)# no  area-password clear foo
% Unknown command: no  area-password clear foo
LR1.wue3(config-router)#
```

Closes https://github.com/FRRouting/frr/issues/17722

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit a696547d6c)
2025-01-07 14:42:38 +00:00
Enke Chen
0313ea1639 bgpd: fix a bug in peer_allowas_in_set()
Fix a bug in peer_allowas_in_set() so that the config takes effect
for peer-group members.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit bcd1017794)
2025-01-07 11:14:34 +00:00
Jafar Al-Gharaibeh
23812cbecb
Merge pull request #17765 from FRRouting/mergify/bp/stable/10.0/pr-17750
tools: Add missing rpki keyword to vrf in frr-reload (backport #17750)
2025-01-05 16:06:00 -06:00
Jonathan Voss
45a24ef674 tools: Add missing rpki keyword to vrf in frr-reload
When reloading the following configuration:
```
vrf red
 rpki
  rpki cache tcp 172.65.0.2 8282 preference 1
 exit
exit-vrf
```
frr-reload.py does not properly enter the `rpki` context
within a `vrf`. Because of this, it fails to apply RPKI
configurations.

Signed-off-by: Jonathan Voss <jvoss@onvox.net>
(cherry picked from commit 975ee8ed6e)
2025-01-04 11:54:08 +00:00
Mark Stapp
ae3d2f08de
Merge pull request #17757 from FRRouting/mergify/bp/stable/10.0/pr-17732
isisd: Show correct level information for `show isis interface detail json` (backport #17732)
2025-01-03 10:10:22 -05:00
Donatas Abraitis
da5031619b isisd: Show correct level information for show isis interface detail json
Having this configuration:

```
!
interface r1-eth0
 ip address 10.0.0.1/30
 ip router isis 1
 isis priority 44 level-1
 isis priority 88 level-2
 isis csnp-interval 90 level-1
 isis csnp-interval 99 level-2
 isis psnp-interval 70 level-1
 isis psnp-interval 50 level-2
 isis hello-interval level-1 120
 isis hello-interval level-2 150

!
interface r1-eth1
 ip address 10.0.0.10/30
 ip router isis 1
!
interface lo
 ip address 192.0.2.1/32
 ip router isis 1
 isis passive
!
router isis 1
net 49.0000.0000.0000.0001.00
 metric-style wide
```

Produces:

```
{
 "areas":[
   {
     "area":"1",
     "circuits":[
       {
         "circuit":2,
         "interface":{
           "name":"r1-eth0",
           "state":"Up",
           "is-passive":"active",
           "circuit-id":"0x2",
           "type":"lan",
           "level":"L1L2",
           "snpa":"6e28.9c92.da5e",
           "levels":[
             {
               "level":"L1",
               "metric":10,
               "active-neighbors":1,
               "hello-interval":120,
               "holddown":{
                 "count":10,
                 "pad":"yes"
               },
               "cnsp-interval":90,
               "psnp-interval":70,
               "lan":{
                 "priority":44,
                 "is-dis":"no"
               }
             },
             {
               "level":"L2",
               "metric":10,
               "active-neighbors":1,
               "hello-interval":120, <<<<<<<<<<<<<<<<<<
               "holddown":{
                 "count":10,
                 "pad":"yes"
               },
               "cnsp-interval":90, <<<<<<<<<<<<<<<<<<
               "psnp-interval":70, <<<<<<<<<<<<<<<<<<
               "lan":{
                 "priority":44, <<<<<<<<<<<<<<<<<<
                 "is-dis":"no"
               }
             }
           ],
...
```

Fixes: 9fee4d4c60 ("isisd: Add json to show isis interface command.")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 360a0d6f4c)
2025-01-03 12:37:55 +00:00
Donatas Abraitis
38d741be2c FRR Release 10.0.3
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-23 23:26:08 +02:00
Jafar Al-Gharaibeh
6cc954085c
Merge pull request #17714 from opensourcerouting/fix/backport_b6dcf618777bb7a11176617d647e16ab64f49b7b_10.0
bgpd: Fix `enforce-first-as` per peer-group removal (backport)
2024-12-22 22:49:01 -06:00
Donatas Abraitis
327d08bebb bgpd: Fix enforce-first-as per peer-group removal
If we do `no neighbor PG enforce-first-as`, it wasn't working because the flag
was inherited incorrectly for the members of the peer-group.

Fixes: 322462920e ("bgpd: Enable enforce-first-as by default")

Closes: https://github.com/FRRouting/frr/issues/17702

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-22 13:30:10 +02:00
Jafar Al-Gharaibeh
a2c3cfa5ef
Merge pull request #17701 from opensourcerouting/fix/backport_b0800bfdf04b4fcf48504737ebfe4ba7f05268d3
bgpd: Validate only affected RPKI prefixes instead of a full RIB (backport)
2024-12-21 22:55:10 -06:00
Donatas Abraitis
01531d74c4
Merge pull request #17688 from FRRouting/mergify/bp/stable/10.0/pr-17669
bgpd: fix memory leak when reconfiguring a route distinguisher (backport #17669)
2024-12-21 22:21:02 +02:00
Donatas Abraitis
5b51fbda0c bgpd: Validate only affected RPKI prefixes instead of a full RIB
Before this fix, if rpki_sync_socket_rtr socket returns EAGAIN, then ALL routes
in the RIB are revalidated which takes lots of CPU and some unnecessary traffic,
e.g. if using BMP servers. With a full feed it would waste 50-80Mbps.

Instead we should try to drain an existing pipe (another end), and revalidate
only affected prefixes.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-12-20 23:09:32 +02:00
Philippe Guibert
fee57833d7 bgpd: fix memory leak when reconfiguring a route distinguisher
A memory leak happens when reconfiguring an already configured route
distinguisher on an L3VPN BGP instance. Fix this by freeing the previous
route distinguisher.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 0dd96287dd)
2024-12-20 14:16:07 +00:00
Jafar Al-Gharaibeh
80f5df3f09
Merge pull request #17680 from FRRouting/mergify/bp/stable/10.0/pr-17675
bgpd: Fix memory leak when creating BMP connection with a source interface (backport #17675)
2024-12-19 20:19:06 -06:00
Donatas Abraitis
5d0cef584f bgpd: Fix memory leak when creating BMP connection with a source interface
Testing done with:

```
for x in $(seq 1 100000); do vtysh -c 'conf' -c 'router bgp' -c 'bmp targets test' -c 'bmp connect localhost port 123 min-retry 100 max-retry 100 source-interface lo'; done
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 7d19cb59cf)
2024-12-19 21:56:16 +00:00
Jafar Al-Gharaibeh
cbe7fc3a98
Merge pull request #17658 from FRRouting/mergify/bp/stable/10.0/pr-17615
lib: Take ge/le into consideration when checking the prefix with the prefix-list (backport #17615)
2024-12-17 18:38:52 -06:00
Donatas Abraitis
9df941700a lib: Take ge/le into consideration when checking the prefix with the prefix-list
Without the fix:

```
show ip prefix-list test_1 10.20.30.96/27 first-match
 <no result>

show ip prefix-list test_2 192.168.1.2/32 first-match
 <no result>
```

With the fix:

```
ip prefix-list test_1 seq 10 permit 10.20.30.64/26 le 27
!
end
donatas# show ip prefix-list test_1 10.20.30.96/27
   seq 10 permit 10.20.30.64/26 le 27 (hit count: 1, refcount: 0)
donatas# show ip prefix-list test_1 10.20.30.64/27
   seq 10 permit 10.20.30.64/26 le 27 (hit count: 2, refcount: 0)
donatas# show ip prefix-list test_1 10.20.30.64/28
donatas# show ip prefix-list test_1 10.20.30.126/26
   seq 10 permit 10.20.30.64/26 le 27 (hit count: 3, refcount: 0)
donatas# show ip prefix-list test_1 10.20.30.126/30
donatas#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit dd4c2acc2e)
2024-12-17 16:32:34 +00:00
Donald Sharp
5af15b0f0f
Merge pull request #17632 from opensourcerouting/fix/backport_9b0b9282d317a9aeab36d9a8b08a35fe9a172c4b_10.0
bgpd: Fix bgp core with a possible Intf delete (backport)
2024-12-11 07:20:36 -05:00
Rajasekar Raja
9c20cd200b bgpd: Fix bgp core with a possible Intf delete
Although trigger unknown, based on the backtrace in one of the internal
testing, we do see some delete in the Intf where we can have the peer
ifp pointer null and we try to dereference it while trying to install
the route leading to a crash

Skip updating the ifindex in such cases and since the nexthop is not
properly updated, BGP skips sending it to zebra.

BackTrace:
0  0x00007faef05e7ebc in ?? () from /lib/x86_64-linux-gnu/libc.so.6
1  0x00007faef0598fb2 in raise () from /lib/x86_64-linux-gnu/libc.so.6
2  0x00007faef09900dc in core_handler (signo=11, siginfo=0x7ffdde8cb4b0, context=<optimized out>) at lib/sigevent.c:274
3  <signal handler called>
4  0x00005560aad4b7d8 in update_ipv6nh_for_route_install (api_nh=0x7ffdde8cbe94, is_evpn=false, best_pi=0x5560b21187d0, pi=0x5560b21187d0, ifindex=0, nexthop=0x5560b03cb0dc,
   nh_bgp=0x5560ace04df0, nh_othervrf=0) at bgpd/bgp_zebra.c:1273
5  bgp_zebra_announce_actual (dest=dest@entry=0x5560afcfa950, info=0x5560b21187d0, bgp=0x5560ace04df0) at bgpd/bgp_zebra.c:1521
6  0x00005560aad4bc85 in bgp_handle_route_announcements_to_zebra (e=<optimized out>) at bgpd/bgp_zebra.c:1896
7  0x00007faef09a1c0d in thread_call (thread=thread@entry=0x7ffdde8d7580) at lib/thread.c:2008
8  0x00007faef095a598 in frr_run (master=0x5560ac7e5190) at lib/libfrr.c:1223
9  0x00005560aac65db6 in main (argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_main.c:557

(gdb) f 4
4  0x00005560aad4b7d8 in update_ipv6nh_for_route_install (api_nh=0x7ffdde8cbe94, is_evpn=false, best_pi=0x5560b21187d0, pi=0x5560b21187d0, ifindex=0, nexthop=0x5560b03cb0dc,
    nh_bgp=0x5560ace04df0, nh_othervrf=0) at bgpd/bgp_zebra.c:1273
1273	in bgpd/bgp_zebra.c
(gdb) p pi->peer->ifp
$26 = (struct interface *) 0x0

Ticket :#4203904

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-12-11 10:54:24 +02:00
Jafar Al-Gharaibeh
e11efcd7b8
Merge pull request #17596 from opensourcerouting/fix/backport_12a9ca4de6c781b061cccdf3e793346e23558901_10.0
bgpd: fix unconfigure asdot neighbor (backport)
2024-12-05 09:25:28 -06:00
Philippe Guibert
69c3e672a4 bgpd: fix unconfigure asdot neighbor
The below command is not successfull on an existing as dot peer

> no neighbor 10.0.0.2 remote-as 1.1
> % Create the peer-group or interface first

Handle the case where the remote-as argument can be an ASNUM.

Fixes: 8079a4138d ("lib, bgp: add initial support for asdot format")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-12-05 09:40:15 +02:00
Jafar Al-Gharaibeh
934b67b1e3
Merge pull request #17564 from FRRouting/mergify/bp/stable/10.0/pr-17518
pimd: Fix access-list memory leak in pimd (backport #17518)
2024-12-03 23:42:25 -06:00
Jafar Al-Gharaibeh
f9b320dd65
Merge pull request #17560 from FRRouting/mergify/bp/stable/10.0/pr-17313
zebra: separate zebra ZAPI server open and accept (backport #17313)
2024-12-03 21:49:46 -06:00
Corey Siltala
db1cb06557 pimd: Fix access-list memory leak in pimd
Reset access-lists in pimd on terminate

Signed-off-by: Corey Siltala <csiltala@atcorp.com>
(cherry picked from commit d21a993f16)
2024-12-03 21:37:17 +00:00
Mark Stapp
9e67464d77 zebra: separate zebra ZAPI server open and accept
Separate zebra's ZAPI server socket handling into two phases:
an early phase that opens the socket, and a later phase that
starts listening for client connections.

Signed-off-by: Mark Stapp <mjs@cisco.com>
(cherry picked from commit 506097a1b9)
2024-12-03 20:27:50 +00:00
Donatas Abraitis
dafe8e9d46
Merge pull request #17524 from FRRouting/mergify/bp/stable/10.0/pr-17510
bgpd: fix use single whitespace when displaying flowspec entries (backport #17510)
2024-11-28 07:53:56 +02:00
Philippe Guibert
9c78057ef9 bgpd: fix use single whitespace when displaying flowspec entries
There is an extra space in the 'Displayed' line of show bgp command,
that should not be present.
Fix this by being consistent with the output of the other address
families.

Fixes: ("a1baf9e84f71") bgpd: Use single whitespace when displaying show bgp summary
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 561debab54)
2024-11-26 18:12:40 +00:00
Russ White
61bcff83b6
Merge pull request #17513 from FRRouting/mergify/bp/stable/10.0/pr-17506
bgpd: fix version attribute is an int, not a string (backport #17506)
2024-11-26 11:49:27 -05:00
Philippe Guibert
cd238c71bb bgpd: fix version attribute is an int, not a string
The json display of the version attribute is originally an
integer. It has changed, most probably mistakenly.

> {
>   "vrfId": 7,
>   "vrfName": "vrf1",
>   "tableVersion": 3,
>   "routerId": "192.0.2.1",
>   "defaultLocPrf": 100,
>   "localAS": 65500,
>   "routes": {
>     "172.31.0.1/32": {
>       "prefix": "172.31.0.1/32",
>       "version": "1",		<--- int or string ??

Let us fix it, by using the integer display instead.

Fixes: f9f2d188e3 ("bgpd: fix 'json detail' output structure")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit c5d7815ccc)
2024-11-26 13:30:21 +00:00
Donald Sharp
0268aef6ad
Merge pull request #17489 from FRRouting/mergify/bp/stable/10.0/pr-17487
bgpd: Do not reset peers on suppress-fib toggling (backport #17487)
2024-11-22 18:33:44 -05:00
Donatas Abraitis
02d922c6b1 bgpd: Do not reset peers on suppress-fib toggling
If the desired state is the same - do nothing instead of resetting once again.

Fixes: bdb5ae8bce ("bgpd: Make suppress-fib-pending clear peering")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 7fb4c03f5b)
2024-11-22 15:17:31 +00:00
Donald Sharp
321638388d
Merge pull request #17448 from opensourcerouting/fix/backport_65a43b57efd60c4fdf80c935750046ba861ec79f_10.0
bgpd: Validate both nexthop information (NEXTHOP and NLRI) (backport)
2024-11-19 09:29:24 -05:00
Donatas Abraitis
91790796bc bgpd: Validate both nexthop information (NEXTHOP and NLRI)
If we receive an IPv6 prefix e.g.: 2001:db8:100::/64 with nextop: 0.0.0.0, and
mp_nexthop: fc00::2, we should not treat this with an invalid nexthop because
of 0.0.0.0. We MUST check for MP_REACH attribute also and decide later if we
have at least one a valid nexthop.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit a0d2734e87)
2024-11-17 11:25:41 +02:00
Jafar Al-Gharaibeh
81c2fe3453
Merge pull request #17417 from FRRouting/mergify/bp/stable/10.0/pr-17402
bgpd: Fix for match source-protocol in route-map for redistribute cmd (backport) (backport #17402)
2024-11-12 11:45:12 -06:00
Rajasekar Raja
718b76fc3f bgpd: Fix for match source-protocol in route-map for redistribute cmd
A redistribute cmd can have a route-map attached to it and adding the
match source-protocol to that route-map means BGP to filter which
protocol routes to accept among the bunch of routes zebra is sending.

Fixing this since this wasnt implemented earlier.

Ticket :#4119692

Signed-off-by: Donald Sharp <sharpd@nvidia.com>

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
(cherry picked from commit 68358c0f92)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit f93e5aa166)
2024-11-12 15:02:54 +00:00
Russ White
930ee69279
Merge pull request #17405 from FRRouting/mergify/bp/stable/10.0/pr-15686
BGP TCP non established : get port and ip (backport #15686)
2024-11-12 10:02:11 -05:00
Philippe Guibert
9b50df7fe7 bgpd: fix addressing information of non established outgoing sessions
When trying to connect to a BGP peer that does not respons, the 'show
bgp neighbors' command does not give any indication on the local and
remote addresses used:

> # show bgp neighbors
>  BGP neighbor is 192.0.2.150, remote AS 65500, local AS 65500, internal link
>   Local Role: undefined
>   Remote Role: undefined
>   BGP version 4, remote router ID 0.0.0.0, local router ID 192.0.2.1
>   BGP state = Connect
> [..]
>   Connections established 0; dropped 0
>   Last reset 00:00:04,   Waiting for peer OPEN (n/a)
>   Internal BGP neighbor may be up to 255 hops away.
> BGP Connect Retry Timer in Seconds: 120
> Next connect timer due in 117 seconds
> Read thread: off  Write thread: off  FD used: 27

The addressing information (address and port) are only available
when TCP session is established, whereas this information is present
at the system level:

> root@ubuntu2204:~# netstat -pan | grep 192.0.2.1
> tcp        0      0 192.0.2.1:179           192.0.2.150:38060       SYN_RECV    -
> tcp        0      1 192.0.2.1:46526         192.0.2.150:179         SYN_SENT    488310/bgpd

Add the display for outgoing BGP session, as the information in
the getsockname() API provides information for connected streams.
When getpeername() API does not give any information, use the peer
configuration (destination port is encoded in peer->port).

> # show bgp neighbors
> BGP neighbor is 192.0.2.150, remote AS 65500, local AS 65500, internal link
>   Local Role: undefined
>   Remote Role: undefined
>   BGP version 4, remote router ID 0.0.0.0, local router ID 192.0.2.1
>   BGP state = Connect
> [..]
>   Connections established 0; dropped 0
>   Last reset 00:00:16,   Waiting for peer OPEN (n/a)
> Local host: 192.0.2.1, Local port: 46084
> Foreign host: 192.0.2.150, Foreign port: 179

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 78ce63952a)
2024-11-11 08:27:19 +00:00
Philippe Guibert
862a15da9b bgpd: remove useless control checks about TCP connection
When attempting to get the src and destination addresses of a given
connection, the API may return the NULL pointer, but further code
in bgp_zebra_nexthop_set() already does a check about the given
pointer.

Relaxing the error code for all the returned adressing.

Fixes: 1ff9a34058 ("bgpd: bgpd-fsm-fix.patch")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit ba71303099)
2024-11-11 08:27:19 +00:00