Bugzilla – Bug 1824
L4 protocol sockets should support BindToNetDevice over IPv6
Last modified: 2014-09-12 14:52:54 EDT
The problem is in UdpSocketImpl::BindToNetDevice and TcpSocketBase::BindToNetDevice. In both methods only the v4 methods are initialised, while also the v6 endpoint should be initialised (v6 endpoints have a BindToNetDevice).
Created attachment 1752 [details] patch The patch add the required BindToNetDevice calls to the IPv6Endpoint inside TCP and UDP sockets. The only doubt I have is: if the socket wasn't already bound (normal Bind), BindToNetDevice will do it for the user. BUT it will open *two* endpoints, v4 and v6. Since we do have separate Bind and Bind6, and they open just the endpoint they need, maybe it's not a good idea to open another one just because we can. SO, the BindToNetDevice "logical" thing would be: do nothing or raise an assert if the EndPoint is not already bound by a previous Bind. This also prevents the idiotic error: call BindToNetDevice() and, after call Bind() (it's causing a a memory leak). Opinions ?
I'm OK with this also, as long as there is some documentation added about the expected sequence of Bind() calls supported.
added in changeset: 10933:7442f5603ef4