Browse Source

[3604] Replace the dhcp-socket-type value from "datagram" to "udp".

Marcin Siodelski 10 years ago
parent
commit
5cae53efb7

+ 3 - 3
doc/guide/dhcp4-srv.xml

@@ -415,12 +415,12 @@ temporarily override a list of interface names and listen on all interfaces.
 "Dhcp4": {
     "interfaces-config": {
         "interfaces": [ <userinput>"eth1", "eth3"</userinput> ],
-        "dhcp-socket-type": "datagram"
+        "dhcp-socket-type": "udp"
     },
     ...
 }
   </screen>
-  The <command>dhcp-socket-type</command> specifies that the datagram sockets will
+  The <command>dhcp-socket-type</command> specifies that the IP/UDP sockets will
   be opened on all interfaces on which the server listens, i.e. "eth1" and
   "eth3" in our case. If the <command>dhcp-socket-type</command> is set to
   <userinput>raw</userinput>, it configures the server to use raw sockets
@@ -434,7 +434,7 @@ temporarily override a list of interface names and listen on all interfaces.
     to handle the traffic from the directly connected clients is currently
     supported on Linux and BSD systems only. If the raw sockets are not
     supported on the particular OS, the server will issue a warning and
-    fall back to use the datagram sockets.</para>
+    fall back to use the IP/UDP sockets.</para>
   </note>
 </section>
 

+ 4 - 4
src/lib/dhcpsrv/cfg_iface.cc

