From: Marcin Siodelski Date: Fri, 13 Feb 2015 11:47:53 +0000 (+0100) Subject: [3604] Replace the dhcp-socket-type value from "datagram" to "udp". X-Git-Tag: trac3712_base~9^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5cae53efb7327e6d363caf36e3244b9137b06d91;p=thirdparty%2Fkea.git [3604] Replace the dhcp-socket-type value from "datagram" to "udp". --- diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index 98b5160f02..d22f52951f 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/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": [ "eth1", "eth3" ], - "dhcp-socket-type": "datagram" + "dhcp-socket-type": "udp" }, ... } - The dhcp-socket-type specifies that the datagram sockets will + The dhcp-socket-type 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 dhcp-socket-type is set to raw, 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. + fall back to use the IP/UDP sockets. diff --git a/src/lib/dhcpsrv/cfg_iface.cc b/src/lib/dhcpsrv/cfg_iface.cc index 968fab1caa..1d082faa70 100644 --- a/src/lib/dhcpsrv/cfg_iface.cc +++ b/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; diff --git a/src/lib/dhcpsrv/cfg_iface.h b/src/lib/dhcpsrv/cfg_iface.h index 0534ece9b4..ec370dbea6 100644 --- a/src/lib/dhcpsrv/cfg_iface.h +++ b/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. diff --git a/src/lib/dhcpsrv/dhcpsrv_messages.mes b/src/lib/dhcpsrv/dhcpsrv_messages.mes index 0d94ac3226..f32bd03ebe 100644 --- a/src/lib/dhcpsrv/dhcpsrv_messages.mes +++ b/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 diff --git a/src/lib/dhcpsrv/tests/cfg_iface_unittest.cc b/src/lib/dhcpsrv/tests/cfg_iface_unittest.cc index 4f87e87078..19c3567f73 100644 --- a/src/lib/dhcpsrv/tests/cfg_iface_unittest.cc +++ b/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 diff --git a/src/lib/dhcpsrv/tests/ifaces_config_parser_unittest.cc b/src/lib/dhcpsrv/tests/ifaces_config_parser_unittest.cc index e0a1b5d30d..92b49c2b8e 100644 --- a/src/lib/dhcpsrv/tests/ifaces_config_parser_unittest.cc +++ b/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); }