Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: gethostbyname("1.1.1") returns 1.1.0.1 ????

by MarkM (Curate)
on Mar 06, 2003 at 06:59 UTC ( [id://240826]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: gethostbyname("1.1.1") returns 1.1.0.1 ????
in thread gethostbyname("1.1.1") returns 1.1.0.1 ????

Although it is possible that I am not understanding your point, I believe your correction is incorrect.

127.1 is 127.0.0.1. There is no range. 127.1.1 is 127.1.0.1. Again, there is no range. (Well, to be exact, there is a range of 1) The spec allows zero's before the last to be left out as a convenient expression form, not as a method of defining subnet's or 'range'. IPv6 has a similar form that allows a single '::' to be specified within the address that indicates that all missing numbers at this location are 0. Again, it is a convenient expression form, and nothing more.

  • Comment on Re: Re: Re: gethostbyname("1.1.1") returns 1.1.0.1 ????

Replies are listed 'Best First'.
Re: Re: Re: Re: gethostbyname("1.1.1") returns 1.1.0.1 ????
by jdporter (Paladin) on Mar 11, 2003 at 19:56 UTC
    I suppose you probably are misunderstanding me.

    By "range", I mean the range of possible numeric values in each part. For example, in the typical "dotted quad" notation, the range of legal values in each part is 0 to 255, the possible values of an unsigned 8-bit number.

    When there are only three parts, the first two are 8 bits in size (thus have the usual range 0-255), but the last part represents a 16-bit number, and thus can legally have any value in the range 0 - 65535. 127.1.54321 is a legal, valid IP address.

    If you disagree with that, then you are simply mistaken. Try it:  inet_aton("127.1.54321");

    jdporter
    The 6th Rule of Perl Club is -- There is no Rule #6.

      I did misunderstand you, and also, I was not aware of the behaviour that you are referencing.

      Do you have a solid reference (from an RFC, STD, FYI, ISO, or POSIX document?) that describes this addressing notation? I did quite a few searches myself, and other than a few manpages that describes 'this is how inet_aton works', and the source code for inet_aton in GLIBC describing the intended effect, I cannot find any reference on the Internet that describes this 'feature'. In fact, I find the opposite. RFC's regarding the use of addresses in an email address seem to require that each decimal integer be in the range 0-255 (although they also seem to require 4 integers).

      Netscape on Linux supports addresses such as http://192.1204551/ (aka http://192.18.97.71/ aka http://java.sun.com/). Internet Explorer under Windows does not. Are you certain that this feature is portable? Or was it a convenient notation that was merely introduced in one of the earlier BSD tracks, and has continued to exist until today? Until I can verify that this feature is standard and portable, I cannot agree with your correction. I would appreciate it if you could prove to me that I am wrong. I hate not knowing.

        addresses such as http://192.1204551/ (aka http://192.18.97.71/
        aka http://3222430023/.
        Do you have a solid reference...?
        Nope. I looked too, and couldn't find one.
        I agree with your assessment that it probably is not portable.
        (Leave it to Microsoft to write an incompatible - if compliant - network library...)

        jdporter
        The 6th Rule of Perl Club is -- There is no Rule #6.

        RFC0791
        Addresses are fixed length of four octets (32 bits). An address begins with a network number, followed by local address (called the "rest" field). There are three formats or classes of internet addresses: in class a, the high order bit is zero, the next 7 bits are the network, and the last 24 bits are the local address; in class b, the high order two bits are one-zero, the next 14 bits are the network and the last 16 bits are the local address; in class c, the high order three bits are one-one-zero, the next 21 bits are the network and the last 8 bits are the local address.
            Address Formats:
        
              High Order Bits   Format                           Class
              ---------------   -------------------------------  -----
                    0            7 bits of net, 24 bits of host    a
                    10          14 bits of net, 16 bits of host    b
                    110         21 bits of net,  8 bits of host    c
                    111         escape to extended addressing mode
        
              A value of zero in the network field means this network.  This is
              only used in certain ICMP messages.  The extended addressing mode
              is undefined.  Both of these features are reserved for future use.
        

        once you have grokked this your question will be answered.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://240826]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found