@@ -192,8 +192,8 @@ CfgIface::socketTypeToText() const {
     case SOCKET_RAW:
         return ("raw");
 
-    case SOCKET_DGRAM:
-        return ("datagram");
+    case SOCKET_UDP:
+        return ("udp");
 
     default:
         ;
@@ -364,8 +364,8 @@ void
 CfgIface::useSocketType(const uint16_t family,
                         const std::string& socket_type_name) {
     SocketType socket_type;
-    if (socket_type_name == "datagram") {
-        socket_type = SOCKET_DGRAM;
+    if (socket_type_name == "udp") {
+        socket_type = SOCKET_UDP;
 
     } else if (socket_type_name == "raw") {
         socket_type = SOCKET_RAW;

+ 3 - 3
src/lib/dhcpsrv/cfg_iface.h

@@ -80,7 +80,7 @@ public:
 /// which don't have an address yet. Unicasting the response to such
 /// client is possible by the use of raw sockets. In larger deployments
 /// it is often the case that whole traffic is received via relays, and
-/// in such case the use of datagram sockets is preferred. The type of the
+/// in such case the use of UDP sockets is preferred. The type of the
 /// sockets to be opened is specified using one of the
 /// @c CfgIface::useSocketType method variants. The @c CfgIface::SocketType
 /// enumeration specifies the possible values.
@@ -97,7 +97,7 @@ public:
         /// Raw socket, used for direct DHCPv4 traffic.
         SOCKET_RAW,
         /// Datagram socket, i.e. IP/UDP socket.
-        SOCKET_DGRAM
+        SOCKET_UDP
     };
 
     /// @brief Keyword used to enable all interfaces.
@@ -187,7 +187,7 @@ public:
     /// The following names of the socket types are currently supported, and
     /// can be passed in the @c socket_type parameter:
     /// - raw - for raw sockets,
-    /// - datagram - for the datagram sockets,
+    /// - udp - for the IP/UDP datagram sockets,
     ///
     /// @param family Address family (AF_INET or AF_INET6)
     /// @param socket_type_name Socket type in the textual format.

+ 3 - 3
src/lib/dhcpsrv/dhcpsrv_messages.mes

@@ -104,7 +104,7 @@ This informational message is logged when the administrator hasn't
 specified the "dhcp-socket-type" parameter in configuration for interfaces.
 In such case, the default socket type will be used.
 
-% DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED use of raw sockets is unsupported on this OS, datagram sockets will be used
+% DHCPSRV_CFGMGR_SOCKET_RAW_UNSUPPORTED use of raw sockets is unsupported on this OS, UDP sockets will be used
 This warning message is logged when the user specified that the
 DHCPv4 server should use the raw sockets to receive the DHCP
 messages and respond to the clients, but the use of raw sockets
@@ -112,7 +112,7 @@ is not supported on the particular environment. The raw sockets
 are useful when the server must respond to the directly connected
 clients which don't have an address yet. If the raw sockets are
 not supported by Kea on the particular platform, Kea will fall
-back to use of the datagram IP/UDP sockets. The responses to
+back to use of the IP/UDP sockets. The responses to
 the directly connected clients will be broadcast. The responses
 to relayed clients will be unicast as usual.
 
@@ -123,7 +123,7 @@ interfaces. Typically, the socket type is specified by the server
 administrator. If the socket type hasn't been specified, the raw
 socket will be selected. If the raw socket has been selected but
 Kea doesn't support the use of raw sockets on the particular
-OS, it will use a datagram socket instead.
+OS, it will use an UDP socket instead.
 
 % DHCPSRV_CFGMGR_SUBNET4 retrieved subnet %1 for address hint %2
 This is a debug message reporting that the DHCP configuration manager has

+ 7 - 7
src/lib/dhcpsrv/tests/cfg_iface_unittest.cc

@@ -339,12 +339,12 @@ TEST_F(CfgIfaceTest, equality) {
     EXPECT_FALSE(cfg1 != cfg2);
 
     // Differ by socket type.
-    cfg1.useSocketType(AF_INET, "datagram");
+    cfg1.useSocketType(AF_INET, "udp");
     EXPECT_FALSE(cfg1 == cfg2);
     EXPECT_TRUE(cfg1 != cfg2);
 
     // Now, both should use the same socket type.
-    cfg2.useSocketType(AF_INET, "datagram");
+    cfg2.useSocketType(AF_INET, "udp");
     EXPECT_TRUE(cfg1 == cfg2);
     EXPECT_FALSE(cfg1 != cfg2);
 }
@@ -357,8 +357,8 @@ TEST_F(CfgIfaceTest, equality) {
 TEST(CfgIfaceNoStubTest, useSocketType) {
     CfgIface cfg;
     // Select datagram sockets.
-    ASSERT_NO_THROW(cfg.useSocketType(AF_INET, "datagram"));
-    EXPECT_EQ("datagram", cfg.socketTypeToText());
+    ASSERT_NO_THROW(cfg.useSocketType(AF_INET, "udp"));
+    EXPECT_EQ("udp", cfg.socketTypeToText());
     ASSERT_NO_THROW(cfg.openSockets(AF_INET, 10067, true));
     // For datagram sockets, the direct traffic is not supported.
     ASSERT_TRUE(!IfaceMgr::instance().isDirectResponseSupported());
@@ -370,8 +370,8 @@ TEST(CfgIfaceNoStubTest, useSocketType) {
     // For raw sockets, the direct traffic is supported.
     ASSERT_TRUE(IfaceMgr::instance().isDirectResponseSupported());
 
-    ASSERT_NO_THROW(cfg.useSocketType(AF_INET, CfgIface::SOCKET_DGRAM));
-    EXPECT_EQ("datagram", cfg.socketTypeToText());
+    ASSERT_NO_THROW(cfg.useSocketType(AF_INET, CfgIface::SOCKET_UDP));
+    EXPECT_EQ("udp", cfg.socketTypeToText());
     ASSERT_NO_THROW(cfg.openSockets(AF_INET, 10067, true));
     ASSERT_TRUE(!IfaceMgr::instance().isDirectResponseSupported());
 
@@ -383,7 +383,7 @@ TEST(CfgIfaceNoStubTest, useSocketType) {
     // Test invalid values.
     EXPECT_THROW(cfg.useSocketType(AF_INET, "default"),
         InvalidSocketType);
-    EXPECT_THROW(cfg.useSocketType(AF_INET6, "datagram"),
+    EXPECT_THROW(cfg.useSocketType(AF_INET6, "udp"),
         InvalidSocketType);
 }
 #endif

+ 3 - 3
src/lib/dhcpsrv/tests/ifaces_config_parser_unittest.cc

@@ -128,7 +128,7 @@ TEST_F(IfacesConfigParserTest, socketTypeDatagram) {
 
     // Configuration with a datagram socket selected.
     std::string config = "{ ""\"interfaces\": [ ],"
-        " \"dhcp-socket-type\": \"datagram\" }";
+        " \"dhcp-socket-type\": \"udp\" }";
 
     ElementPtr config_element = Element::fromJSON(config);
 
@@ -140,7 +140,7 @@ TEST_F(IfacesConfigParserTest, socketTypeDatagram) {
     // configuration using the raw socket.
     SrvConfigPtr cfg = CfgMgr::instance().getStagingCfg();
     ASSERT_TRUE(cfg);
-    cfg_ref.useSocketType(AF_INET, CfgIface::SOCKET_DGRAM);
+    cfg_ref.useSocketType(AF_INET, CfgIface::SOCKET_UDP);
     EXPECT_TRUE(*cfg->getCfgIface() == cfg_ref);
 }
 
@@ -156,7 +156,7 @@ TEST_F(IfacesConfigParserTest, socketTypeInvalid) {
     // For DHCPv6 we don't accept any socket type.
     IfacesConfigParser6 parser6;
     config = "{ \"interfaces\": [ ],"
-        " \"dhcp-socket-type\": \"datagram\" }";
+        " \"dhcp-socket-type\": \"udp\" }";
     config_element = Element::fromJSON(config);
     ASSERT_THROW(parser6.build(config_element), DhcpConfigError);
 }