There are perfectly valid IP addresses of the form x.x.x.255. Try tracerouting to 24.130.78.255, for instance. RFC 1518 (http://www.ietf.org/rfc/rfc1518.txt) goes into some depth on this issue, but essentially we've done away with the idea of hard "classes" for IP addresses with implied masks. You can't tell what netmask a particular IP address has just from the address itself. And, even in the classed world, non-class C networks could have .255 as the last octet without implying a broadcast address.
Also, the decision about what a multicast address is based on the first octet, not the last: IP addresses ending in .254 can be a perfectly valid unicast address. Multicast addresses ("class D") start at 224.0.0.0 and go to 232.255.255.255 (according to RFC1112). You might want to make "class E" addresses (starting at 234.0.0.0 and going up) invalid, as they're considered reserved for future use. RFC1918 defines private net addresses, currently: 10.0.0.0 - 10.255.255.255 (10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) I would probably not recomending considering these invalid. Also, keep in mind that these are also valid IP addresses: 0 1089214484 (try it!) Doug On Tue, 20 Aug 2002, Angerstein wrote: > yes, correctly > > > -----Ursprüngliche Nachricht----- > > Von: Mat Harris [mailto:[EMAIL PROTECTED]] > > Gesendet am: Dienstag, 20. August 2002 16:07 > > An: Angerstein > > Cc: [EMAIL PROTECTED] > > Betreff: Re: AW: how to make a regex for a ip address > > > > the addresses x.x.x.255 and x.x.x.254 are not valid as the former is > > broadcast and the latter is multicast. Also, depending on your > > application, you may want to eliminate the class c addresses, (can't > > remember exact numbers) 172.15.x.x 172.25.x.x and 192.168.x.x and the > > class a address 10.0.0.0 > > > > On Tue, Aug 20, 2002 at 04:01:21PM +0200, Angerstein wrote: > > > > > > 0.0.0.0 is not an possible ip. > > > see O?Reilly TCP-IP or any other good Network book. > > > There are a some "not possible" ips, because of some > > bit-compinations that > > > may not appear. > > > (Has something to do with routing I think...) > > > > > > > > > > > > (And the reserved for further development/technologies IPs hehehehehe) > > > > > > try ping 0.0.0.0 in windows for example > > > > > > > > > > > > > -----Ursprüngliche Nachricht----- > > > > Von: Samy Kamkar [mailto:[EMAIL PROTECTED]] > > > > Gesendet am: Dienstag, 20. August 2002 15:35 > > > > An: Nikola Janceski > > > > Cc: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] > > > > Betreff: Re: AW: how to make a regex for a ip address > > > > > > > > wouldn't match 0.0.0.0 ;) > > > > oy vey, when will it be figured out > > > > how about > > > > /^(?:2(?:[0-4]\d|5[0-5])|1?\d{1,2}\.){3}(?:2(?:[0-4]\d|5[0-5])|1?\ > > > > d{1,2})$/ > > > > > > > > > > > > > > > > Nikola Janceski wrote: > > > > > > > > > > > > > /^(?:(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9]{1,2})\.){3}(25[0-5]| > > > > 2[0-4][0-9 > > > > > ]|[0-1][0-9]{2}|[1-9]{1,2})$/ > > > > > > > > > > shortened from stephen's just a bit. > > > > > > > > > > > > > > >>-----Original Message----- > > > > >>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > > > >>Sent: Tuesday, August 20, 2002 9:17 AM > > > > >>To: [EMAIL PROTECTED] > > > > >>Subject: RE: AW: how to make a regex for a ip address > > > > >> > > > > >> > > > > >>/^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9] > > > > >>)\.(25[0-5]|2[ > > > > >>0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5] > > > > >>|2[0-4][0-9]|[ > > > > >>0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9 > > > > >>]|[0-1]{1}[0-9 > > > > >>]{2}|[1-9]{1}[0-9]{1}|[0-9])$/ > > > > >> > > > > >>Stephen Redding > > > > >> > > > > >>BT Ignite Solutions > > > > >>Telephone - 0113 237 3277 > > > > >>Fax - 0113 244 1413 > > > > >>Email - [EMAIL PROTECTED] > > > > >>http://www.technet.bt.com/sit/public/ > > > > >> > > > > >> > > > > >>British Telecommunications plc > > > > >>Registered office: 81 Newgate Street London EC1A 7AJ > > > > >>Registered in England no. 1800000 > > > > >>This electronic message contains information from British > > > > >>Telecommunications > > > > >>plc which may be privileged or confidential. The information > > > > >>is intended to > > > > >>be for the use of the individual(s) or entity named above. If > > > > >>you are not > > > > >>the intended recipient be aware that any disclosure, copying, > > > > >>distribution > > > > >>or use of the contents of this information is prohibited. > > If you have > > > > >>received this electronic message in error, please notify us > > > > >>by telephone or > > > > >>email (to the numbers or address above) immediately. > > > > >> > > > > >> > > > > >> > > > > >>-----Original Message----- > > > > >>From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > > > > >>Sent: Tuesday, August 20, 2002 14:13 > > > > >>To: Nikola Janceski; 'Samy Kamkar'; 'Angerstein' > > > > >>Cc: '[EMAIL PROTECTED]' > > > > >>Subject: RE: AW: how to make a regex for a ip address > > > > >> > > > > >> > > > > >>oh and anything else after that last . > > > > >> > > > > >>000255.000255.000255.000255.slkfdja;ljd;alkjf;lajkd;ljkasfljka > > > > >>;ljdkf;lajsdl; > > > > >>jkf;lsajd > > > > >> > > > > >> > > > > >>>-----Original Message----- > > > > >>>From: Nikola Janceski > > > > >>>Sent: Tuesday, August 20, 2002 9:12 AM > > > > >>>To: 'Samy Kamkar'; Angerstein > > > > >>>Cc: [EMAIL PROTECTED] > > > > >>>Subject: RE: AW: how to make a regex for a ip address > > > > >>> > > > > >>> > > > > >>>But that would match > > > > >>> > > > > >>>000255.000255.000255.000255. > > > > >>> > > > > >>>hehehe :) > > > > >>> > > > > >>>I like the split loop check. > > > > >>> > > > > >>> > > > > >>>>-----Original Message----- > > > > >>>>From: Samy Kamkar [mailto:[EMAIL PROTECTED]] > > > > >>>>Sent: Tuesday, August 20, 2002 9:02 AM > > > > >>>>To: Angerstein > > > > >>>>Cc: [EMAIL PROTECTED] > > > > >>>>Subject: Re: AW: how to make a regex for a ip address > > > > >>>> > > > > >>>> > > > > >>>>/^(?:0*(?:2(?:[0-4]\d|5[0-5])|1?\d{1,2})(?:\.|$)){4}/ > > > > >>>> > > > > >>>>-Samy > > > > >>>> > > > > >>>>Angerstein wrote: > > > > >>>> > > > > >>>> > > > > >>>>>What about: > > > > >>>>>/\d?\d?\d\.\d?\d?\d\.\d?\d?\d\.\d?\d?\d\/ > > > > >>>>> > > > > >>>>>or > > > > >>>>> > > > > >>>>>@ip = split (/\./); > > > > >>>>>foreach $part (@ip) { > > > > >>>>> if ( $part > 255 && $part =~ /\d?\d?\d\/ ) { > > > > >>>>> die "That?s not an IP"; > > > > >>>>> } > > > > >>>>>} > > > > >>>>> > > > > >>>>> > > > > >>>>> > > > > >>>>>>-----Ursprüngliche Nachricht----- > > > > >>>>>>Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im > > > > >>>>>> > > > > >>>>Auftrag von > > > > >>>> > > > > >>>>>>zentara > > > > >>>>>>Gesendet am: Dienstag, 20. August 2002 14:50 > > > > >>>>>>An: [EMAIL PROTECTED] > > > > >>>>>>Betreff: Re: how to make a regex for a ip address > > > > >>>>>> > > > > >>>>>>On Mon, 19 Aug 2002 12:07:21 -0700, [EMAIL PROTECTED] > > > > >>>>>> > > > > >>>>(Root) wrote: > > > > >>>> > > > > >>>>>>>for a one liner: > > > > >>>>>>> > > > > >>>>>>>$_ = '12.34.56.78'; > > > > >>>>>>>map {$_ < 256} /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g || warn("not > > > > >>>>>>> > > > > >>>>>>> > > > > >>>>>>valid ip: $_\n"); > > > > >>>>>> > > > > >>>>>>I tried this with $_ = '1234.2345.56.78'; and received > > > > >>>>>> > > > > >>>no warning. > > > > >>> > > > > >>>>>>That's not good. > > > > >>>>>> > > > > >>>>>> > > > > >>>>>> > > > > >>>>>>-- > > > > >>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >>>>>>For additional commands, e-mail: [EMAIL PROTECTED] > > > > >>>>>> > > > > >>>>>> > > > > >>>>>> > > > > >>>>>> > > > > >>>>> > > > > >>>> > > > > >>>>-- > > > > >>>>Samy Kamkar -- cp5 -- [EMAIL PROTECTED] > > > > >>>>LucidX.com / LA.pm.org / code.LucidX.com > > > > >>>> > > > > >>>> > > > > >>>>-- > > > > >>>>To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >>>>For additional commands, e-mail: [EMAIL PROTECTED] > > > > >>>> > > > > >>>> > > > > >>-------------------------------------------------------------- > > > > >>-------------- > > > > >>-------------------- > > > > >>The views and opinions expressed in this email message are > > > > >>the sender's > > > > >>own, and do not necessarily represent the views and > > opinions of Summit > > > > >>Systems Inc. > > > > >> > > > > >> > > > > >>-- > > > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> > > > > >>-- > > > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> > > > > >> > > > > > > > > > > > > > > ------------------------------------------------------------------ > > > > ---------- > > > > > -------------------- > > > > > The views and opinions expressed in this email message are > > the sender's > > > > > own, and do not necessarily represent the views and > > opinions of Summit > > > > > Systems Inc. > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Samy Kamkar -- cp5 -- [EMAIL PROTECTED] > > > > LucidX.com / LA.pm.org / code.LucidX.com > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > > Mat Harris OpenGPG Public Key ID: CC14DD34 > > [EMAIL PROTECTED] www.genestate.com > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]