]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5404] Addressed comments and updated I-D references
authorFrancis Dupont <fdupont@isc.org>
Wed, 4 Apr 2018 14:44:56 +0000 (16:44 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 4 Apr 2018 14:44:56 +0000 (16:44 +0200)
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/dhcp6_srv.h
src/bin/dhcp6/dhcp6to4_ipc.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/lib/dhcp/dhcp4.h
src/lib/dhcp/dhcp6.h

index 7bfcb39d1798f72e2914c28c560b081c656a2d3f..aa29e665a100507bc7969fe839f1c89abb7ef47d 100644 (file)
@@ -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);
     }
index 2b3e25abc95f10b5f34db49fe9f0c9d1a5d5235a..a1e75bff61bb977f85d3627da4bacbf5d293e236 100644 (file)
@@ -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());
index cbba992675acaed4ff3dca2531a47f77ea617a0d..64ea2821e376aa3ce089428f6cc97438ec18db92 100644 (file)
@@ -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());
     }
 
index 390ae19d4dc81983ade8b89bf6fbf4069d7235fe..3f4e6afe96744627448dfdf438174813f17d6e55 100644 (file)
@@ -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:
 
index a3fa09120ed0eac18797cbb9f23d783d43a8e87d..e236dfcd3a4a3918d4578f64369f94049a53a9f1 100644 (file)
@@ -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
index 534b7b2371ed8e8faf67d805e804f6f41d0c72fe..e5c5b50fd8384b0f691a955b558a46e70ec2b30a 100644 (file)
@@ -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
index 9b8af7deceee84672fdf268e408c05293d9df5f6..3a7081c9a5c6667a5b7b64c6bf1b0d693198c778 100644 (file)
@@ -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
 
index 7b67badbb64c792dd6b20bfbdfb0be120377db38..7b96f11824a664ee403cca404ca6e7891a0dc184 100644 (file)
@@ -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