Before I get too far into changing lots of code I wanted to ask the
following questions:
spice/server]$ git grep "setsockopt(" | wc -l
10
There are 10 calls to setsockopt in the server code base.
All of them allow ENOTSUP, and won't even complain if they get that
error code.
Only the two that I modified actually cause the calling function to fail
on the other error codes.
The rest just red_printf a warning and continue.
Why do those two need to fail?
Why don't the rest?
Do those two need to fail?
-Nahum
On 03/10/2012 06:00 AM, Alon Levy wrote:
On Fri, Mar 09, 2012 at 12:26:50PM -0500, Nahum Shalman wrote:
If we allow listening on arbitrary sockets like unix sockets,
we can get ENOPROTOOPT errors from setsockopt calls that set TCP
specific options. This should be allowed to happen.
I'm a little concerned that we will ignore actual errors for TCP sockets
this way. I think this patch is ok, but I'd like to see an additional
patch that added a boolean or enum for the socket type and thus could
avoid doing the IPPROTO_TCP in the first place. Or maybe you can get
that information from a filedescriptor without caching it yourself.
---
server/inputs_channel.c | 2 +-
server/spicevmc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index a3f26c0..fb25fe0 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -470,7 +470,7 @@ static int inputs_channel_config_socket(RedChannelClient
*rcc)
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
&delay_val, sizeof(delay_val)) == -1) {
- if (errno != ENOTSUP) {
+ if (errno != ENOTSUP&& errno != ENOPROTOOPT) {
red_printf("setsockopt failed, %s", strerror(errno));
return FALSE;
}
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 30aaf2f..9449c1e 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -92,7 +92,7 @@ static int
spicevmc_red_channel_client_config_socket(RedChannelClient *rcc)
if (rcc->channel->type == SPICE_CHANNEL_USBREDIR) {
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
&delay_val, sizeof(delay_val)) != 0) {
- if (errno != ENOTSUP) {
+ if (errno != ENOTSUP&& errno != ENOPROTOOPT) {
red_printf("setsockopt failed, %s", strerror(errno));
return FALSE;
}
--
1.7.7.6
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel