Skip to content

[code sync] Merge code from sonic-net/sonic-swss:202605 to 202606 - #292

Merged
mssonicbld merged 2 commits into
Azure:202606from
mssonicbld:sonicbld/202606-merge
Sep 2, 2026
Merged

[code sync] Merge code from sonic-net/sonic-swss:202605 to 202606#292
mssonicbld merged 2 commits into
Azure:202606from
mssonicbld:sonicbld/202606-merge

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator
* 8e3a3d9d - (origin/202605) [vnetorch] Resolve interface for directly-connected local endpoints (#4675) (2026-09-01) [mssonicbld]<br>```

mssonicbld and others added 2 commits September 1, 2026 12:16
…#4675)

## What I did

For VNET routes using `custom_bfd` monitoring, resolve the RIF interface alias for **directly-connected local endpoints** before calling `NeighOrch::hasNextHop` / `getNextHopId` / ref-count APIs. Applied symmetrically in both the single-NH path (`createNextHopGroup`) and the multi-NH path (`addNextHopGroup`).

## Why I did it

VNET routes with `monitoring=custom_bfd` whose **primary** endpoint is a directly-connected local DPU IP fail to install. The route stays in `inactive` state in `STATE_DB` even when:

- The BFD session is `Up` and a notification reaches vnetorch
- The kernel ARP table has the neighbor as `REACHABLE`
- `APP_DB:NEIGH_TABLE:<intf>:<DPU-IP>` exists (NeighOrch has the neighbor as `IP@<intf>`)

### Root cause

The `NextHopGroupKey` for VNET routes is constructed from `VNET_ROUTE_TUNNEL_TABLE.endpoint`, which only carries IPs (no interface). For directly-connected local endpoints the `NextHopKey` carries an **empty alias** (`<IP>@`). The lookup `NeighOrch::hasNextHop(<IP>@<empty>)` misses the stored entry `<IP>@<intf>`, and `createNextHopGroup` returns `false`:

```
NOTICE swss#orchagent: createNextHopGroup: Next hop 100.117.156.35@ not found in neighorch, skipping.
WARNING swss#orchagent: updateVnetTunnelCustomMonitor: Failed to create primary based custom next hop group. Cannot proceed.
```

Note the empty alias after the `@`. The corresponding APP_DB entry is properly keyed:

```
$ redis-cli -n 0 keys '*NEIGH*' | grep 100.117.156.35
NEIGH_RESOLVE_TABLE:Vlan32:100.117.156.35
NEIGH_TABLE:Vlan32:100.117.156.35
```

So NeighOrch stores `100.117.156.35@Vlan32` while vnetorch looks up `100.117.156.35@<empty>`.

The Down path (`NeighOrch::updateNextHop`, triggered by `BfdUpdate`) correctly resolves the alias and logs `setNextHopFlag on <IP> seen on port Vlan32`. This PR brings the create/Up path to parity.

### Related

Companion fix on the HA-manager / producer side: [sonic-net/sonic-dash-ha#152](sonic-net/sonic-dash-ha#152) (adds interface name to `NEIGH_RESOLVE_TABLE` keys for VLAN interfaces). That PR ensures the neighbor gets resolved with the correct interface. **This PR closes the consumer-side gap** so vnetorch can find the resolved neighbor.

## How I verified it

* Tested in lab:

Primary:
~$  redis-cli -n 6   hgetall "VNET_ROUTE_TUNNEL_TABLE|Vnet_55|3.2.1.0/32"
1) "active_endpoints"
2) "20.0.200.1"
3) "state"
4) "active"

Secondary
:~$  redis-cli -n 6   hgetall "VNET_ROUTE_TUNNEL_TABLE|Vnet_55|3.2.1.0/32"
1) "active_endpoints"
2) "10.1.0.32"
3) "state"
4) "active"

* UT:
python3 -m py_compile tests/test_vnet.py
sudo -n pytest -q --imgname=docker-sonic-vs:pr4592-5600c4c9-orchagent \
  test_vnet.py::TestVnetOrch::test_vnet_orch_local_endpoint_alias_resolution

1 passed in 58.95s

## Details if related

This bug only manifests in the `custom_bfd` monitoring code path that goes through `updateCustomBfdState` → `selectNextHopGroup` → `createNextHopGroup`. The non-monitoring path is unaffected because it builds `NextHopKey` with the interface already resolved upstream.

The fix uses `NeighOrch::getNeighborEntry(IpAddress, NeighborEntry&, MacAddress&)`, which is the existing API for IP-to-alias resolution. The resolution is conditional on `isLocalEp && alias.empty()` so it has no effect on non-local endpoints or cases where the alias was already populated.

Signed-off-by: zhangjing <zhangjing@microsoft.com>
Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@mssonicbld
mssonicbld merged commit 222f5e6 into Azure:202606 Sep 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant