-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 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
if ((cmsg->cmsg_level == IPPROTO_IP) &&
(cmsg->cmsg_type == IP_RECVDSTADDR)) {
to_addr = (struct in_addr*)CMSG_DATA(cmsg);
-
pkt->setLocalAddr(IOAddress(htonl(to_addr->s_addr)));
break;
}
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 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
// Check if the received message is correct.
testRcvdMessage(rcvd_pkt);
+ testRcvdMessageAddressPort(rcvd_pkt);
}
// This test verifies that if the packet is received over the raw
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 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
// Check if the received message is correct.
testRcvdMessage(rcvd_pkt);
+ testRcvdMessageAddressPort(rcvd_pkt);
}
} // anonymous namespace
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 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
// Check if the received message is correct.
testRcvdMessage(rcvd_pkt);
+ testRcvdMessageAddressPort(rcvd_pkt);
}
// This test verifies that if the packet is received over the raw
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 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
EXPECT_EQ(test_message_->getHlen(), rcvd_msg->getHlen());
}
+void
+PktFilterTest::testRcvdMessageAddressPort(const Pkt4Ptr& rcvd_msg) const {
+ EXPECT_EQ(test_message_->getRemoteAddr(), rcvd_msg->getLocalAddr());
+ EXPECT_EQ(test_message_->getLocalAddr(), rcvd_msg->getRemoteAddr());
+ EXPECT_EQ(test_message_->getRemotePort(), rcvd_msg->getLocalPort());
+ EXPECT_EQ(test_message_->getLocalPort(), rcvd_msg->getRemotePort());
+}
+
bool
PktFilterStub::isDirectResponseSupported() const {
return (true);
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 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
/// @param sock A descriptor of the open socket.
void testDgramSocket(const int sock) const;
- /// @brief Checks if the received message matches the test_message_.
+ /// @brief Checks if a received message matches the test_message_.
///
/// @param rcvd_msg An instance of the message to be tested.
void testRcvdMessage(const Pkt4Ptr& rcvd_msg) const;
+ /// @brief Checks if received message has appropriate addresses and
+ /// port values set.
+ ///
+ /// @param rcvd_msg An instance of the message to be tested.
+ void testRcvdMessageAddressPort(const Pkt4Ptr& rcvd_msg) const;
+
std::string ifname_; ///< Loopback interface name
uint16_t ifindex_; ///< Loopback interface index.
uint16_t port_; ///< A port number used for the test.