lib: optional binding IP support for gRPC server - #23297
Conversation
Greptile SummaryThis PR adds an optional host component to the gRPC module argument and passes the parsed host and port to the server thread.
Confidence Score: 3/5This PR is not safe to merge because the configured gRPC port is discarded at runtime and IPv6 binding input cannot be emitted as a valid endpoint. The new thread-data representation is incompatible with the retained pointer-to-integer port read, so both default and explicitly configured servers generally bind incorrectly or fail to start; IPv6 host formatting introduces another startup failure path. Files Needing Attention: lib/northbound_grpc.cpp Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["-M grpc:[host:]port"] --> B["Parse host and port"]
B --> C["Allocate grpc_args"]
C --> D["Store pointer in fpt->data"]
D --> E["grpc_pthread_start"]
E --> F["Build host:port endpoint"]
F --> G["ServerBuilder::AddListeningPort"]
G --> H["gRPC server"]
|
|
please take a few minutes and familiarize yourself with the workflow.rst documentation and follow it for your submissions. This is a no go until this is fixed |
|
I read it. I'll fix the issues. |
Currently northbound grpc server only supports port. Support optional binding IP while keeping it backward compatible with port-only config. Signed-off-by: Subham Pal <subhampal789@gmail.com>
Add IPv6 validation along with IPv4 for grpc server. Also, fix memory leakage of the newly added `grpc_args` structure pointer for holding (IP, port) pair. Signed-off-by: Subham Pal <subhampal789@gmail.com>
Remove a trailing whitespace as suggested by pipeline validator. Signed-off-by: Subham Pal <subhampal789@gmail.com>
b4b05f4 to
b909bb6
Compare
Signed-off-by: Subham Pal <subhampal789@gmail.com>
Usage
Binding IP can be configured in daemons file for individual daemon options using
-M grpc:<IP>:<port>.This is fully backward compatible with port-only config.
Changes
Instead of directly using
std::stoulon the argument, it is divided into two parts at last occuring ":" character, given it is present. Default IP is same as 0.0.0.0.Inside
frr_grpc_init, the combined data is stored as fields of astructwhose pointer is placed infpt->data.This is used in
AddListeningPortmethod ofgrpc::ServerBuilderinsidegrpc_pthread_startwhile buildinggrpc::Server.Resolves
Resolves #23294