From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 0AE327EE49 for ; Fri, 20 Sep 2013 13:51:02 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mihamina@rktmb.org) identity=pra; client-ip=217.70.183.196; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mihamina@rktmb.org"; x-sender="mihamina@rktmb.org"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mihamina@rktmb.org) identity=mailfrom; client-ip=217.70.183.196; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mihamina@rktmb.org"; x-sender="mihamina@rktmb.org"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@relay4-d.mail.gandi.net) identity=helo; client-ip=217.70.183.196; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mihamina@rktmb.org"; x-sender="postmaster@relay4-d.mail.gandi.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlAOAP81PFLZRrfEnGdsb2JhbABagz8HRQaDKYVdoxCKcIouA4EeFg4BAQEBAQYNCQkUKIIKEjNVHwEdFgsCCwMCAQIBPxkIAQGHfwYCAZkrjwOSPY53gQuCU4E1A4kyjkqBL4UChhWBb4Zogic X-IPAS-Result: AlAOAP81PFLZRrfEnGdsb2JhbABagz8HRQaDKYVdoxCKcIouA4EeFg4BAQEBAQYNCQkUKIIKEjNVHwEdFgsCCwMCAQIBPxkIAQGHfwYCAZkrjwOSPY53gQuCU4E1A4kyjkqBL4UChhWBb4Zogic X-IronPort-AV: E=Sophos;i="4.90,944,1371074400"; d="scan'208,217";a="33678231" Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mail2-smtp-roc.national.inria.fr with ESMTP; 20 Sep 2013 13:51:00 +0200 Received: from mfilter27-d.gandi.net (mfilter27-d.gandi.net [217.70.178.155]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 5FDC4172089 for ; Fri, 20 Sep 2013 13:51:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter27-d.gandi.net Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter27-d.gandi.net (mfilter27-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id HtUVZFnDxN2D for ; Fri, 20 Sep 2013 13:50:59 +0200 (CEST) X-Originating-IP: 41.190.237.66 Received: from [192.168.128.77] (ip-41-190-237-66.orange.mg [41.190.237.66]) (Authenticated sender: out@rktmb.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 487621720A3 for ; Fri, 20 Sep 2013 13:50:59 +0200 (CEST) Message-ID: <523C369F.5060200@rktmb.org> Date: Fri, 20 Sep 2013 14:50:55 +0300 From: Mihamina Rakotomandimby User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: multipart/alternative; boundary="------------040107070700080903080205" Subject: [Caml-list] exercice with subnets union This is a multi-part message in MIME format. --------------040107070700080903080205 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi all, I have a list of subnet: http://pastebin.com/e9LPv55K (These are Google IP ranges lokked up from his AS#) Some consecutive/adjacent "/24" could be "/23"'d and even multple consecutive "/24" coudl be "/18"'d and so on... Have you got in your bookmarks or notes some IP adresses manipulation functions, so that I could shorten that list? I would like to make that exercice in OCaml. Thank you. -- RMA. --------------040107070700080903080205 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi all,

I have a list of subnet: http://pastebin.com/e9LPv55K
(These are Google IP ranges lokked up from his AS#)

Some consecutive/adjacent "/24" could be "/23"'d and even multple consecutive "/24" coudl be "/18"'d and so on...

Have you got in your bookmarks or notes some IP adresses manipulation functions, so that I could shorten that list?

I would like to make that exercice in OCaml.

Thank you.
-- 
RMA.
--------------040107070700080903080205-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 4B55E7EE49 for ; Fri, 20 Sep 2013 14:20:30 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of kosmo.zb@gmail.com) identity=pra; client-ip=74.125.82.179; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of kosmo.zb@gmail.com designates 74.125.82.179 as permitted sender) identity=mailfrom; client-ip=74.125.82.179; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f179.google.com) identity=helo; client-ip=74.125.82.179; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="postmaster@mail-we0-f179.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgICAMk8PFJKfVKzlGdsb2JhbABagz9MBq5qk2MIFg4BAQEBBwsLCRIqgiUBAQQBQAE4AQMBCwEFBQsNLiISAQUBHAYTh3MDCQYHBZwnj1iERScNV4kNAQUMk34Dl3yBL4sXg0cYKYFhgmw7 X-IPAS-Result: AgICAMk8PFJKfVKzlGdsb2JhbABagz9MBq5qk2MIFg4BAQEBBwsLCRIqgiUBAQQBQAE4AQMBCwEFBQsNLiISAQUBHAYTh3MDCQYHBZwnj1iERScNV4kNAQUMk34Dl3yBL4sXg0cYKYFhgmw7 X-IronPort-AV: E=Sophos;i="4.90,944,1371074400"; d="scan'208";a="33682978" Received: from mail-we0-f179.google.com ([74.125.82.179]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Sep 2013 14:20:29 +0200 Received: by mail-we0-f179.google.com with SMTP id x55so400308wes.38 for ; Fri, 20 Sep 2013 05:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=HqUckq6QXPw15MyfPsAC3CuFHsIkb+keoONJIpqtT9A=; b=DQ6BTuf93AvHb63A8kw8ZMCmAktz+f9cP38b+ruFTFvUBd+lwsDMS5VnHxNcvhhO71 gyRzftqGAMn6/sauT9mQbyHgkDe0W/gs5xdJP60iyWlBEm5VjSzrCkGl3MN/Gl+rP3kp xaLdrdGws2QQQQRnuWQZHnzQmLDM7aJZoqC75ErTFidQsS+LBjoGeWrf+qktWnqbb17V 0xGXkJMl//TecZTfa39FxQUg7MnLWTitAhmIWgt50Oi6yxGbrB60p8e/ZBkqw+4J6HJg /NfSDfJqLrhLrvQySYbPCLc3ayTYNYu/uFz6AhDJV7ZXL252CNk3OaMDl9xqsY2b96Rf iCTA== MIME-Version: 1.0 X-Received: by 10.180.11.37 with SMTP id n5mr2519050wib.25.1379679629940; Fri, 20 Sep 2013 05:20:29 -0700 (PDT) Sender: kosmo.zb@gmail.com Received: by 10.217.90.195 with HTTP; Fri, 20 Sep 2013 05:20:29 -0700 (PDT) In-Reply-To: <523C369F.5060200@rktmb.org> References: <523C369F.5060200@rktmb.org> Date: Fri, 20 Sep 2013 13:20:29 +0100 X-Google-Sender-Auth: 35LU4aJCYZDXbJr87fNlT5NYtOM Message-ID: From: David Sheets To: Mihamina Rakotomandimby Cc: O Caml Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] exercice with subnets union On Fri, Sep 20, 2013 at 12:50 PM, Mihamina Rakotomandimby wrote: > Hi all, > > I have a list of subnet: http://pastebin.com/e9LPv55K > (These are Google IP ranges lokked up from his AS#) > > Some consecutive/adjacent "/24" could be "/23"'d and even multple > consecutive "/24" coudl be "/18"'d and so on... > > Have you got in your bookmarks or notes some IP adresses manipulation > functions, so that I could shorten that list? Hi Mihamina, You may be interested in ipaddr , a very small OCaml library for manipulation of IP address representations. You can install ipaddr with $ opam install ipaddr Hope this helps, David > I would like to make that exercice in OCaml. > > Thank you. > > -- > RMA. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id C03D17EE49 for ; Fri, 20 Sep 2013 15:00:03 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of kosmo.zb@gmail.com) identity=pra; client-ip=74.125.82.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of kosmo.zb@gmail.com designates 74.125.82.176 as permitted sender) identity=mailfrom; client-ip=74.125.82.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="kosmo.zb@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f176.google.com) identity=helo; client-ip=74.125.82.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="kosmo.zb@gmail.com"; x-sender="postmaster@mail-we0-f176.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmUBAGNGPFJKfVKwm2dsb2JhbABagz9MBq5qk2MIFg4BAQEBAQYLCwkUKIIlAQEEAUABOAEDAQsBBQULDS4iEgEFARwGEwiHawMJBgcFnDSPWIRDJw1XiQ0BBQyTfgOXfIEvixeDRxgpgWGCbDs X-IPAS-Result: AmUBAGNGPFJKfVKwm2dsb2JhbABagz9MBq5qk2MIFg4BAQEBAQYLCwkUKIIlAQEEAUABOAEDAQsBBQULDS4iEgEFARwGEwiHawMJBgcFnDSPWIRDJw1XiQ0BBQyTfgOXfIEvixeDRxgpgWGCbDs X-IronPort-AV: E=Sophos;i="4.90,944,1371074400"; d="scan'208";a="33689323" Received: from mail-we0-f176.google.com ([74.125.82.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Sep 2013 15:00:02 +0200 Received: by mail-we0-f176.google.com with SMTP id u56so452230wes.21 for ; Fri, 20 Sep 2013 06:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=X3bK+ZwlQs9IxaWbq1VjQDe4/DuIBnE4RhgAFApDnE8=; b=O73WwtnFMTkoyrp/JbBsnzqPTADfeLUZFQXUQKxf2TxH5ne8KHUcU7slvnnFAHGMVa owtb+NtX8g5VpLj8EDQN3J4+FA6ygMDI58njDF9jM2IlDsjR8cMjKCrpkKb6CaXyuwN8 XodiZxUMeRq46fLGvRAW+bR7+WiKHpm0iKqUdDs401Cg7ubNj/s94jdQWKw90MD32T/k 9yEAhtI2+H97f2pWcZAWz0js7gsTpw9QElz/TFdTMFQZWx7Epr9+XLJQXzA/iz/nX8XD 7keoJI71md7uF8vInZnLRdq65hLPuytvr0cbumPmbSSc0DefzEJU9LS4z4HDj2Wbo2nd TfJQ== MIME-Version: 1.0 X-Received: by 10.180.210.243 with SMTP id mx19mr2642307wic.35.1379682002961; Fri, 20 Sep 2013 06:00:02 -0700 (PDT) Sender: kosmo.zb@gmail.com Received: by 10.217.90.195 with HTTP; Fri, 20 Sep 2013 06:00:02 -0700 (PDT) In-Reply-To: References: <523C369F.5060200@rktmb.org> Date: Fri, 20 Sep 2013 14:00:02 +0100 X-Google-Sender-Auth: Uef0awHDY8NwSIY53Zm-lsm1Nm0 Message-ID: From: David Sheets To: Mihamina Rakotomandimby Cc: O Caml Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] exercice with subnets union On Fri, Sep 20, 2013 at 1:20 PM, David Sheets wrote: > On Fri, Sep 20, 2013 at 12:50 PM, Mihamina Rakotomandimby > wrote: >> Hi all, >> >> I have a list of subnet: http://pastebin.com/e9LPv55K >> (These are Google IP ranges lokked up from his AS#) >> >> Some consecutive/adjacent "/24" could be "/23"'d and even multple >> consecutive "/24" coudl be "/18"'d and so on... >> >> Have you got in your bookmarks or notes some IP adresses manipulation >> functions, so that I could shorten that list? > > Hi Mihamina, > > You may be interested in ipaddr > , a very small OCaml library > for manipulation of IP address representations. > > You can install ipaddr with > > $ opam install ipaddr I've just released 0.2.3 of ipaddr with a subnet prefix bits accessor. I would be very happy to collaborate on modifying the library to incorporate common operations that you may need. Patches and feature requests welcome on the GitHub issue tracker. Best regards, David > Hope this helps, > > David > >> I would like to make that exercice in OCaml. >> >> Thank you. >> >> -- >> RMA.