Commit 7c36e002 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5377] Several little fixes as a result of the review.

This covers changes by Tomek which add parsing of the outbound-interface
parameter.
parent 0f151975
......@@ -35,8 +35,8 @@
// interface the query came in. This is the default ("same-as-inbound").
// However, sometimes it is useful to have the ability to send the
// packet as plain UDP packet and let the kernel and the routing tables
// to determine the right interface ("use-routing"). This option is
// expected to work only for dhcp-socket-type set to udp.
// determine the right interface ("use-routing"). This option only works
// for "dhcp-socket-type" set to "udp" and is ignored otherwise.
"outbound-interface": "use-routing",
// This makes interfaces to be re-detected at each (re-)configuration.
......
......@@ -720,19 +720,20 @@ temporarily override a list of interface names and listen on all interfaces.
fall back to use IP/UDP sockets.</para>
</note>
<para>In typical environment the DHCP server is expected to send back its
responses on the same network interface as the query packets come in. This is
the default behavior. However, in some deployments it is expected the outbound
(response) packets will be sent as regular traffic and the outbound interface
will be determined by the routing tables. This kind of asymetric traffic
is uncommon, but valid. Kea now supports a parameter called
<command>outbound-interface</command> that control this behavior. It supports
<para>In typical environment the DHCP server is expected to send back a
response on the same network interface on which the query is received. This is
the default behavior. However, in some deployments it is desired that the
outbound (response) packets will be sent as regular traffic and the outbound
interface will be determined by the routing tables. This kind of asymetric
traffic is uncommon, but valid. Kea now supports a parameter called
<command>outbound-interface</command> that controls this behavior. It supports
two values. The first one, <userinput>same-as-inbound</userinput>, tells Kea
to send back the response on the same inteface the query packet came in. This
to send back the response on the same inteface the query packet is received. This
is the default behavior. The second one, <userinput>use-routing</userinput>
tells Kea to send regular UDP packets and let the kernel's routing table to
determine most appropriate interface. This only works when dhcp-socket-type is
set to udp. An example configuration looks as follows:
determine most appropriate interface. This only works when
<command>dhcp-socket-type</command> is set to <userinput>udp</userinput>.
An example configuration looks as follows:
<screen>
"Dhcp4": {
"interfaces-config": {
......
......@@ -235,9 +235,12 @@ CfgIface::getOutboundIface() const {
std::string
CfgIface::outboundTypeToText() const {
switch (outbound_iface_) {
case SAME_AS_INBOUND: return ("same-as-inbound");
case USE_ROUTING: return ("use-routing");
default: isc_throw(Unexpected, "unsupported outbound-type " << socket_type_);
case SAME_AS_INBOUND:
return ("same-as-inbound");
case USE_ROUTING:
return ("use-routing");
default:
isc_throw(Unexpected, "unsupported outbound-type " << socket_type_);
}
}
......@@ -257,7 +260,7 @@ CfgIface::textToOutboundIface(const std::string& txt) {
}
void
CfgIface::setOutboundIface(const OutboundIface& traffic_type) {
CfgIface::setOutboundIface(const OutboundIface& outbound_iface) {
outbound_iface_ = traffic_type;
}
......
......@@ -137,9 +137,12 @@ public:
SOCKET_UDP
};
/// @brief Indicates how outbound interface is selected for relayed traffic.
enum OutboundIface {
/// Server sends responses over the same interface on which queries are
/// received.
SAME_AS_INBOUND,
/// Server uses routing to determine the right interface to send response.
USE_ROUTING
};
......@@ -233,24 +236,25 @@ public:
/// @brief Returns the socket type in the textual format.
std::string socketTypeToText() const;
/// @brief Sets outbound interface type
/// @brief Sets outbound interface selection mode.
///
/// @param traffic_type sets the type of traffic
void setOutboundIface(const OutboundIface& traffic_type);
/// @param outbound_iface New outbound interface selection mode setting.
void setOutboundIface(const OutboundIface& outbound_iface);
/// @brief Returns outbound interface traffic type
/// @brief Returns outbound interface selection mode.
///
/// @return type of traffic (use-routing or same-as-inbound)
/// @return Outbound interface selection mode.
OutboundIface getOutboundIface() const;
/// @brief Returns outbound type as string
/// @brief Returns outbound interface selection mode as string.
///
/// @return text representation of the outbound type
/// @return text representation of the outbound interface selection mode.
std::string outboundTypeToText() const;
/// @brief Converts text to outbound interface
/// @brief Converts text to outbound interface selection mode.
///
/// @param txt either 'same-as-inbound' or 'use-routing'
/// @return converted value
/// @return Outbound interface selection mode.
static OutboundIface textToOutboundIface(const std::string& txt);
/// @brief Converts the socket type in the textual format to the type
......@@ -367,6 +371,7 @@ private:
/// @brief A boolean value which reflects current re-detect setting
bool re_detect_;
/// @brief Indicates how outbound interface is selected for relayed traffic.
OutboundIface outbound_iface_;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment