跳到主要内容

数据包格式

除非另有说明,所示数字均为十进制。BOOTP 数据包封装在标准的 IP [8] UDP [7] 数据报中。为简单起见,假定 BOOTP 数据包永不分片。所示的任何数值字段均按"标准网络字节序"打包,即先发送高位。

在 bootrequest 的 IP 头中,客户机填入自己的 IP 源地址(如果已知),否则填零。当服务器地址未知时,IP 目的地址为"广播地址" 255.255.255.255。该地址的含义是"在本地电缆上广播(我不知道自己的网络号)" [4]。

UDP 头包含源端口号和目的端口号。BOOTP 协议使用两个保留端口号:"BOOTP client"(68)和"BOOTP server"(67)。客户机发送请求时以"BOOTP server"作为目的端口,这通常是广播。服务器发送应答时以"BOOTP client"作为目的端口;视服务器内核或驱动所提供的设施而定,这可能是广播,也可能不是(下文"Chicken/Egg issues"一节会进一步说明)。使用两个保留端口的原因,是为了在必须把 bootreply 广播给客户机时,避免"唤醒"并调度 BOOTP 服务器守护进程。由于服务器和其他主机不会监听"BOOTP client"端口,任何此类传入的广播都会在内核层被过滤掉。我们不能简单地让客户机为 UDP 源端口字段选择一个"随机"端口号;因为服务器的应答可能是广播,随机选择的端口号可能会使恰好在监听该端口的其他主机产生混淆。

UDP 长度字段设置为数据包中 UDP 部分加 BOOTP 部分的长度。如果需要,客户机(或服务器)可以把 UDP 校验和字段置为零,以避免在 PROM 实现中产生这项额外开销。在下文"Packet Processing"一节中,凡是可能需要验证/计算校验和之处,都使用短语"[UDP checksum.]"。

FIELD   BYTES   DESCRIPTION
----- ----- -----------

op 1 packet op code / message type.
1 = BOOTREQUEST, 2 = BOOTREPLY

htype 1 hardware address type,
see ARP section in "Assigned Numbers" RFC.
'1' = 10mb ethernet

hlen 1 hardware address length
(eg '6' for 10mb ethernet).

hops 1 client sets to zero,
optionally used by gateways
in cross-gateway booting.

xid 4 transaction ID, a random number,
used to match this boot request with the
responses it generates.

secs 2 filled in by client, seconds elapsed since
client started trying to boot.

-- 2 unused

ciaddr 4 client IP address;
filled in by client in bootrequest if known.

yiaddr 4 'your' (client) IP address;
filled by server if client doesn't
know its own address (ciaddr was 0).

siaddr 4 server IP address;
returned in bootreply by server.

giaddr 4 gateway IP address,
used in optional cross-gateway booting.

chaddr 16 client hardware address,
filled in by client.

sname 64 optional server host name,
null terminated string.

file 128 boot file name, null terminated string;
'generic' name or null in bootrequest,
fully qualified directory-path
name in bootreply.

vend 64 optional vendor-specific area,
e.g. could be hardware type/serial on request,
or 'capability' / remote file system handle
on reply. This info may be set aside for use
by a third phase bootstrap or kernel.