I am trying to run PTPDV2 (precision timing protocol) server which binds on interface for setting up multicasting.
I have a following virtual interface
eth1:0 Link encap:Ethernet HWaddr 00:00:50:A0:42:BD
inet addr:10.2.0.17 Bcast:10.2.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0xa000
Now, I don't have any issues binding to a normal interface, but for any virtual interface I get a failure.
(ptpd debug1) 09:28:12.995509 (init) netInit
(ptpd debug1) 09:28:12.996254 (init) Local IP address used : 10.2.0.17
(ptpd error) 09:28:12.997099 (init) failed to call SO_BINDTODEVICE on the interface (strerror: No such device)
I need some pointers to overcome this issue. Any help here is appreciated.
I found a workaround to this problem. But it may not be the perfect solution. I am still open for suggestions.
I observed that socket bind is successful, so the socket does get the IP address of eth1:0 . But SO_BINDTODEVICE was failing since this was a virtual interface.
So i decided to call SO_BINDTODEVICE on the real interface that is eth1, since both eth1:0 and eth1 share same MAC.
Which this, i am no longer blocked as the responses are typically unicast for me. But this may not work perfectly if some one wants multicast support on receiving too.
Open for suggestion