# This is also the destination port when sending to a giaddr.
port = 6700
+ # The port to which server -> client messages should be sent.
+ # This should be 68 on a production network, though other ports
+ # can be useful for testing.
+ #
+ # If this is not set then server -> client replies will be sent
+ # to the source port of the client -> server request.
+ client_port = 68
+
# Interface name we are listening on. See comments above.
# interface = lo0
uint32_t max_attributes; //!< Limit maximum decodable attributes.
uint16_t port; //!< Port to listen on.
+ uint16_t client_port; //!< Client port to reply to.
bool broadcast; //!< whether we listen for broadcast packets
{ FR_CONF_OFFSET("port_name", proto_dhcpv4_udp_t, port_name) },
{ FR_CONF_OFFSET("port", proto_dhcpv4_udp_t, port) },
+ { FR_CONF_OFFSET("client_port", proto_dhcpv4_udp_t, client_port) },
{ FR_CONF_OFFSET_IS_SET("recv_buff", FR_TYPE_UINT32, 0, proto_dhcpv4_udp_t, recv_buff) },
{ FR_CONF_OFFSET("broadcast", proto_dhcpv4_udp_t, broadcast) } ,
packet->opcode = 2; /* server message */
+ /*
+ * If the client port is specified, use it.
+ *
+ * RFC 2131 page 23.
+ *
+ * "DHCP messages from a server to a client are sent
+ * to the 'DHCP client' port (68)"
+ */
+ if (inst->client_port) socket.inet.dst_port = inst->client_port;
+
/*
* NAKs are broadcast when there's no giaddr.
*