Rearranged ipv4_control() a bit, and fixed a bug that would always return B_BAD_VALUE

on setsockopt() for all options. Thanks to Hugo Santos for pointing this out.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20421 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-03-25 12:59:39 +00:00
parent 19b0fb934c
commit 6de46a8005
@@ -821,7 +821,8 @@ ipv4_control(net_protocol *_protocol, int level, int option, void *value,
dprintf("IPv4::control(): get unknown option: %d\n", option); dprintf("IPv4::control(): get unknown option: %d\n", option);
return ENOPROTOOPT; return ENOPROTOOPT;
} }
} else { }
// set options // set options
switch (option) { switch (option) {
@@ -837,7 +838,7 @@ ipv4_control(net_protocol *_protocol, int level, int option, void *value,
protocol->flags |= IP_FLAG_HEADER_INCLUDED; protocol->flags |= IP_FLAG_HEADER_INCLUDED;
else else
protocol->flags &= ~IP_FLAG_HEADER_INCLUDED; protocol->flags &= ~IP_FLAG_HEADER_INCLUDED;
break; return B_OK;
} }
case IP_TTL: case IP_TTL:
@@ -849,7 +850,7 @@ ipv4_control(net_protocol *_protocol, int level, int option, void *value,
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
protocol->time_to_live = timeToLive; protocol->time_to_live = timeToLive;
break; return B_OK;
} }
case IP_TOS: case IP_TOS:
@@ -861,15 +862,15 @@ ipv4_control(net_protocol *_protocol, int level, int option, void *value,
return B_BAD_ADDRESS; return B_BAD_ADDRESS;
protocol->service_type = serviceType; protocol->service_type = serviceType;
break; return B_OK;
} }
default: default:
dprintf("IPv4::control(): set unknown option: %d\n", option); dprintf("IPv4::control(): set unknown option: %d\n", option);
return ENOPROTOOPT; return ENOPROTOOPT;
} }
}
// never gets here
return B_BAD_VALUE; return B_BAD_VALUE;
} }