Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/iscsid/iscsid.c
Show All 35 Lines | |||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/linker.h> | #include <sys/linker.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/capsicum.h> | #include <sys/capsicum.h> | ||||
#include <sys/wait.h> | #include <sys/wait.h> | ||||
#include <netinet/in.h> | |||||
#include <assert.h> | #include <assert.h> | ||||
#include <capsicum_helpers.h> | #include <capsicum_helpers.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <libutil.h> | #include <libutil.h> | ||||
#include <netdb.h> | #include <netdb.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | #endif /* ICL_KERNEL_PROXY */ | ||||
sockbuf = SOCKBUF_SIZE; | sockbuf = SOCKBUF_SIZE; | ||||
if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_RCVBUF, | if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_RCVBUF, | ||||
&sockbuf, sizeof(sockbuf)) == -1) | &sockbuf, sizeof(sockbuf)) == -1) | ||||
log_warn("setsockopt(SO_RCVBUF) failed"); | log_warn("setsockopt(SO_RCVBUF) failed"); | ||||
sockbuf = SOCKBUF_SIZE; | sockbuf = SOCKBUF_SIZE; | ||||
if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_SNDBUF, | if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_SNDBUF, | ||||
&sockbuf, sizeof(sockbuf)) == -1) | &sockbuf, sizeof(sockbuf)) == -1) | ||||
log_warn("setsockopt(SO_SNDBUF) failed"); | log_warn("setsockopt(SO_SNDBUF) failed"); | ||||
if (conn->conn_conf.isc_dscp != -1) { | |||||
int tos = conn->conn_conf.isc_dscp << 2; | |||||
if (to_ai->ai_family == AF_INET) { | |||||
if (setsockopt(conn->conn_socket, | |||||
IPPROTO_IP, IP_TOS, | |||||
&tos, sizeof(tos)) == -1) | |||||
log_warn("setsockopt(IP_TOS) " | |||||
"failed for %s", | |||||
from_addr); | |||||
} else | |||||
if (to_ai->ai_family == AF_INET6) { | |||||
if (setsockopt(conn->conn_socket, | |||||
IPPROTO_IPV6, IPV6_TCLASS, | |||||
&tos, sizeof(tos)) == -1) | |||||
log_warn("setsockopt(IPV6_TCLASS) " | |||||
"failed for %s", | |||||
from_addr); | |||||
} | |||||
} | |||||
if (from_ai != NULL) { | if (from_ai != NULL) { | ||||
error = bind(conn->conn_socket, from_ai->ai_addr, | error = bind(conn->conn_socket, from_ai->ai_addr, | ||||
from_ai->ai_addrlen); | from_ai->ai_addrlen); | ||||
if (error != 0) { | if (error != 0) { | ||||
fail(conn, strerror(errno)); | fail(conn, strerror(errno)); | ||||
log_err(1, "failed to bind to %s", from_addr); | log_err(1, "failed to bind to %s", from_addr); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 354 Lines • Show Last 20 Lines |