+(*----------------------------------------------------------------------
+ * These are the code fragments which run over kernel structures.
+ *----------------------------------------------------------------------*)
+
+let fragments = [
+ <:str_item<
+ let get_net_devices net_device =
+ let rec loop dev acc =
+ let ipv4 = net_device.ip_ptr.ifa_list in
+ let ipv4_addresses =
+ let rec loop2 ipv4 acc =
+ let addr = ipv4.ifa_address :: acc in
+ let ipv4 = ipv4.ifa_next in
+ loop2 ipv4
+ in
+ loop ipv4 [] in
+ let acc = ipv4_addresses :: acc in
+ let next = get_net_devices net_device.dev_list'next in
+ if next <> net_device then loop next
+ else acc
+ >>;
+
+ <:str_item<
+ let get_net_devices_from_init_net net =
+ get_net_devices net.dev_base_head'next
+ >>;
+
+]
+