From: "scott comer (sccomer)" <sccomer@cisco.com>
To: Alexey Toptygin <alexeyt@freeshell.org>
Cc: Phil Oester <kernel@linuxace.com>, netfilter-devel@lists.netfilter.org
Subject: Re: iptables 1.3.6 not using /etc/networks
Date: Mon, 13 Nov 2006 13:50:29 -0600 [thread overview]
Message-ID: <4558CC85.4070607@cisco.com> (raw)
In-Reply-To: <Pine.NEB.4.64.0611131738460.2106@ukato.freeshell.org>
[-- Attachment #1: Type: text/plain, Size: 3215 bytes --]
Alexey Toptygin wrote:
> On Mon, 13 Nov 2006, Phil Oester wrote:
>
>> On Mon, Nov 13, 2006 at 12:58:48AM +0000, Alexey Toptygin wrote:
>>>> But if you use a FQDN such as www.domain.com/24, then shouldn't that
>>>> then imply <ip of www.domain.com>/24? That's why I didn't make the
>>>> exception for letters vs. digits, as it could be used either way.
>>>
>>> I don't understand what you mean. I think if it starts with a digit, it
>>> must be an IP (or part of an IP with 0's dropped), else it is a network
>>> name or a domain name (since neither of those can start with
>>> digits). If
>>> it's an IP by the above logic, then pad it with '.0's as necessary (or
>>> translate directly into a number without padding first). If it's not an
>>> IP, first call getnetbyname on it and if that returns NULL call
>>> gethostbyname. I think this algorithm works in all cases, unless I'm
>>> missing something.
>>
>> What I meant was some people might want to include the /24 a host sits
>> on, and use something like "mydomain.com/24". When the name gets
>> translated to 1.2.3.4, the cidr would make it 1.2.3.0/24.
>>
>> Also, as Martijn points out, just starting with digit doesn't imply
>> an IP, as hosts can start with digits also.
>
> I think my mail server ate my replies to this, so here it is a third
> time. Sorry if this is a duplicate; if it is, please let me know and
> I'll shut up (my incoming mail seems to be working fine). DNS domain
> names are not allowed to start with digits; I quote RFC 1034:
>
>> <domain> ::= <subdomain> | " "
>> <subdomain> ::= <label> | <subdomain> "." <label>
>> <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
>> <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
>> <let-dig-hyp> ::= <let-dig> | "-"
>> <let-dig> ::= <letter> | <digit>
>> <letter> ::= any one of the 52 alphabetic characters A through Z in
>> upper case and a through z in lower case
>> <digit> ::= any one of the ten digits 0 through 9
>
the above is obsolete by rfc 1123, section 2.1, Host Names and Numbers.
only a complete
parse of the name will show that you have the ipv4 address instead
(#.#.#.#):
"..., then a full syntactic check must be made, because a segment of a
host domain
name is now allowed to begin with a digit and could legally be entirely
numeric
(see Section 6.1.2.4). However, a valid host name can never have the
dotted-decimal
form #.#.#.#, since at least the highest-level component label will be
alphabetic."
> Thus, if the first character is a digit, the string cannot be a domain
> name.
> I guess it could still be a network name in /etc/networks, but that
> would be a bit pathological. If you still don't like this approach,
> then how about:
>
> 1) parse and remove any trailing /x
> 2) try to parse string you get from step 1 as a (partial) IP address. If
> it parses OK, it's an IP, otherwise
> 3) look the string you get from step 1 (with no added .0s from step 2, if
> any) up via getnetbyname. If that returns non-NULL, use this result,
> otherwise
> 4) look the string you get from step 1 (with no added .0s from step 2, if
> any) up via gethostbyname. If that returns non-NULL, use that,
> otherwise
> 5) fail.
> Alexey
next prev parent reply other threads:[~2006-11-13 19:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-12 1:25 iptables 1.3.6 not using /etc/networks Laurence J. Lane
2006-11-12 2:35 ` Laurence J. Lane
2006-11-12 17:33 ` Phil Oester
2006-11-12 19:36 ` Alexey Toptygin
2006-11-12 19:43 ` Phil Oester
2006-11-13 0:58 ` Alexey Toptygin
2006-11-13 7:23 ` Martijn Lievaart
2006-11-13 15:50 ` Alexey Toptygin
2006-11-13 20:20 ` Martijn Lievaart
2006-11-13 21:23 ` Alexey Toptygin
2006-11-14 9:06 ` offtopic " Amin Azez
2006-11-14 9:24 ` Benny Amorsen
2006-11-13 17:12 ` Phil Oester
2006-11-13 17:56 ` Alexey Toptygin
2006-11-13 19:50 ` scott comer (sccomer) [this message]
2006-11-18 22:09 ` Laurence J. Lane
2006-11-18 22:12 ` Laurence J. Lane
2006-11-20 0:00 ` Pablo Neira Ayuso
2006-11-23 14:10 ` Patrick McHardy
2006-11-23 20:56 ` Pablo Neira Ayuso
2006-11-24 5:55 ` Phil Oester
2006-11-24 8:43 ` Patrick McHardy
2006-11-29 4:44 ` Phil Oester
2006-11-29 12:50 ` Patrick McHardy
2006-11-29 14:09 ` Amin Azez
2006-11-29 14:21 ` Pablo Neira Ayuso
2006-11-19 20:34 ` Pablo Neira Ayuso
-- strict thread matches above, loose matches on Subject: below --
2006-11-13 17:00 Alexey Toptygin
[not found] <200611131926.kADJPxur030380@mail3.jubileegroup.co.uk>
2006-11-14 10:17 ` G.W. Haywood
2006-11-14 19:28 ` Grant Coady
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4558CC85.4070607@cisco.com \
--to=sccomer@cisco.com \
--cc=alexeyt@freeshell.org \
--cc=kernel@linuxace.com \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.