1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
//
// This file is part of Zond Engine, licensed under the GNU Affero General
// Public License, version 3 or later. See the LICENSE file for details, or
// <https://www.gnu.org/licenses/agpl-3.0.html>.
//
// SPDX-License-Identifier: AGPL-3.0-or-later
//! # What the hardware address says about the software
//!
//! Usually nothing, and saying so is most of this module's job.
//!
//! ## Only a vendor whose hardware implies something says anything
//!
//! A hardware address names whoever registered the address block. For a machine
//! whose maker also writes what runs on it, that is a real signal: an address
//! belonging to Apple is on Apple hardware, and Apple hardware runs Apple's
//! operating system unless somebody went out of their way. For a commodity
//! network adapter it is no signal at all, an Intel or Realtek chip is in
//! machines running every operating system there is, and a laptop vendor's
//! block says who assembled the case.
//!
//! So this maps the first kind and **declines the second**, rather than reaching
//! for the nearest plausible answer. Declining is the whole value: an OUI source
//! that guessed would be wrong on the commonest hardware there is, and wrong in a
//! way nothing downstream could see.
//!
//! ## What a network equipment vendor implies is a class, not a family
//!
//! Cisco, Ubiquiti and the rest write their own systems too, so it is tempting to
//! read their blocks the same way. It is the wrong reading, because a great many
//! of their boxes run Linux and announce it: the address establishes that the
//! machine is infrastructure and says nothing about what is on it.
//!
//! Written as a family, `Network device` runs against `Linux` on the ballot
//! [`resolve`](super::resolve) settles by vote, and a router that had correctly
//! named itself `Debian 12` over SSH was reported as nothing at all once the scan
//! looked up its address. Those vendors state a device class and abstain from the
//! family, which is what [`OsEvidence::device`] exists for.
//!
//! ## Randomised addresses have no vendor at all
//!
//! Measured on a labelled segment: **five of eight hosts answered from a
//! locally-administered address**, one made up by the device rather than
//! assigned from a registered block. Address randomisation is a privacy default
//! on modern mobile platforms, and a vendor lookup against such an address
//! returns nothing, or worse, a coincidental match against whoever holds the
//! block those random bits happen to land in.
//!
//! [`HardwareInfo`] already declines to name a vendor for one, so that guard is
//! upstream of here. It is restated because it is the difference between this
//! source being quiet on a phone and being confidently wrong about one.
//!
//! ## What it is worth
//!
//! Little on its own, and that is correct. Apple hardware running Linux is a real
//! thing; so is a Raspberry Pi running something other than Linux. This is a
//! prior, not an identification, and [`CONFIDENCE`] is set where a lone hit stays
//! below the floor that reports anything at all. It earns its place by *agreeing*
//! with a stack reading and pushing a verdict past what one packet could support.
use crateHardwareInfo;
use crateOsEvidence;
use crateOsSource;
/// What a vendor match contributes on its own.
///
/// Deliberately below the floor [`resolve`](super::resolve) reports at, so this
/// source can never name a host by itself. Hardware and software are separable,
/// the address says who made the machine, and somebody may have installed
/// anything on it. What it is good for is confirming a reading taken from the
/// wire, and for that it does not need to be large.
pub const CONFIDENCE: f32 = 0.3;
/// Vendors who ship the operating system on their own hardware, and the family
/// that implies.
///
/// Matched case-insensitively on a prefix of the registered company name, which
/// is how these appear in the OUI registry, where "Apple, Inc." and "Apple" are
/// the same organisation across decades of registrations.
///
/// The list is short on purpose. Every entry is a vendor who makes both the
/// machine and what runs on it; the moment that stops being true the entry is a
/// guess wearing the clothes of a measurement. Commodity adapter and PC makers,
/// Intel, Realtek, Broadcom, Dell, Lenovo, HP, are absent, because
/// their silicon is in machines running everything.
const VENDOR_FAMILIES: & = &;
/// Vendors whose blocks are attached to network equipment, and the class that
/// implies.
///
/// A class, not a family, and the difference is the whole reason this table is
/// separate from the one above. These vendors ship an operating system too,
/// but a great many of their boxes run Linux and say so out loud over SSH. Read
/// as a family, `Network device` runs against `Linux` on the ballot
/// [`resolve`](super::resolve) settles by vote and both lose.
///
/// That is measured rather than argued. A Linux-based router announcing
/// `Debian 12` resolved to `Linux 55, version 12` on its banner alone, and to
/// nothing at all once the same scan looked up the address it answered from.
/// Adding a true observation removed the answer, for eight of the ten vendors
/// this module knows.
///
/// So these abstain from the family and state what they actually establish,
/// which is that the box is infrastructure. Both answers then survive: a
/// `Network device` running `Linux 12`, which is what the machine is.
const VENDOR_DEVICES: & = &;
/// What the hardware behind a host suggests, if anything: a family for a vendor
/// who ships the system on its own machines, a device class for one whose blocks
/// are attached to network equipment.
///
/// `None`, which is the common answer, when the address was randomised and has
/// no vendor, when the vendor is in neither table, or when no hardware was
/// recorded at all.
///
/// Declining is the point rather than a shortfall. A hardware address names
/// whoever registered the block: for a maker who also writes the operating
/// system that is a real signal, and for a commodity adapter it is none at all,
/// since the same silicon sits in machines running everything. A source that
/// guessed here would be wrong on the commonest hardware there is, in a way
/// nothing downstream could see.
// ╔════════════════════════════════════════════╗
// ║ ████████╗███████╗███████╗████████╗███████╗ ║
// ║ ╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝██╔════╝ ║
// ║ ██║ █████╗ ███████╗ ██║ ███████╗ ║
// ║ ██║ ██╔══╝ ╚════██║ ██║ ╚════██║ ║
// ║ ██║ ███████╗███████║ ██║ ███████║ ║
// ║ ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝ ║
// ╚════════════════════════════════════════════╝