grpc++ any api to set socket bind options

148 views
Skip to first unread message

Lalit Kumar

unread,
Jul 8, 2019, 3:11:34 PM7/8/19
to grpc.io
My grpc++ server is crashing while binding to ip address. IP address is valid and present on system. However interface to which it is bounded belongs to different VRF.

Is there any API which can be used to set the socket option( SO_BINDTODEVICE) ?

root@SeastoneXP-5:~/lalit# ./gnmi_server.bin
SetupServer address 10.9.5.14
E0708 19:08:02.766255725   27546 server_chttp2.cc:40]        {"created":"@1562612882.766193175","description":"No address added out of total 1 resolved","file":"src/core/ext/transport/chttp2/server/chttp2_server.cc","file_line":348,"referenced_errors":[{"created":"@1562612882.766187475","description":"Unable to configure socket","fd":122,"file":"src/core/lib/iomgr/tcp_server_utils_posix_common.cc","file_line":217,"referenced_errors":[{"created":"@1562612882.766170075","description":"Cannot assign requested address","errno":99,"file":"src/core/lib/iomgr/tcp_server_utils_posix_common.cc","file_line":190,"os_error":"Cannot assign requested address","syscall":"bind"}]}]}
Server listening on 10.9.5.14 Port 50042
Segmentation fault
root@SeastoneXP-5:~/lalit# ifconfig ma1
ma1       Link encap:Ethernet  HWaddr 00:e0:ec:7a:83:12 
          inet addr:10.9.5.14  Bcast:10.9.255.255  Mask:255.255.0.0
          inet6 addr: fe80::2e0:ecff:fe7a:8312/64 Scope:Link
          inet6 addr: 2600:1700:470:6f3f:10:9:101:53e/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:958942 errors:0 dropped:7 overruns:19 frame:0
          TX packets:111757 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:214464622 (204.5 MiB)  TX bytes:15174663 (14.4 MiB)
          Memory:dff40000-dff5ffff

root@SeastoneXP-5:~/lalit# ip link show ma1
4: ma1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master management state UP mode DEFAULT group default qlen 1000
    link/ether 00:e0:ec:7a:83:12 brd ff:ff:ff:ff:ff:ff
root@SeastoneXP-5:~/lalit#


Yash Tibrewal

unread,
Jul 22, 2019, 8:17:15 PM7/22/19
to grpc.io

mmf...@gmail.com

unread,
Aug 13, 2020, 9:37:12 AM8/13/20
to grpc.io

I am facing a similar issue on my grpc python client and server, I need to use SO_BINDTODEVICE option, and I cannot find any examples or how I can implement it using grpc socket mutator option.. could you help with an example on how such an implementation would look like as the documentations just suggests that grpc socket mutator is a pointer.

Mark D. Roth

unread,
Aug 20, 2020, 11:59:59 AM8/20/20
to grpc.io
Although you can use grpc_socket_mutator to do this, please note that it's not actually a public API, so we don't guarantee that the API won't change without notice between versions of gRPC.

Fazil Manzoor

unread,
Aug 24, 2020, 3:34:09 AM8/24/20
to grpc.io
Thats fine.. what I really need to know is how to implement this pointer? 

Do I create an instance of a class called socket mutator and then how do I set a socket option within this class and pass that instance over options? I cant find any examples on python on how socket mutator can be used in my client/server.py files. I would be grateful if I could get some example code snippet how setsocketopt is implemented on socket mutator.

Reply all
Reply to author
Forward
0 new messages