From: Francis Dupont Date: Wed, 4 Apr 2018 14:44:56 +0000 (+0200) Subject: [5404] Addressed comments and updated I-D references X-Git-Tag: trac5458a_base~19^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=955441318a10d0455d67514529bec5e25cd4255b;p=thirdparty%2Fkea.git [5404] Addressed comments and updated I-D references --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 7bfcb39d17..aa29e665a1 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2018 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 @@ -2075,7 +2075,7 @@ Dhcpv4Srv::adjustIfaceData(Dhcpv4Exchange& ex) { response->setRemotePort(DHCP4_CLIENT_PORT); } else { - // draft-ietf-dhc-relay-port-10.txt section 5.1 + // RFC 8357 section 5.1 uint16_t relay_port = checkRelayPort(ex); response->setRemotePort(relay_port ? relay_port : DHCP4_SERVER_PORT); } diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index 2b3e25abc9..a1e75bff61 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2018 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 @@ -255,12 +255,16 @@ TEST_F(Dhcpv4SrvTest, adjustIfaceDataRelayPort) { // Set hops value for the response. resp->setHops(req->getHops()); + // Set the remote port to 67 as we know it will be updated. + resp->setRemotePort(67); + // This function never throws. ASSERT_NO_THROW(NakedDhcpv4Srv::adjustIfaceData(ex)); // Now the destination address should be relay's address. EXPECT_EQ("192.0.1.1", resp->getRemoteAddr().toText()); - // The query has been relayed, so the response must be sent to the port 67. + // The query has been relayed, so the response should be sent to the + // port 67, but here there is a relay port RAI so another value is used. EXPECT_EQ(1234, resp->getRemotePort()); // Local address should be the address assigned to interface eth1. EXPECT_EQ("192.0.2.5", resp->getLocalAddr().toText()); diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index cbba992675..64ea2821e3 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2018 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 @@ -764,7 +764,7 @@ Dhcpv6Srv::processPacket(Pkt6Ptr& query, Pkt6Ptr& rsp) { rsp->setRemotePort(DHCP6_CLIENT_PORT); } else { // Relayed traffic, send back to the relay agent - uint16_t relay_port = testRelaySourcePort(query); + uint16_t relay_port = checkRelaySourcePort(query); rsp->setRemotePort(relay_port ? relay_port : DHCP6_SERVER_PORT); } @@ -3374,7 +3374,7 @@ void Dhcpv6Srv::processRSOO(const Pkt6Ptr& query, const Pkt6Ptr& rsp) { } } -uint16_t Dhcpv6Srv::testRelaySourcePort(const Pkt6Ptr& query) { +uint16_t Dhcpv6Srv::checkRelaySourcePort(const Pkt6Ptr& query) { if (query->relay_info_.empty()) { // No relay agent @@ -3383,7 +3383,7 @@ uint16_t Dhcpv6Srv::testRelaySourcePort(const Pkt6Ptr& query) { // Did the last relay agent add a relay-source-port? if (query->getRelayOption(D6O_RELAY_SOURCE_PORT, 0)) { - // draft-ietf-dhc-relay-port-10.txt section 5.2 + // RFC 8357 section 5.2 return (query->getRemotePort()); } diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index 390ae19d4d..3f4e6afe96 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2018 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 @@ -762,7 +762,7 @@ public: /// /// @param query DHCPv6 message to be checked. /// @return the port to use to join the relay or 0 for the default. - static uint16_t testRelaySourcePort(const Pkt6Ptr& query); + static uint16_t checkRelaySourcePort(const Pkt6Ptr& query); private: diff --git a/src/bin/dhcp6/dhcp6to4_ipc.cc b/src/bin/dhcp6/dhcp6to4_ipc.cc index a3fa09120e..e236dfcd3a 100644 --- a/src/bin/dhcp6/dhcp6to4_ipc.cc +++ b/src/bin/dhcp6/dhcp6to4_ipc.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2015-2018 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 @@ -79,7 +79,7 @@ void Dhcp6to4Ipc::handler() { // Should we check it is a DHCPV6_DHCPV4_RESPONSE? // Handle relay port - uint16_t relay_port = Dhcpv6Srv::testRelaySourcePort(pkt); + uint16_t relay_port = Dhcpv6Srv::checkRelaySourcePort(pkt); // The received message has been unpacked by the receive() function. This // method could have modified the message so it's better to pack() it diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index 534b7b2371..e5c5b50fd8 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2018 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 diff --git a/src/lib/dhcp/dhcp4.h b/src/lib/dhcp/dhcp4.h index 9b8af7dece..3a7081c9a5 100644 --- a/src/lib/dhcp/dhcp4.h +++ b/src/lib/dhcp/dhcp4.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2017 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2018 Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * This Source Code Form is subject to the terms of the Mozilla Public @@ -272,7 +272,7 @@ static const uint16_t RAI_OPTION_ACCESS_POINT_NAME = 15; // RFC7839 static const uint16_t RAI_OPTION_ACCESS_POINT_BSSID = 16; // RFC7839 static const uint16_t RAI_OPTION_OPERATOR_ID = 17; // RFC7839 static const uint16_t RAI_OPTION_OPERATOR_REALM = 18; // RFC7839 -static const uint16_t RAI_OPTION_RELAY_PORT = 19; // I-D, to be assigned +static const uint16_t RAI_OPTION_RELAY_PORT = 19; // RFC8357 static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT = 151; //RFC6607 static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT_CTRL = 152; //RFC6607 diff --git a/src/lib/dhcp/dhcp6.h b/src/lib/dhcp/dhcp6.h index 7b67badbb6..7b96f11824 100644 --- a/src/lib/dhcp/dhcp6.h +++ b/src/lib/dhcp/dhcp6.h @@ -152,9 +152,8 @@ enum DHCPv6OptionType { // D6O_F_SERVER_STATE = 132, /* RFC8156 */ // D6O_F_START_TIME_OF_STATE = 133, /* RFC8156 */ // D6O_F_STATE_EXPIRATION_TIME = 134, /* RFC8156 */ -// not yet assigned but next free value - D6O_RELAY_SOURCE_PORT = 135, /* draft-ietf-dhc-relay-port-10.txt */ - // 135-142 unassigned + D6O_RELAY_SOURCE_PORT = 135, /* RFC8357 */ + // 136-142 unassigned D6O_IPV6_ADDRESS_ANDSF = 143, /* RFC6153 */ // The following are EXPERIMENTAL and may change when IANA assigns official