}
// Assuming that packet filter is not NULL, because its modifier checks it.
- return (packet_filter6_->send(*iface, getSocket(*pkt), pkt));
+ // The packet filter returns an int but in fact it either returns 0 or throws.
+ return (packet_filter6_->send(*iface, getSocket(*pkt), pkt) == 0);
}
bool
}
// Assuming that packet filter is not NULL, because its modifier checks it.
- return (packet_filter_->send(*iface, getSocket(*pkt).sockfd_, pkt));
+ // The packet filter returns an int but in fact it either returns 0 or throws.
+ return (packet_filter_->send(*iface, getSocket(*pkt).sockfd_, pkt) == 0);
}
Pkt4Ptr IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
-// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
" with an error: " << strerror(errno));
}
- return (result);
+ return (0);
}
pkt->updateTimestamp();
int result = sendmsg(sockfd, &m, 0);
- if (result < 0) {
+ if (result < 0) {
isc_throw(SocketWriteError, "pkt6 send failed: sendmsg() returned"
" with an error: " << strerror(errno));
}
- return (result);
+ return (0);
}
-// Copyright (C) 2011-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
);
// OK, Send the PACKET!
- EXPECT_NO_THROW(ifacemgr->send(sendPkt));
+ bool result = false;
+ EXPECT_NO_THROW(result = ifacemgr->send(sendPkt));
+ EXPECT_TRUE(result);
// Now let's try and receive it.
boost::shared_ptr<Pkt4> rcvPkt;
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
ASSERT_GE(sock_info_.sockfd_, 0);
// Send the packet over the socket.
- ASSERT_NO_THROW(pkt_filter.send(iface, sock_info_.sockfd_, test_message_));
+ int result = -1;
+ ASSERT_NO_THROW(result = pkt_filter.send(iface, sock_info_.sockfd_, test_message_));
+ ASSERT_EQ(0, result);
// Read the data from socket.
fd_set readfds;
struct timeval timeout;
timeout.tv_sec = 5;
timeout.tv_usec = 0;
- int result = select(sock_info_.sockfd_ + 1, &readfds, NULL, NULL, &timeout);
+ result = select(sock_info_.sockfd_ + 1, &readfds, NULL, NULL, &timeout);
// We should receive some data from loopback interface.
ASSERT_GT(result, 0);
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
ASSERT_GE(sock_info_.sockfd_, 0);
// Send the packet over the socket.
- ASSERT_NO_THROW(pkt_filter.send(iface, sock_info_.sockfd_, test_message_));
+ int result = -1;
+ ASSERT_NO_THROW(result = pkt_filter.send(iface, sock_info_.sockfd_, test_message_));
+ ASSERT_EQ(0, result);
// Read the data from socket.
fd_set readfds;
struct timeval timeout;
timeout.tv_sec = 5;
timeout.tv_usec = 0;
- int result = select(sock_info_.sockfd_ + 1, &readfds, NULL, NULL, &timeout);
+ result = select(sock_info_.sockfd_ + 1, &readfds, NULL, NULL, &timeout);
// We should receive some data from loopback interface.
ASSERT_GT(result, 0);