Commit 5cc49bc7 authored by Michael Graff's avatar Michael Graff
Browse files

don't set permanent failure on udp sockets, even on unexpected error

parent df22852d
......@@ -350,7 +350,6 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
UNUSED(msg);
UNUSED(dev);
#ifndef ISC_NET_BSD44MSGHDR
return;
......@@ -386,10 +385,14 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
#ifdef ISC_PLATFORM_HAVEIPV6
if (cmsgp->cmsg_level == IPPROTO_IPV6
&& cmsgp->cmsg_type == IPV6_PKTINFO) {
isc_sockaddr_t sa;
pktinfop = (struct in6_pktinfo *)CMSG_DATA(cmsgp);
memcpy(&dev->pktinfo, pktinfop,
sizeof(struct in6_pktinfo));
dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
isc_sockaddr_fromin6(&sa, &dev->pktinfo.ipi6_addr, 53);
socket_log(sock, &sa, TRACE, "interface received on ifindex %u", dev->pktinfo.ipi6_ifindex);
goto next;
}
#endif
......@@ -506,7 +509,12 @@ build_msghdr_send(isc_socket_t *sock, isc_socketevent_t *dev,
if ((sock->type == isc_sockettype_udp)
&& ((dev->attributes & ISC_SOCKEVENTATTR_PKTINFO) != 0)) {
struct cmsghdr *cmsgp;
struct in6_pktinfo *pktinfop;
struct in6_pktinfo *pktinfop;
isc_sockaddr_t sa;
isc_sockaddr_fromin6(&sa, &dev->pktinfo.ipi6_addr, 53);
socket_log(sock, &sa, TRACE, "sendto pktinfo data, ifindex %u", dev->pktinfo.ipi6_ifindex);
msg->msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
msg->msg_control = (void *)sock->cmsg;
......@@ -877,6 +885,7 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
ALWAYS_HARD(ENETUNREACH, ISC_R_NETUNREACH);
ALWAYS_HARD(EHOSTUNREACH, ISC_R_HOSTUNREACH);
ALWAYS_HARD(ENOBUFS, ISC_R_NORESOURCES);
ALWAYS_HARD(EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL);
#undef SOFT_OR_HARD
#undef ALWAYS_HARD
......@@ -893,7 +902,8 @@ doio_send(isc_socket_t *sock, isc_socketevent_t *dev) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"internal_send: %s",
strerror(errno));
sock->send_result = ISC_R_UNEXPECTED;
if (sock->connected && sock->type == isc_sockettype_tcp)
sock->send_result = ISC_R_UNEXPECTED;
send_senddone_event(sock, &dev, ISC_R_UNEXPECTED);
return (DOIO_HARD);
}
......@@ -2336,7 +2346,15 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region,
set_dev_address(address, sock, dev);
if (pktinfo != NULL) {
isc_sockaddr_t sa;
isc_sockaddr_fromin6(&sa, &pktinfo->ipi6_addr, 53);
socket_log(sock, &sa, TRACE,
"pktinfo structure provided, ifindex %u",
pktinfo->ipi6_ifindex);
dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
dev->pktinfo.ipi6_ifindex = 0;
dev->pktinfo = *pktinfo;
}
......
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