# Interface name we are listening on. See comments above.
# interface = lo0
+ # source IP address for unicast packets sent by the
+ # DHCP server.
+ #
+ # The source IP for unicast packets is chosen from the first
+ # one of the following items which returns a valid IP
+ # address:
+ #
+ # src_ipaddr
+ # ipaddr
+ # reply:DHCP-Server-IP-Address
+ # reply:DHCP-DHCP-Server-Identifier
+ #
+ src_ipaddr = 127.0.0.1
+
# The DHCP server defaults to allowing broadcast packets.
# Set this to "no" only when the server receives *all* packets
# from a relay agent. i.e. when *no* clients are on the same
fr_ipaddr_t ipaddr; //!< IP address to listen on.
+ fr_ipaddr_t src_ipaddr; //!< IP address to source replies
+
char const *interface; //!< Interface to bind to.
char const *port_name; //!< Name of the port for getservent().
{ FR_CONF_OFFSET("ipv4addr", FR_TYPE_IPV4_ADDR, proto_dhcpv4_udp_t, ipaddr) },
{ FR_CONF_OFFSET("ipv6addr", FR_TYPE_IPV6_ADDR, proto_dhcpv4_udp_t, ipaddr) },
+ { FR_CONF_OFFSET("src_ipaddr", FR_TYPE_COMBO_IP_ADDR, proto_dhcpv4_udp_t, src_ipaddr) },
+
{ FR_CONF_OFFSET("interface", FR_TYPE_STRING, proto_dhcpv4_udp_t, interface) },
{ FR_CONF_OFFSET("port_name", FR_TYPE_STRING, proto_dhcpv4_udp_t, port_name) },
return -1;
}
+ /*
+ * If src_ipaddr is defined, it must be of the same address family as "ipaddr"
+ */
+ if ((inst->src_ipaddr.af != AF_UNSPEC) &&
+ (inst->src_ipaddr.af != inst->ipaddr.af)) {
+ cf_log_err(cs, "Both 'ipaddr' and 'src_ipaddr' must be from the same address family");
+ return -1;
+ }
+
if (inst->recv_buff_is_set) {
FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, >=, 32);
FR_INTEGER_BOUND_CHECK("recv_buff", inst->recv_buff, <=, INT_MAX);