AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1007283
Accepted
ZaZa
ZaZa
Asked: 2020-03-18 08:53:12 +0800 CST2020-03-18 08:53:12 +0800 CST 2020-03-18 08:53:12 +0800 CST

多级 DNS 名称压缩

  • 772

我正在实现一个小的DNS stub server,我在解释部分DNS RFC 1035时遇到了麻烦。

The compression scheme allows a domain name in a message to be
represented as either:

   - a sequence of labels ending in a zero octet

   - a pointer

   - a sequence of labels ending with a pointer

DNS名称跟随多个指针是否有效?即以指针结尾的标签序列指向以指针结尾的标签序列,可能多次。或者在使用压缩时,只有以指向以零八位字节结尾的标签序列的指针结尾的标签序列才有效?谢谢。

domain-name-system
  • 1 1 个回答
  • 1013 Views

1 个回答

  • Voted
  1. Best Answer
    Patrick Mevzek
    2020-03-21T09:00:51+08:002020-03-21T09:00:51+08:00

    DNS名称跟随多个指针是否有效?

    是和否。

    想象一下你有名字(不是为每个名字写结束点):

    • example.com
    • a.example.com
    • b.a.example.com
    • c.example.com.example.net

    如果按此顺序,它们可以编码为:

    1. example+ com+ \0(2 个标签 + 零八位字节)
    2. a+ 指向前一项的指针
    3. 任何一个:
      1. b+ 指向前一项的指针(应该是首选,更强的压缩)
      2. 或b++a指向第一项的指针
    4. c+ example+ com+ example+ net+\0

    在最后一种情况下,你不能做c+ 指向 first 的指针,example.com因为如果你这样做,那么example.com你就会进入决赛\0,因此你完成了,你只编码c.example.com而不编码c.example.com.example.net。

    基本上,您可以将压缩视为压缩后缀。名称中的任何地方都不是任意压缩。

    但是第三种情况变体 1 表明您可以遵循多个指针:b+ 指向 ( a+ 指向 ( example+ com+ \0) 的指针)

    RFC 1035 的第 4.1.4 节有一个完整的例子:

    For example, a datagram might need to use the domain names F.ISI.ARPA,
    FOO.F.ISI.ARPA, ARPA, and the root.  Ignoring the other fields of the
    message, these domain names might be represented as:
    
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        20 |           1           |           F           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        22 |           3           |           I           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        24 |           S           |           I           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        26 |           4           |           A           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        28 |           R           |           P           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        30 |           A           |           0           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        40 |           3           |           F           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        42 |           O           |           O           |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        44 | 1  1|                20                       |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        64 | 1  1|                26                       |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        92 |           0           |                       |
           +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    
    The domain name for F.ISI.ARPA is shown at offset 20.  The domain name
    FOO.F.ISI.ARPA is shown at offset 40; this definition uses a pointer to
    concatenate a label for FOO to the previously defined F.ISI.ARPA.  The
    domain name ARPA is defined at offset 64 using a pointer to the ARPA
    component of the name F.ISI.ARPA at 20; note that this pointer relies on
    ARPA being the last label in the string at 20.  The root domain name is
    defined by a single octet of zeros at 92; the root domain name has no
    labels.
    
    • 3

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve