Commit 3a02bd02 authored by Mark Andrews's avatar Mark Andrews
Browse files

assign to a int before calling setsockopt

parent a6c8cad5
......@@ -5964,22 +5964,21 @@ isc__socket_ipv6only(isc_socket_t *sock0, isc_boolean_t yes) {
static void
setdscp(isc__socket_t *sock, isc_dscp_t dscp) {
sock->dscp = dscp;
#if defined(IP_TOS) || defined(IPV6_TCLASS)
dscp <<= 2;
int value = dscp << 2;
#endif
sock->dscp = dscp;
#ifdef IP_TOS
if (sock->pf == AF_INET) {
if (setsockopt(sock->fd, IPPROTO_IP, IP_TOS,
(void *)&dscp, sizeof(int)) < 0) {
(void *)&value, sizeof(value)) < 0) {
char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d, IP_TOS, %.02x) "
"%s: %s", sock->fd, dscp >> 2,
"%s: %s", sock->fd, value >> 2,
isc_msgcat_get(isc_msgcat,
ISC_MSGSET_GENERAL,
ISC_MSG_FAILED,
......@@ -5991,7 +5990,7 @@ setdscp(isc__socket_t *sock, isc_dscp_t dscp) {
#ifdef IPV6_TCLASS
if (sock->pf == AF_INET6) {
if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_TCLASS,
(void *)&dscp, sizeof(int)) < 0) {
(void *)&value, sizeof(value)) < 0) {
char strbuf[ISC_STRERRORSIZE];
isc__strerror(errno, strbuf, sizeof(strbuf));
UNEXPECTED_ERROR(__FILE__, __LINE__,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment