Per ListeningPort network namespace (c++)

47 views
Skip to first unread message

Dylan Walsh

unread,
Mar 28, 2023, 7:11:10 AM3/28/23
to grpc.io
Hey all,

I was wondering if a single c++ gRPC server has the ability to bind to different addresses within different network namespaces:

e.g localhost:4566 in network namespace default
       localhost:4567 in network namespace red

Currently, I can switch namespace (setns) before calling BuildAndStart() for a ServerBuilder object. But this causes all configured listening ports to bind within the same namespace. 

I was curious if there is any existing functionality for allowing calls to AddListeningPort(..) to specify the network namespace to use (or some other way of achieving this).

Kind Regards,
Dylan

yas...@google.com

unread,
Mar 29, 2023, 1:27:05 PM3/29/23
to grpc.io
gRPC C++ doesn't have a way of doing that. It looks like the way processes switch network namespaces is by using `ip netns exec` but that's not what we want.

Dylan Walsh

unread,
Mar 30, 2023, 4:29:54 AM3/30/23
to yas...@google.com, grpc.io
Thanks for the quick confirmation, Yash. 
I thought as much, I'll just stick to one network namespace for now!

--
You received this message because you are subscribed to a topic in the Google Groups "grpc.io" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grpc-io/1VZctppeH8I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/f278a4f4-c411-4009-9bc8-343395d3deean%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages