+*)
+
+ (* Get the IPv4 and IPv6 addresses. *)
+ let net_devices = List.map (
+ fun ({ net_device_ip_ptr = ip4 (* pointer to in_device *);
+ net_device_ip6_ptr = ip6 (* pointer to inet6_dev *) } as dev) ->
+ let ip4 =
+ match AddrMap.find ip4 addrmap with
+ | _, Some (_, _, In_device d) ->
+ d.in_device_ifa_list (* pointer to in_ifaddr *)
+ | _ -> assert false in
+ let ip4addrs =
+ let rec loop addr =
+ if addr <> 0L then (
+ let ifaddr =
+ match AddrMap.find addr addrmap with
+ | _, Some (_, _, In_ifaddr d) -> d
+ | _ -> assert false in
+ (ifaddr.in_ifaddr_ifa_address,
+ ifaddr.in_ifaddr_ifa_broadcast,
+ ifaddr.in_ifaddr_ifa_local,
+ ifaddr.in_ifaddr_ifa_mask)
+ :: loop ifaddr.in_ifaddr_ifa_next
+ ) else []
+ in
+ loop ip4 in
+ let ip6 =
+ match AddrMap.find ip6 addrmap with
+ | _, Some (_, _, Inet6_dev d) ->
+ d.inet6_dev_addr_list (* pointer to inet6_ifaddr *)
+ | _ -> assert false in
+ let ip6addrs =
+ let rec loop addr =
+ if addr <> 0L then (
+ let ifaddr =
+ match AddrMap.find addr addrmap with
+ | _, Some (_, _, Inet6_ifaddr d) -> d
+ | _ -> assert false in
+ ifaddr.inet6_ifaddr_prefix_len
+ :: loop ifaddr.inet6_ifaddr_lst_next
+ ) else []
+ in
+ loop ip6 in
+
+ dev, ip4addrs, ip6addrs
+ ) net_devices in
+
+ (* Print out the interfaces and addresses. *)
+ printf
+ "NAME MTU ADDR BROADCAST LOCAL NETMASK\n";