[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] mirage-skeleton/applications/dhcp fails to build with static hosts uncommented.


  • To: mirageos-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Joe <joe@xxxxxxx>
  • Date: Tue, 26 Mar 2019 14:57:35 +0100
  • Delivery-date: Tue, 26 Mar 2019 13:58:14 +0000
  • Dkim-filter: OpenDKIM Filter v2.10.3 smtp2.servers.tyknet.dk D0A4E23895
  • List-id: Developer list for MirageOS <mirageos-devel.lists.xenproject.org>

On 3/26/19 7:55 AM, Adam Steen wrote:
Hi All

As it says on the tin, when i uncomment let static_host_1 = { ... } in 
dhcp_config.ml, the build fails with the below error.

Not sure how to fix this, I will try and look at it soon, but someone might 
know whats up here first.

File "dhcp_config.ml", line 37, characters 2-10:
Error: Unbound record field hostname
Hint: Did you mean sname?
Command exited with code 2.
run ['ocamlbuild' '-use-ocamlfind' '-classic-display' '-tags'
      
'predicate(mirage_solo5),warn(A-4-41-42-44),debug,bin_annot,strict_sequence,principal,safe_string,color(always)'
      '-pkgs'
      
'arp-mirage,charrua-core,charrua-core.server,charrua-core.wire,ethernet,functoria-runtime,lwt,mirage-bootvar-solo5,mirage-clock-freestanding,mirage-console-solo5,mirage-logs,mirage-net-solo5,mirage-runtime,mirage-solo5,mirage-types,mirage-types-lwt'
      '-cflags' '-g' '-lflags'
      '-g,-dontlink,unix,-dontlink,str,-dontlink,num,-dontlink,threads'
      '-tag-line' '<static*.*>: warn(-32-34)' '-Xs'
      '_build-solo5-hvt,_build-ukvm' 'main.native.o']: exited with 10
gmake: *** [Makefile:18: build] Error 1

I'm not sure how big of a fan I am of the way this example reads its configuration; it seems pretty hard to use, but here's a diff that makes it compile with your static options:

diff --git a/applications/dhcp/dhcp_config.ml b/applications/dhcp/dhcp_config.ml
index 7a5b1ce..dfb5c54 100644
--- a/applications/dhcp/dhcp_config.ml
+++ b/applications/dhcp/dhcp_config.ml
@@ -12,7 +12,7 @@ let ip_address =         ip "192.168.1.5"
 let network =            net "192.168.1.5/24"
 let range =              Some (ip "192.168.1.70", ip "192.168.1.100")
 (* List of dhcp options to be advertised *)
-let options = [
+let options : dhcp_option list = [
   (* Routers is a list of default routers *)
   Routers [ip "192.168.1.5"];
   (* Dns_servers is a list of dns servers *)
@@ -33,14 +33,14 @@ let options = [
* `Time_offset', `Max_datagram; will always override the global (if present).
  *)

-(* let static_host_1 = { *)
-(*   hostname = "Static host 1"; *)
-(*   options = [ *)
-(*     Routers [ip "192.168.1.4"]; *)
-(*   ]; *)
-(*   hw_addr = mac "7a:bb:c1:aa:50:01"; *)
-(* fixed_addr = Some (ip "192.168.1.151"); (\* Must be outside of range. *\) *)
-(* } *)
+let static_host_1 : Dhcp_server.Config.host = {
+   hostname = "Static host 1";
+   options = [
+     Routers [ip "192.168.1.4"];
+   ];
+   hw_addr = mac "7a:bb:c1:aa:50:01";
+   fixed_addr = Some (ip "192.168.1.151"); (* Must be outside of range. *)
+ }

 (* let static_host_2 = { *)
 (*   hostname = "Static host 2"; *)
@@ -49,5 +49,5 @@ let options = [
(* fixed_addr = Some (ip "192.168.1.152"); (\* Must be outside of range. *\) *)
 (* } *)

-(* let hosts = [static_host_1;static_host_2] *)
 let hosts = []
+let hosts = [static_host_1 (*;static_host_2*) ]


_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.