From owner-freebsd-bugs Sat Aug 12 03:29:52 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id DAA20330 for bugs-outgoing; Sat, 12 Aug 1995 03:29:52 -0700 Received: from grunt.grondar.za (grunt.grondar.za [196.7.18.129]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id DAA20318 for ; Sat, 12 Aug 1995 03:29:32 -0700 Received: from grumble.grondar.za (grumble.grondar.za [196.7.18.130]) by grunt.grondar.za (8.6.11/8.6.9) with ESMTP id MAA12991; Sat, 12 Aug 1995 12:29:20 +0200 Received: from localhost (localhost [127.0.0.1]) by grumble.grondar.za (8.6.11/8.6.9) with SMTP id MAA28674; Sat, 12 Aug 1995 12:29:19 +0200 Message-Id: <199508121029.MAA28674@grumble.grondar.za> X-Authentication-Warning: grumble.grondar.za: Host localhost didn't use HELO protocol To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) cc: jkh@freefall.FreeBSD.org (Jordan K. Hubbard), freebsd-bugs@FreeBSD.org Subject: Re: 950726-SNAP lp0/nfs install bug ? Date: Sat, 12 Aug 1995 12:29:18 +0200 From: Mark Murray Sender: bugs-owner@FreeBSD.org Precedence: bulk > As Jordan K. Hubbard wrote: > > > > Hmmm. Anyone willing to give me a little formula to calculate > > netmask based on IP address? Then I could also fill it in.. :-) > > unsigned char addr_high; > unsigned int netmask; > > addr_high = ...; /* highest byte of IP address */ > > if(addr_high < 128) > netmask = 0xff000000; > else if(addr_high < 192) > netmask = 0xffff0000; > else if(addr_high < 224) > netmask = 0xffffff00; > else > /* multicast or class E -- not particularly useful */ > netmask = 0xffffffff; You are not allowed to do this anymore. The ability to determine a netmask from the bit pattern of an IP address, while valid in the past is no longer so. Because of IP address space shortage, numbers are being assigned as address ranges, and the ABCDE class system is severely deprecated. When a sevice provider asks for a block of "class C's", they may get 19.20/16, which they can (If they only want "classic" class c's) distribute as 19.20.0/24 -> 19.20.255/24, even though 19.n.n.n is a class A by the old (and above) reckoning. In this case the above calculation will give a totally wrong netmask. M -- Mark Murray 46 Harvey Rd, Claremont, Cape Town 7700, South Africa +27 21 61-3768 GMT+0200 Finger mark@grumble.grondar.za for PGP key